From 6fe78c99314d88450e8efed5b09dbcd31c5d9ec5 Mon Sep 17 00:00:00 2001 From: dan63047 Date: Mon, 4 Sep 2023 21:00:13 +0300 Subject: [PATCH] Fix of stupid bug + i moved some view to side menu --- lib/views/main_view.dart | 29 ++++++++++++++++++++++------- lib/views/rank_averages_view.dart | 11 +---------- lib/views/ranks_averages_view.dart | 2 +- pubspec.yaml | 2 +- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/lib/views/main_view.dart b/lib/views/main_view.dart index 110731a..8a68470 100644 --- a/lib/views/main_view.dart +++ b/lib/views/main_view.dart @@ -11,6 +11,7 @@ import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/gen/strings.g.dart'; import 'package:tetra_stats/services/tetrio_crud.dart'; import 'package:tetra_stats/services/crud_exceptions.dart'; +import 'package:tetra_stats/views/ranks_averages_view.dart'; import 'package:tetra_stats/views/tl_leaderboard_view.dart' show TLLeaderboardView; import 'package:tetra_stats/views/tl_match_view.dart' show TlMatchResultView; import 'package:tetra_stats/widgets/stat_sell_num.dart'; @@ -466,6 +467,20 @@ class _NavDrawerState extends State { }, ), ), + SliverToBoxAdapter( + child: ListTile( + leading: const Icon(Icons.compress), + title: Text(t.rankAveragesViewTitle), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const RankAveragesView(), + ), + ); + }, + ), + ), const SliverToBoxAdapter(child: Divider()) ]; }, @@ -508,17 +523,17 @@ class _TLRecords extends StatelessWidget { fontSize: 28,)), title: Text("vs. ${value.endContext.firstWhere((element) => element.userId != userID).username}"), subtitle: Text(dateFormat.format(value.timestamp)), - trailing: Table(defaultColumnWidth: IntrinsicColumnWidth(), + trailing: Table(defaultColumnWidth: const IntrinsicColumnWidth(), defaultVerticalAlignment: TableCellVerticalAlignment.baseline, textBaseline: TextBaseline.alphabetic, - columnWidths: { + columnWidths: const { 0: FixedColumnWidth(50), 2: FixedColumnWidth(50), }, children: [ - TableRow(children: [Text(f2.format(value.endContext.firstWhere((element) => element.userId == userID).secondary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: const TextStyle(height: 1.1)), Text(f2.format(value.endContext.firstWhere((element) => element.userId != userID).secondary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" APM", textAlign: TextAlign.right, style: const TextStyle(height: 1.1))]), - TableRow(children: [Text(f2.format(value.endContext.firstWhere((element) => element.userId == userID).tertiary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: const TextStyle(height: 1.1)), Text(f2.format(value.endContext.firstWhere((element) => element.userId != userID).tertiary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" PPS", textAlign: TextAlign.right, style: const TextStyle(height: 1.1))]), - TableRow(children: [Text(f2.format(value.endContext.firstWhere((element) => element.userId == userID).extra), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: const TextStyle(height: 1.1)), Text(f2.format(value.endContext.firstWhere((element) => element.userId != userID).extra), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" VS", textAlign: TextAlign.right, style: const TextStyle(height: 1.1))]), + TableRow(children: [Text(f2.format(value.endContext.firstWhere((element) => element.userId == userID).secondary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(f2.format(value.endContext.firstWhere((element) => element.userId != userID).secondary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" APM", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]), + TableRow(children: [Text(f2.format(value.endContext.firstWhere((element) => element.userId == userID).tertiary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(f2.format(value.endContext.firstWhere((element) => element.userId != userID).tertiary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" PPS", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]), + TableRow(children: [Text(f2.format(value.endContext.firstWhere((element) => element.userId == userID).extra), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(f2.format(value.endContext.firstWhere((element) => element.userId != userID).extra), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" VS", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]), ],), onTap: (){Navigator.push( context, @@ -583,8 +598,8 @@ class _HistoryChartThigy extends StatelessWidget{ lineBarsData: [LineChartBarData(spots: data)], borderData: FlBorderData(show: false), gridData: FlGridData(verticalInterval: xInterval), - titlesData: FlTitlesData(topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), - rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), + titlesData: FlTitlesData(topTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)), + rightTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)), bottomTitles: AxisTitles(sideTitles: SideTitles(interval: xInterval, showTitles: true, reservedSize: 30, getTitlesWidget: (double value, TitleMeta meta){ return value != meta.min && value != meta.max ? SideTitleWidget( axisSide: meta.axisSide, diff --git a/lib/views/rank_averages_view.dart b/lib/views/rank_averages_view.dart index d600b3e..63e5228 100644 --- a/lib/views/rank_averages_view.dart +++ b/lib/views/rank_averages_view.dart @@ -321,16 +321,7 @@ class RankState extends State with SingleTickerProviderStateMixin { ], ), onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MainView( - player: widget - .rank[1]["entries"][index] - .username), - maintainState: false, - ), - ); + Navigator.push(context, MaterialPageRoute(builder: (context) => MainView(player: they[index].username), maintainState: false)); }, ); }), diff --git a/lib/views/ranks_averages_view.dart b/lib/views/ranks_averages_view.dart index 53d711f..5fbb5d7 100644 --- a/lib/views/ranks_averages_view.dart +++ b/lib/views/ranks_averages_view.dart @@ -33,7 +33,7 @@ class RanksAverages extends State { ), backgroundColor: Colors.black, body: SafeArea( - child: ListView.builder( + child: averages.isEmpty ? const Center(child: Text('Fetching...')) : ListView.builder( itemCount: averages.length, itemBuilder: (context, index){ bool bigScreen = MediaQuery.of(context).size.width > 768; diff --git a/pubspec.yaml b/pubspec.yaml index 3139637..b9dabf4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: tetra_stats description: Track your and other player stats in TETR.IO publish_to: 'none' -version: 1.2.0+8 +version: 1.2.1+9 environment: sdk: '>=2.19.6 <3.0.0'