mobile web sucks

This commit is contained in:
dan63047 2025-01-04 00:03:32 +03:00
parent fe2b5d491f
commit 2526ecd0d0
8 changed files with 232 additions and 219 deletions

View File

@ -35,7 +35,7 @@ import 'package:tetra_stats/services/sqlite_db_controller.dart';
import 'package:csv/csv.dart'; import 'package:csv/csv.dart';
const String dbName = "TetraStats.db"; const String dbName = "TetraStats.db";
const String webVersionDomain = "ts.dan63.by"; const String webVersionDomain = "tsbeta.dan63.by";
const String tetrioUsersTable = "tetrioUsers"; const String tetrioUsersTable = "tetrioUsers";
const String tetrioUsersToTrackTable = "tetrioUsersToTrack"; const String tetrioUsersToTrackTable = "tetrioUsersToTrack";
const String tetraLeagueMatchesTable = "tetrioAlphaLeagueMathces"; const String tetraLeagueMatchesTable = "tetrioAlphaLeagueMathces";

View File

@ -746,11 +746,8 @@ class CompareState extends State<CompareView> {
await addRankAverages(nickname.substring(4).toLowerCase()); await addRankAverages(nickname.substring(4).toLowerCase());
return null; return null;
}else{ }else{
late TetrioPlayer player; TetrioPlayer player = await teto.fetchPlayer(nickname);
late Summaries summary; Summaries summary = await teto.fetchSummaries(player.userId);
List<dynamic> requests = await Future.wait([teto.fetchPlayer(nickname), teto.fetchSummaries(players.last.userId)]);
player = requests[0];
summary = requests[1];
players.add(player); players.add(player);
summaries.add(summary); summaries.add(summary);
addvaluesEntrys(players.last, summaries.last); addvaluesEntrys(players.last, summaries.last);
@ -848,103 +845,105 @@ class CompareState extends State<CompareView> {
), ),
body: SafeArea( body: SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
child: SingleChildScrollView( child: Column(
scrollDirection: Axis.horizontal, crossAxisAlignment: CrossAxisAlignment.center,
controller: _scrollController, children: [
physics: const AlwaysScrollableScrollPhysics(), Center(
child: Column( child: SingleChildScrollView(
crossAxisAlignment: CrossAxisAlignment.start, scrollDirection: Axis.horizontal,
children: [ controller: _scrollController,
Column( physics: const AlwaysScrollableScrollPhysics(),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Row(
children: [ children: [
SizedBox( Row(
height: 175.0, children: [
width: 300.0, SizedBox(
child: Card( height: 175.0,
child: Padding( width: 300.0,
padding: const EdgeInsets.fromLTRB(90.0, 18.0, 5.0, 0), child: Card(
child: Text(t.comparison, style: TextStyle(fontSize: 28)), child: Padding(
padding: const EdgeInsets.fromLTRB(18.0, 120.0, 5.0, 0),
child: Text(t.comparison, style: TextStyle(fontSize: 28)),
),
), ),
), ),
), for (var p in players) SizedBox(
for (var p in players) SizedBox( width: 300.0,
width: 300.0, child: HeaderCard(p, removePlayer),
child: HeaderCard(p, removePlayer), ),
), SizedBox(width: 300, child: AddNewColumnCard(addPlayer))
SizedBox(width: 300, child: AddNewColumnCard(addPlayer)) ]
] ),
), if (tlOnly) SizedBox(
if (tlOnly) SizedBox( width: 300+300*summaries.length.toDouble(),
width: 300+300*summaries.length.toDouble(), child: Column(
child: Column( children: [
children: [ Row(
Row( children: [
children: [ SizedBox(
SizedBox( width: 300.0,
width: 300.0, child: Card(
child: Card( child: Column(children: [
child: Column(children: [ for (String title in TitesForStats[TitesForStats.keys.elementAt(1)]!) Text(title),
for (String title in TitesForStats[TitesForStats.keys.elementAt(1)]!) Text(title), ]),
]),
),
),
for (int k = 0; k < formattedValues[1].length; k++) SizedBox(
width: 300.0,
child: Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
for (int l = 0; l < formattedValues[1][k].length; l++) Container(decoration: (rawValues[1].length > 1 && rawValues[1][k][l] != null && best[1][l] == rawValues[1][k][l]) ? BoxDecoration(boxShadow: [BoxShadow(color: Colors.cyanAccent.withAlpha(96), spreadRadius: 0, blurRadius: 4)]) : null, child: formattedValues[1][k][l]),
],
), ),
), ),
), for (int k = 0; k < formattedValues[1].length; k++) SizedBox(
] width: 300.0,
), child: Card(
VsGraphs(stats: [for (var s in summaries) if (s.league.nerdStats != null) AggregateStats.precalculated(s.league.apm!, s.league.pps!, s.league.vs!, s.league.nerdStats!, s.league.playstyle!)], nicknames: [for (int i = 0; i < summaries.length; i++) if (summaries[i].league.nerdStats != null) nicknames[i]]), child: Column(
], mainAxisSize: MainAxisSize.min,
), children: [
) for (int l = 0; l < formattedValues[1][k].length; l++) Container(decoration: (rawValues[1].length > 1 && rawValues[1][k][l] != null && best[1][l] == rawValues[1][k][l]) ? BoxDecoration(boxShadow: [BoxShadow(color: Colors.cyanAccent.withAlpha(96), spreadRadius: 0, blurRadius: 4)]) : null, child: formattedValues[1][k][l]),
else for (int i = 0; i < formattedValues.length; i++) SizedBox( ],
width: 300+300*summaries.length.toDouble(), ),
child: ExpansionTile(
title: Text(TitesForStats.keys.elementAt(i), style: _expansionTileTitleTextStyle),
children: [
Row(
children: [
SizedBox(
width: 300.0,
child: Card(
child: Column(children: [
for (String title in TitesForStats[TitesForStats.keys.elementAt(i)]!) Text(title),
]),
),
),
for (int k = 0; k < formattedValues[i].length; k++) SizedBox(
width: 300.0,
child: Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
for (int l = 0; l < formattedValues[i][k].length; l++) Container(decoration: (rawValues[0].length > 1 && rawValues[i][k][l] != null && best[i][l] == rawValues[i][k][l]) ? BoxDecoration(boxShadow: [BoxShadow(color: Colors.cyanAccent.withAlpha(96), spreadRadius: 0, blurRadius: 4)]) : null, child: formattedValues[i][k][l]),
],
), ),
), ),
), ]
] ),
), VsGraphs(stats: [for (var s in summaries) if (s.league.nerdStats != null) AggregateStats.precalculated(s.league.apm!, s.league.pps!, s.league.vs!, s.league.nerdStats!, s.league.playstyle!)], nicknames: [for (int i = 0; i < summaries.length; i++) if (summaries[i].league.nerdStats != null) nicknames[i]]),
if (i == 1) VsGraphs(stats: [for (var s in summaries) if (s.league.nerdStats != null) AggregateStats.precalculated(s.league.apm!, s.league.pps!, s.league.vs!, s.league.nerdStats!, s.league.playstyle!)], nicknames: [for (int i = 0; i < summaries.length; i++) if (summaries[i].league.nerdStats != null) nicknames[i]]), ],
if (i == 2) VsGraphs(stats: [for (var s in summaries) if ((s.zenith != null || s.zenithCareerBest != null) && (s.zenith?.aggregateStats??s.zenithCareerBest!.aggregateStats).apm > 0.00) s.zenith?.aggregateStats??s.zenithCareerBest!.aggregateStats], nicknames: [for (int i = 0; i < summaries.length; i++) if ((summaries[i].zenith != null || summaries[i].zenithCareerBest != null) && (summaries[i].zenith?.aggregateStats??summaries[i].zenithCareerBest!.aggregateStats).apm > 0.00) nicknames[i]]), ),
if (i == 3) VsGraphs(stats: [for (var s in summaries) if ((s.zenithEx != null || s.zenithExCareerBest != null) && (s.zenithEx?.aggregateStats??s.zenithExCareerBest!.aggregateStats).apm > 0.00) s.zenithEx?.aggregateStats??s.zenithExCareerBest!.aggregateStats], nicknames: [for (int i = 0; i < summaries.length; i++) if ((summaries[i].zenithEx != null || summaries[i].zenithExCareerBest != null) && (summaries[i].zenithEx?.aggregateStats??summaries[i].zenithExCareerBest!.aggregateStats).apm > 0.00) nicknames[i]]), )
], else for (int i = 0; i < formattedValues.length; i++) SizedBox(
width: 300+300*summaries.length.toDouble(),
child: ExpansionTile(
title: Text(TitesForStats.keys.elementAt(i), style: _expansionTileTitleTextStyle),
children: [
Row(
children: [
SizedBox(
width: 300.0,
child: Card(
child: Column(children: [
for (String title in TitesForStats[TitesForStats.keys.elementAt(i)]!) Text(title),
]),
),
),
for (int k = 0; k < formattedValues[i].length; k++) SizedBox(
width: 300.0,
child: Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
for (int l = 0; l < formattedValues[i][k].length; l++) Container(decoration: (rawValues[0].length > 1 && rawValues[i][k][l] != null && best[i][l] == rawValues[i][k][l]) ? BoxDecoration(boxShadow: [BoxShadow(color: Colors.cyanAccent.withAlpha(96), spreadRadius: 0, blurRadius: 4)]) : null, child: formattedValues[i][k][l]),
],
),
),
),
]
),
if (i == 1) VsGraphs(stats: [for (var s in summaries) if (s.league.nerdStats != null) AggregateStats.precalculated(s.league.apm!, s.league.pps!, s.league.vs!, s.league.nerdStats!, s.league.playstyle!)], nicknames: [for (int i = 0; i < summaries.length; i++) if (summaries[i].league.nerdStats != null) nicknames[i]]),
if (i == 2) VsGraphs(stats: [for (var s in summaries) if ((s.zenith != null || s.zenithCareerBest != null) && (s.zenith?.aggregateStats??s.zenithCareerBest!.aggregateStats).apm > 0.00) s.zenith?.aggregateStats??s.zenithCareerBest!.aggregateStats], nicknames: [for (int i = 0; i < summaries.length; i++) if ((summaries[i].zenith != null || summaries[i].zenithCareerBest != null) && (summaries[i].zenith?.aggregateStats??summaries[i].zenithCareerBest!.aggregateStats).apm > 0.00) nicknames[i]]),
if (i == 3) VsGraphs(stats: [for (var s in summaries) if ((s.zenithEx != null || s.zenithExCareerBest != null) && (s.zenithEx?.aggregateStats??s.zenithExCareerBest!.aggregateStats).apm > 0.00) s.zenithEx?.aggregateStats??s.zenithExCareerBest!.aggregateStats], nicknames: [for (int i = 0; i < summaries.length; i++) if ((summaries[i].zenithEx != null || summaries[i].zenithExCareerBest != null) && (summaries[i].zenithEx?.aggregateStats??summaries[i].zenithExCareerBest!.aggregateStats).apm > 0.00) nicknames[i]]),
],
),
), ),
), ]),
]), ),
], ),
), ],
), ),
), ),
), ),

View File

@ -199,7 +199,7 @@ class ZenithCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(t.gamemodes["zenith"]!, style: Theme.of(context).textTheme.titleLarge), Text(t.gamemodes["zenith"]!, style: width > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall),
//Text("Leaderboard reset in ${countdown(postSeasonLeft)}", textAlign: TextAlign.center), //Text("Leaderboard reset in ${countdown(postSeasonLeft)}", textAlign: TextAlign.center),
], ],
), ),
@ -238,10 +238,16 @@ class ZenithCard extends StatelessWidget {
splitsCard(), splitsCard(),
], ],
), ),
if (record != null) Card(child: Center(child: Text(t.nerdStats, style: Theme.of(context).textTheme.titleLarge, textAlign: TextAlign.center))), if (record != null) Card(child: Center(child: Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Text(t.nerdStats, style: width > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center),
))),
if (record != null) NerdStatsThingy(nerdStats: record!.aggregateStats.nerdStats, width: width), if (record != null) NerdStatsThingy(nerdStats: record!.aggregateStats.nerdStats, width: width),
if (record != null) Graphs(record!.aggregateStats.apm, record!.aggregateStats.pps, record!.aggregateStats.vs, record!.aggregateStats.nerdStats, record!.aggregateStats.playstyle), if (record != null) Graphs(record!.aggregateStats.apm, record!.aggregateStats.pps, record!.aggregateStats.vs, record!.aggregateStats.nerdStats, record!.aggregateStats.playstyle),
if (achievements.isNotEmpty) Card(child: Center(child: Text(t.relatedAchievements, style: Theme.of(context).textTheme.titleLarge, textAlign: TextAlign.center))), if (achievements.isNotEmpty) Card(child: Center(child: Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Text(t.relatedAchievements, style: width > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center),
))),
if (achievements.isNotEmpty) Wrap( if (achievements.isNotEmpty) Wrap(
direction: Axis.horizontal, direction: Axis.horizontal,
children: [ children: [
@ -265,6 +271,7 @@ class RecordCard extends StatelessWidget {
const RecordCard(this.record, this.achievements, this.betterThanRankAverage, this.closestAverage, this.betterThanClosestAverage, this.rank, {this.width = double.infinity}); const RecordCard(this.record, this.achievements, this.betterThanRankAverage, this.closestAverage, this.betterThanClosestAverage, this.rank, {this.width = double.infinity});
Widget result(){ Widget result(){
TextStyle tableTextStyle = TextStyle(fontSize: width > 768.0 ? 21 : 18);
return Card( return Card(
child: Column( child: Column(
children: [ children: [
@ -303,9 +310,9 @@ class RecordCard extends StatelessWidget {
"blitz" => readableIntDifference(record!.stats.score, blitzAverages[rank]!), "blitz" => readableIntDifference(record!.stats.score, blitzAverages[rank]!),
_ => record!.stats.score.toString() _ => record!.stats.score.toString()
}, verdict: betterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle( }, verdict: betterThanRankAverage??false ? t.verdictBetter : t.verdictWorse, rank: rank!.toUpperCase())}\n", style: TextStyle(
color: betterThanClosestAverage??false ? Colors.greenAccent : Colors.redAccent color: betterThanRankAverage??false ? Colors.greenAccent : Colors.redAccent
)) ))
else if ((rank == null || rank == "z" || rank == "x+") && closestAverage != null) TextSpan(text: "${t.verdictGeneral(n: switch(record!.gamemode){ else if ((rank == null || rank == "z") && closestAverage != null) TextSpan(text: "${t.verdictGeneral(n: switch(record!.gamemode){
"40l" => readableTimeDifference(record!.stats.finalTime, closestAverage!.value), "40l" => readableTimeDifference(record!.stats.finalTime, closestAverage!.value),
"blitz" => readableIntDifference(record!.stats.score, closestAverage!.value), "blitz" => readableIntDifference(record!.stats.score, closestAverage!.value),
_ => record!.stats.score.toString() _ => record!.stats.score.toString()
@ -337,17 +344,17 @@ class RecordCard extends StatelessWidget {
"blitz" => record!.stats.level.toString(), "blitz" => record!.stats.level.toString(),
"5mblast" => NumberFormat.decimalPattern().format(record!.stats.spp), "5mblast" => NumberFormat.decimalPattern().format(record!.stats.spp),
_ => "What if " _ => "What if "
}, textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), }, textAlign: TextAlign.right, style: tableTextStyle),
Text(switch(record!.gamemode){ Text(switch(record!.gamemode){
"40l" => " ${t.stats.pieces.full}", "40l" => " ${t.stats.pieces.full}",
"blitz" => " ${t.stats.level.full}", "blitz" => " ${t.stats.level.full}",
"5mblast" => " ${t.stats.spp.short}", "5mblast" => " ${t.stats.spp.short}",
_ => " i wanted to" _ => " i wanted to"
}, textAlign: TextAlign.left, style: const TextStyle(fontSize: 21)), }, textAlign: TextAlign.left, style: tableTextStyle),
]), ]),
TableRow(children: [ TableRow(children: [
Text(f2.format(record!.stats.pps), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(f2.format(record!.stats.pps), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.pps.short}", textAlign: TextAlign.left, style: TextStyle(fontSize: 21)), Text(" ${t.stats.pps.short}", textAlign: TextAlign.left, style: tableTextStyle),
]), ]),
TableRow(children: [ TableRow(children: [
Text(switch(record!.gamemode){ Text(switch(record!.gamemode){
@ -355,13 +362,13 @@ class RecordCard extends StatelessWidget {
"blitz" => f2.format(record!.stats.spp), "blitz" => f2.format(record!.stats.spp),
"5mblast" => record!.stats.piecesPlaced.toString(), "5mblast" => record!.stats.piecesPlaced.toString(),
_ => "but god said" _ => "but god said"
}, textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), }, textAlign: TextAlign.right, style: tableTextStyle),
Text(switch(record!.gamemode){ Text(switch(record!.gamemode){
"40l" => " ${t.stats.kpp.short}", "40l" => " ${t.stats.kpp.short}",
"blitz" => " ${t.stats.spp.short}", "blitz" => " ${t.stats.spp.short}",
"5mblast" => " ${t.stats.pieces.short}", "5mblast" => " ${t.stats.pieces.short}",
_ => " no" _ => " no"
}, textAlign: TextAlign.left, style: const TextStyle(fontSize: 21)), }, textAlign: TextAlign.left, style: tableTextStyle),
]) ])
], ],
), ),
@ -371,12 +378,12 @@ class RecordCard extends StatelessWidget {
defaultColumnWidth:const IntrinsicColumnWidth(), defaultColumnWidth:const IntrinsicColumnWidth(),
children: [ children: [
TableRow(children: [ TableRow(children: [
Text(intf.format(record!.stats.inputs), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(intf.format(record!.stats.inputs), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.kp.short}", textAlign: TextAlign.left, style: TextStyle(fontSize: 21)), Text(" ${t.stats.kp.short}", textAlign: TextAlign.left, style: tableTextStyle),
]), ]),
TableRow(children: [ TableRow(children: [
Text(f2.format(record!.stats.kps), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(f2.format(record!.stats.kps), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.kps.short}", textAlign: TextAlign.left, style: TextStyle(fontSize: 21)), Text(" ${t.stats.kps.short}", textAlign: TextAlign.left, style: tableTextStyle),
]), ]),
TableRow(children: [ TableRow(children: [
Text(switch(record!.gamemode){ Text(switch(record!.gamemode){
@ -384,13 +391,13 @@ class RecordCard extends StatelessWidget {
"blitz" => record!.stats.piecesPlaced.toString(), "blitz" => record!.stats.piecesPlaced.toString(),
"5mblast" => record!.stats.piecesPlaced.toString(), "5mblast" => record!.stats.piecesPlaced.toString(),
_ => "but god said" _ => "but god said"
}, textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), }, textAlign: TextAlign.right, style: tableTextStyle),
Text(switch(record!.gamemode){ Text(switch(record!.gamemode){
"40l" => " ", "40l" => " ",
"blitz" => " ${t.stats.pieces.short}", "blitz" => " ${t.stats.pieces.short}",
"5mblast" => " ${t.stats.pieces.short}", "5mblast" => " ${t.stats.pieces.short}",
_ => " no" _ => " no"
}, textAlign: TextAlign.left, style: const TextStyle(fontSize: 21)), }, textAlign: TextAlign.left, style: tableTextStyle),
]) ])
], ],
), ),
@ -767,7 +774,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
children: [ children: [
Text(t.gamemodes['40l']!, style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center), Text(t.gamemodes['40l']!, style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center),
const Divider(), const Divider(),
RecordSummary(record: summaries.sprint, betterThanClosestAverage: sprintBetterThanClosestAverage, betterThanRankAverage: sprintBetterThanRankAverage, closestAverage: closestAverageSprint, rank: summaries.league.percentileRank), RecordSummary(record: summaries.sprint, betterThanClosestAverage: sprintBetterThanClosestAverage, betterThanRankAverage: sprintBetterThanRankAverage, closestAverage: closestAverageSprint, rank: summaries.league.rank),
const Divider(), const Divider(),
Text("${summaries.sprint != null ? intf.format(summaries.sprint!.stats.piecesPlaced) : "---"} P • ${summaries.sprint != null ? f2.format(summaries.sprint!.stats.pps) : "-.--"} PPS • ${summaries.sprint != null ? f2.format(summaries.sprint!.stats.kpp) : "-.--"} KPP", style: const TextStyle(color: Colors.grey), textAlign: TextAlign.center) Text("${summaries.sprint != null ? intf.format(summaries.sprint!.stats.piecesPlaced) : "---"} P • ${summaries.sprint != null ? f2.format(summaries.sprint!.stats.pps) : "-.--"} PPS • ${summaries.sprint != null ? f2.format(summaries.sprint!.stats.kpp) : "-.--"} KPP", style: const TextStyle(color: Colors.grey), textAlign: TextAlign.center)
], ],
@ -782,7 +789,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
children: [ children: [
Text(t.gamemodes['blitz']!, style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center), Text(t.gamemodes['blitz']!, style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center),
const Divider(), const Divider(),
RecordSummary(record: summaries.blitz, betterThanClosestAverage: blitzBetterThanClosestAverage, betterThanRankAverage: blitzBetterThanRankAverage, closestAverage: closestAverageBlitz, rank: summaries.league.percentileRank), RecordSummary(record: summaries.blitz, betterThanClosestAverage: blitzBetterThanClosestAverage, betterThanRankAverage: blitzBetterThanRankAverage, closestAverage: closestAverageBlitz, rank: summaries.league.rank),
const Divider(), const Divider(),
Text("Level ${summaries.blitz != null ? intf.format(summaries.blitz!.stats.level): "--"}${summaries.blitz != null ? f2.format(summaries.blitz!.stats.spp) : "-.--"} SPP • ${summaries.blitz != null ? f2.format(summaries.blitz!.stats.pps) : "-.--"} PPS", style: const TextStyle(color: Colors.grey)) Text("Level ${summaries.blitz != null ? intf.format(summaries.blitz!.stats.level): "--"}${summaries.blitz != null ? f2.format(summaries.blitz!.stats.spp) : "-.--"} SPP • ${summaries.blitz != null ? f2.format(summaries.blitz!.stats.pps) : "-.--"} PPS", style: const TextStyle(color: Colors.grey))
], ],
@ -920,8 +927,11 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(t.gamemodes["league"]!, style: Theme.of(context).textTheme.titleLarge), Text(t.gamemodes["league"]!, style: widget.constraints.maxWidth > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall),
if (toCompare != null) Text(t.comparingWith(newDate: timestamp(toSee.timestamp), oldDate: timestamp(toCompare.timestamp)), textAlign: TextAlign.center) if (toCompare != null) Padding(
padding: const EdgeInsets.only(top: 4.0),
child: Text(t.comparingWith(newDate: timestamp(toSee.timestamp), oldDate: timestamp(toCompare.timestamp)), textAlign: TextAlign.center, style: widget.constraints.maxWidth > 768.0 ? null : TextStyle(fontSize: 12.0)),
)
], ],
), ),
), ),
@ -938,10 +948,13 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
// ) // )
// ), // ),
// ), // ),
if (data.nerdStats != null) Card(child: Center(child: Text(t.nerdStats, style: Theme.of(context).textTheme.titleLarge, textAlign: TextAlign.center))), if (data.nerdStats != null) Card(child: Center(child: Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Text(t.nerdStats, style: widget.constraints.maxWidth > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center),
))),
if (data.nerdStats != null) NerdStatsThingy(nerdStats: toSee.nerdStats!, oldNerdStats: toCompare?.nerdStats, averages: averages, lbPos: lbPos, width: width), if (data.nerdStats != null) NerdStatsThingy(nerdStats: toSee.nerdStats!, oldNerdStats: toCompare?.nerdStats, averages: averages, lbPos: lbPos, width: width),
if (data.nerdStats != null) Graphs(toSee.apm!, toSee.pps!, toSee.vs!, toSee.nerdStats!, toSee.playstyle!), if (data.nerdStats != null) Graphs(toSee.apm!, toSee.pps!, toSee.vs!, toSee.nerdStats!, toSee.playstyle!),
Card(child: Center(child: Text(t.relatedAchievements, style: Theme.of(context).textTheme.titleLarge, textAlign: TextAlign.center))), Card(child: Center(child: Text(t.relatedAchievements, style: widget.constraints.maxWidth > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center))),
Wrap( Wrap(
direction: Axis.horizontal, direction: Axis.horizontal,
children: [ children: [
@ -963,7 +976,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(t.previousSeasons, style: Theme.of(context).textTheme.titleLarge, textAlign: TextAlign.center), Text(t.previousSeasons, style: widget.constraints.maxWidth > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center),
//Text("${t.seasonStarts} ${countdown(postSeasonLeft)}", textAlign: TextAlign.center) //Text("${t.seasonStarts} ${countdown(postSeasonLeft)}", textAlign: TextAlign.center)
], ],
), ),
@ -1122,7 +1135,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(t.recent, style: Theme.of(context).textTheme.titleLarge), Text(t.recent, style: widget.constraints.maxWidth > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall),
], ],
), ),
), ),
@ -1190,8 +1203,8 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
if (snapshot.hasError){ return FutureError(snapshot); } if (snapshot.hasError){ return FutureError(snapshot); }
if (snapshot.hasData){ if (snapshot.hasData){
if (!snapshot.data!.success) return ErrorThingy(data: snapshot.data!); if (!snapshot.data!.success) return ErrorThingy(data: snapshot.data!);
blitzBetterThanRankAverage = (snapshot.data!.summaries!.league.rank != "z" && snapshot.data!.summaries!.blitz != null && snapshot.data!.summaries!.league.rank != "x+") ? snapshot.data!.summaries!.blitz!.stats.score > blitzAverages[snapshot.data!.summaries!.league.rank]! : null; blitzBetterThanRankAverage = (snapshot.data!.summaries!.league.rank != "z" && snapshot.data!.summaries!.blitz != null) ? snapshot.data!.summaries!.blitz!.stats.score > blitzAverages[snapshot.data!.summaries!.league.rank]! : null;
sprintBetterThanRankAverage = (snapshot.data!.summaries!.league.rank != "z" && snapshot.data!.summaries!.sprint != null && snapshot.data!.summaries!.league.rank != "x+") ? snapshot.data!.summaries!.sprint!.stats.finalTime < sprintAverages[snapshot.data!.summaries!.league.rank]! : null; sprintBetterThanRankAverage = (snapshot.data!.summaries!.league.rank != "z" && snapshot.data!.summaries!.sprint != null) ? snapshot.data!.summaries!.sprint!.stats.finalTime < sprintAverages[snapshot.data!.summaries!.league.rank]! : null;
if (snapshot.data!.summaries!.sprint != null) { if (snapshot.data!.summaries!.sprint != null) {
closestAverageSprint = sprintAverages.entries.singleWhere((element) => element.value == sprintAverages.values.reduce((a, b) => (a-snapshot.data!.summaries!.sprint!.stats.finalTime).abs() < (b -snapshot.data!.summaries!.sprint!.stats.finalTime).abs() ? a : b)); closestAverageSprint = sprintAverages.entries.singleWhere((element) => element.value == sprintAverages.values.reduce((a, b) => (a-snapshot.data!.summaries!.sprint!.stats.finalTime).abs() < (b -snapshot.data!.summaries!.sprint!.stats.finalTime).abs() ? a : b));
sprintBetterThanClosestAverage = snapshot.data!.summaries!.sprint!.stats.finalTime < closestAverageSprint!.value; sprintBetterThanClosestAverage = snapshot.data!.summaries!.sprint!.stats.finalTime < closestAverageSprint!.value;
@ -1321,7 +1334,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
), ),
), ),
), ),
if (modeButtons[rightCard]!.length > 1) SegmentedButton<CardMod>( if (modeButtons[rightCard]!.length > 1 && !widget.noSidebar) SegmentedButton<CardMod>(
showSelectedIcon: false, showSelectedIcon: false,
selected: <CardMod>{cardMod}, selected: <CardMod>{cardMod},
segments: modeButtons[rightCard]!, segments: modeButtons[rightCard]!,
@ -1332,7 +1345,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
}); });
}, },
), ),
SegmentedButton<Cards>( if (!widget.noSidebar) SegmentedButton<Cards>(
showSelectedIcon: false, showSelectedIcon: false,
segments: <ButtonSegment<Cards>>[ segments: <ButtonSegment<Cards>>[
ButtonSegment<Cards>( ButtonSegment<Cards>(

View File

@ -173,6 +173,8 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
Widget pickers(int destination){ Widget pickers(int destination){
return switch (destination) { return switch (destination) {
0 => Column( 0 => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
SingleChildScrollView( SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@ -270,45 +272,41 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LayoutBuilder( return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints){ builder: (BuildContext context, BoxConstraints constraints){
bool screenIsBig = constraints.maxWidth > 768.00; bool screenIsBig = constraints.maxWidth > 1030.00;
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
drawer: SearchDrawer(changePlayer: changePlayer, controller: _searchController), drawer: SearchDrawer(changePlayer: changePlayer, controller: _searchController),
endDrawer: DestinationsDrawer(changeDestination: (value) {setState(() {destination = value;});}), endDrawer: DestinationsDrawer(changeDestination: (value) {setState(() {destination = value;});}),
bottomNavigationBar: screenIsBig ? null : BottomAppBar( persistentFooterButtons: screenIsBig ? null : [Row(
shape: const AutomaticNotchedShape(RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(0.0))), RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16.0)))), mainAxisAlignment: MainAxisAlignment.spaceBetween,
notchMargin: 2.0, children: [
height: 88, IconButton.filled(
child: IconTheme( icon: const Icon(Icons.search),
data: IconThemeData(color: Theme.of(context).colorScheme.primary), style: IconButton.styleFrom(
child: Row( visualDensity: VisualDensity(horizontal: 1.0, vertical: 1.0),
children: <Widget>[ shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16.0))),
IconButton( backgroundColor: Theme.of(context).colorScheme.primary,
tooltip: t.navMenuTooltip, fixedSize: Size(52, 52)
icon: const Icon(Icons.menu), ),
onPressed: () { onPressed: () {
_scaffoldKey.currentState!.openEndDrawer(); _scaffoldKey.currentState!.openDrawer();
}, _searchController.clear();
), },
Expanded(
child: pickers(destination),
),
SizedBox(
width: 40.0,
),
],
), ),
), IconButton(
), onPressed: (){
floatingActionButtonLocation: screenIsBig ? null : FloatingActionButtonLocation.endDocked, _scaffoldKey.currentState!.openEndDrawer();
floatingActionButton: screenIsBig ? null : FloatingActionButton( },
elevation: 0, style: IconButton.styleFrom(
onPressed: () { visualDensity: VisualDensity(horizontal: 1.0, vertical: 1.0),
_scaffoldKey.currentState!.openDrawer(); shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16.0))),
_searchController.clear(); ),
}, icon: Icon(Icons.menu)
child: const Icon(Icons.search), ),
), Expanded(child: pickers(destination)),
],
)],
persistentFooterAlignment: AlignmentDirectional.bottomCenter,
body: SafeArea( body: SafeArea(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

View File

@ -24,30 +24,30 @@ class TetraLeagueThingy extends StatelessWidget{
List<TableRow> secondColumn(){ List<TableRow> secondColumn(){
return [ return [
TableRow(children: [ TableRow(children: [
Text(intf.format(league.gamesPlayed), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(intf.format(league.gamesPlayed), textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18)),
Tooltip( Tooltip(
message: "${t.stats.gp.full}", message: "${t.stats.gp.full}",
child: Text(" ${t.stats.gp.short}", style: TextStyle(fontSize: 21)) child: Text(" ${t.stats.gp.short}", style: TextStyle(fontSize: width > 768.0 ? 21 : 18))
), ),
if (toCompare != null) Text(" (${comparef2.format(league.gamesPlayed-toCompare!.gamesPlayed)})", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)), if (toCompare != null) Text(" (${comparef2.format(league.gamesPlayed-toCompare!.gamesPlayed)})", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: Colors.grey)),
if (lbPos != null) Text(lbPos?.gamesPlayed != null ? (lbPos!.gamesPlayed!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.gamesPlayed!.percentage*100)}%)" : " (№ ${lbPos!.gamesPlayed!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.gamesPlayed != null ? getColorOfRank(lbPos!.gamesPlayed!.position) : null)) if (lbPos != null) Text(lbPos?.gamesPlayed != null ? (lbPos!.gamesPlayed!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.gamesPlayed!.percentage*100)}%)" : " (№ ${lbPos!.gamesPlayed!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.gamesPlayed != null ? getColorOfRank(lbPos!.gamesPlayed!.position) : null))
]), ]),
TableRow(children: [ TableRow(children: [
Text(intf.format(league.gamesWon), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(intf.format(league.gamesWon), textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18)),
Tooltip( Tooltip(
message: "${t.stats.gw.full}", message: "${t.stats.gw.full}",
child: Text(" ${t.stats.gw.short}", style: TextStyle(fontSize: 21)) child: Text(" ${t.stats.gw.short}", style: TextStyle(fontSize: width > 768.0 ? 21 : 18))
), ),
if (toCompare != null) Text(" (${comparef2.format(league.gamesWon-toCompare!.gamesWon)})", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)), if (toCompare != null) Text(" (${comparef2.format(league.gamesWon-toCompare!.gamesWon)})", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: Colors.grey)),
if (lbPos != null) Text(lbPos?.gamesWon != null ? (lbPos!.gamesWon!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.gamesWon!.percentage*100)}%)" : " (№ ${lbPos!.gamesWon!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.gamesWon != null ? getColorOfRank(lbPos!.gamesWon!.position) : null)) if (lbPos != null) Text(lbPos?.gamesWon != null ? (lbPos!.gamesWon!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.gamesWon!.percentage*100)}%)" : " (№ ${lbPos!.gamesWon!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.gamesWon != null ? getColorOfRank(lbPos!.gamesWon!.position) : null))
]), ]),
TableRow(children: [ TableRow(children: [
Tooltip(child: Text("${league.gxe.isNegative ? "---" : f3.format(league.gxe)}", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: league.gxe.isNegative ? Colors.grey : Colors.white)), message: "${f2.format(league.s1tr)} S1 TR"), Tooltip(child: Text("${league.gxe.isNegative ? "---" : f3.format(league.gxe)}", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: league.gxe.isNegative ? Colors.grey : Colors.white)), message: "${f2.format(league.s1tr)} S1 TR"),
Tooltip( Tooltip(
message: "${t.stats.glixare.full}", message: "${t.stats.glixare.full}",
child: Tooltip(child: Text(" ${t.stats.glixare.short}", style: TextStyle(fontSize: 21, color: league.gxe.isNegative ? Colors.grey : Colors.white)), message: "Glixare") child: Tooltip(child: Text(" ${t.stats.glixare.short}", style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: league.gxe.isNegative ? Colors.grey : Colors.white)), message: "Glixare")
), ),
if (toCompare != null) Text(" (${comparef.format(league.gxe-toCompare!.gxe)})", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: getDifferenceColor(league.gxe-toCompare!.gxe))), if (toCompare != null) Text(" (${comparef.format(league.gxe-toCompare!.gxe)})", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: getDifferenceColor(league.gxe-toCompare!.gxe))),
if (lbPos != null) Text(lbPos?.glixare != null ? (lbPos!.glixare!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.glixare!.percentage*100)}%)" : " (№ ${lbPos!.glixare!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.glixare != null ? getColorOfRank(lbPos!.glixare!.position) : null)) if (lbPos != null) Text(lbPos?.glixare != null ? (lbPos!.glixare!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.glixare!.percentage*100)}%)" : " (№ ${lbPos!.glixare!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.glixare != null ? getColorOfRank(lbPos!.glixare!.position) : null))
]), ]),
]; ];
@ -80,36 +80,36 @@ class TetraLeagueThingy extends StatelessWidget{
defaultColumnWidth:const IntrinsicColumnWidth(), defaultColumnWidth:const IntrinsicColumnWidth(),
children: [ children: [
TableRow(children: [ TableRow(children: [
Text(league.apm != null ? f2.format(league.apm) : "-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: league.apm != null ? getStatColor(league.apm!, averages?.apm, true) : Colors.grey)), Text(league.apm != null ? f2.format(league.apm) : "-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: league.apm != null ? getStatColor(league.apm!, averages?.apm, true) : Colors.grey)),
Tooltip( Tooltip(
message: "${t.stats.apm.full}${(averages != null) ? "\n${t.rankView.avgForRank(rank: league.percentileRank.toUpperCase())}: ${f2.format(averages!.apm)} ${t.stats.apm.short}" : ""}", message: "${t.stats.apm.full}${(averages != null) ? "\n${t.rankView.avgForRank(rank: league.percentileRank.toUpperCase())}: ${f2.format(averages!.apm)} ${t.stats.apm.short}" : ""}",
child: Text(" ${t.stats.apm.short}", style: TextStyle(fontSize: 21, color: league.apm != null ? getStatColor(league.apm!, averages?.apm, true) : Colors.grey)) child: Text(" ${t.stats.apm.short}", style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: league.apm != null ? getStatColor(league.apm!, averages?.apm, true) : Colors.grey))
), ),
if (toCompare != null) Text(" (${comparef2.format(league.apm!-toCompare!.apm!)})", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: getDifferenceColor(league.apm!-toCompare!.apm!))), if (toCompare != null) Text(" (${comparef2.format(league.apm!-toCompare!.apm!)})", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: getDifferenceColor(league.apm!-toCompare!.apm!))),
if (lbPos != null) Text(lbPos?.apm != null ? (lbPos!.apm!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.apm!.percentage*100)}%)" : " (№ ${lbPos!.apm!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.apm != null ? getColorOfRank(lbPos!.apm!.position) : null)) if (lbPos != null) Text(lbPos?.apm != null ? (lbPos!.apm!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.apm!.percentage*100)}%)" : " (№ ${lbPos!.apm!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.apm != null ? getColorOfRank(lbPos!.apm!.position) : null))
]), ]),
TableRow(children: [ TableRow(children: [
Text(league.pps != null ? f2.format(league.pps) : "-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: league.pps != null ? getStatColor(league.pps!, averages?.pps, true) : Colors.grey)), Text(league.pps != null ? f2.format(league.pps) : "-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: league.pps != null ? getStatColor(league.pps!, averages?.pps, true) : Colors.grey)),
Tooltip( Tooltip(
message: "${t.stats.pps.full}${(averages != null) ? "\n${t.rankView.avgForRank(rank: league.percentileRank.toUpperCase())}: ${f2.format(averages!.pps)} ${t.stats.pps.short}" : ""}", message: "${t.stats.pps.full}${(averages != null) ? "\n${t.rankView.avgForRank(rank: league.percentileRank.toUpperCase())}: ${f2.format(averages!.pps)} ${t.stats.pps.short}" : ""}",
child: Text(" ${t.stats.pps.short}", style: TextStyle(fontSize: 21, color: league.pps != null ? getStatColor(league.pps!, averages?.pps, true) : Colors.grey)) child: Text(" ${t.stats.pps.short}", style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: league.pps != null ? getStatColor(league.pps!, averages?.pps, true) : Colors.grey))
), ),
if (toCompare != null) Text(" (${comparef2.format(league.pps!-toCompare!.pps!)})", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: getDifferenceColor(league.pps!-toCompare!.pps!))), if (toCompare != null) Text(" (${comparef2.format(league.pps!-toCompare!.pps!)})", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: getDifferenceColor(league.pps!-toCompare!.pps!))),
if (lbPos != null) Text(lbPos?.pps != null ? (lbPos!.pps!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.pps!.percentage*100)}%)" : " (№ ${lbPos!.pps!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.pps != null ? getColorOfRank(lbPos!.pps!.position) : null)) if (lbPos != null) Text(lbPos?.pps != null ? (lbPos!.pps!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.pps!.percentage*100)}%)" : " (№ ${lbPos!.pps!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.pps != null ? getColorOfRank(lbPos!.pps!.position) : null))
]), ]),
TableRow(children: [ TableRow(children: [
Text(league.vs != null ? f2.format(league.vs) : "-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: league.vs != null ? getStatColor(league.vs!, averages?.vs, true) : Colors.grey)), Text(league.vs != null ? f2.format(league.vs) : "-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: league.vs != null ? getStatColor(league.vs!, averages?.vs, true) : Colors.grey)),
Tooltip( Tooltip(
message: "${t.stats.vs.full}${(averages != null) ? "\n${t.rankView.avgForRank(rank: league.percentileRank.toUpperCase())}: ${f2.format(averages!.vs)} ${t.stats.vs.short}" : ""}", message: "${t.stats.vs.full}${(averages != null) ? "\n${t.rankView.avgForRank(rank: league.percentileRank.toUpperCase())}: ${f2.format(averages!.vs)} ${t.stats.vs.short}" : ""}",
child: Text(" ${t.stats.vs.short}", style: TextStyle(fontSize: 21, color: league.vs != null ? getStatColor(league.vs!, averages?.vs, true) : Colors.grey)) child: Text(" ${t.stats.vs.short}", style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: league.vs != null ? getStatColor(league.vs!, averages?.vs, true) : Colors.grey))
), ),
if (toCompare != null) Text(" (${comparef2.format(league.vs!-toCompare!.vs!)})", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: getDifferenceColor(league.vs!-toCompare!.vs!))), if (toCompare != null) Text(" (${comparef2.format(league.vs!-toCompare!.vs!)})", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: getDifferenceColor(league.vs!-toCompare!.vs!))),
if (lbPos != null) Text(lbPos?.vs != null ? (lbPos!.vs!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.vs!.percentage*100)}%)" : " (№ ${lbPos!.vs!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.vs != null ? getColorOfRank(lbPos!.vs!.position) : null)) if (lbPos != null) Text(lbPos?.vs != null ? (lbPos!.vs!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.vs!.percentage*100)}%)" : " (№ ${lbPos!.vs!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.vs != null ? getColorOfRank(lbPos!.vs!.position) : null))
]), ]),
if (width <= 600) TableRow(children: [ if (width <= 600) TableRow(children: [
Text(!league.winrate.isNegative ? percentage.format(league.winrate) : "---", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: !league.winrate.isNegative ? Colors.white : Colors.grey)), Text(!league.winrate.isNegative ? percentage.format(league.winrate) : "---", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: !league.winrate.isNegative ? Colors.white : Colors.grey)),
Text(" ${t.stats.winrate.short}", style: TextStyle(fontSize: 21, color: !league.winrate.isNegative ? Colors.white : Colors.grey)), Text(" ${t.stats.winrate.short}", style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: !league.winrate.isNegative ? Colors.white : Colors.grey)),
if (toCompare != null) Text(" (${comparef2.format((league.winrate-toCompare!.winrate)*100)})", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: getDifferenceColor(league.winrate-toCompare!.winrate))), if (toCompare != null) Text(" (${comparef2.format((league.winrate-toCompare!.winrate)*100)})", textAlign: TextAlign.right, style: TextStyle(fontSize: width > 768.0 ? 21 : 18, color: getDifferenceColor(league.winrate-toCompare!.winrate))),
if (lbPos != null) Text(lbPos?.winrate != null ? (lbPos!.winrate!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.winrate!.percentage*100)}%)" : " (№ ${lbPos!.winrate!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.winrate != null ? getColorOfRank(lbPos!.winrate!.position) : null)) if (lbPos != null) Text(lbPos?.winrate != null ? (lbPos!.winrate!.position >= 1000 ? " (${t.top} ${f2.format(lbPos!.winrate!.percentage*100)}%)" : " (№ ${lbPos!.winrate!.position})") : "(№ ---)", style: TextStyle(color: lbPos?.winrate != null ? getColorOfRank(lbPos!.winrate!.position) : null))
]), ]),
if (width <= 400) ...secondColumn() if (width <= 400) ...secondColumn()

View File

@ -14,50 +14,52 @@ class ZenithThingy extends StatelessWidget{
const ZenithThingy({super.key, required this.zenith, this.old = false, this.width = double.infinity}); const ZenithThingy({super.key, required this.zenith, this.old = false, this.width = double.infinity});
List<TableRow> secondColumn(){ List<TableRow> secondColumn(TextStyle style){
return [ return [
TableRow(children: [ TableRow(children: [
Text(intf.format(zenith!.stats.kills), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(intf.format(zenith!.stats.kills), textAlign: TextAlign.right, style: style),
Text(" ${t.stats.kos.short}", style: TextStyle(fontSize: 21)) Text(" ${t.stats.kos.short}", style: style)
]), ]),
TableRow(children: [ TableRow(children: [
Text(zenith!.stats.topBtB.toString(), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(zenith!.stats.topBtB.toString(), textAlign: TextAlign.right, style: style),
Text(" ${t.stats.b2b.short}", style: TextStyle(fontSize: 21)) Text(" ${t.stats.b2b.short}", style: style)
]), ]),
TableRow(children: [ TableRow(children: [
Text(zenith!.stats.garbage.maxspike_nomult.toString(), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(zenith!.stats.garbage.maxspike_nomult.toString(), textAlign: TextAlign.right, style: style),
Text(" ${t.stats.spike}", style: TextStyle(fontSize: 21)) Text(" ${t.stats.spike}", style: style)
]), ]),
if (width <= 600) TableRow(children: [ if (width <= 600) TableRow(children: [
Text(f2.format(zenith!.stats.zenith!.peakrank), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(f2.format(zenith!.stats.zenith!.peakrank), textAlign: TextAlign.right, style: style),
Text(" ${t.stats.peakClimbSpeed.short}", style: TextStyle(fontSize: 21)), Text(" ${t.stats.peakClimbSpeed.short}", style: style),
]) ])
]; ];
} }
List<TableRow> noRecordSecondColumn(){ List<TableRow> noRecordSecondColumn(TextStyle style){
return [ return [
TableRow(children: [ TableRow(children: [
Text("---", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)), Text("---", textAlign: TextAlign.right, style: style),
Text(" ${t.stats.kos.short}", style: TextStyle(fontSize: 21, color: Colors.grey)) Text(" ${t.stats.kos.short}", style: style)
]), ]),
TableRow(children: [ TableRow(children: [
Text("---", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)), Text("---", textAlign: TextAlign.right, style: style),
Text(" ${t.stats.b2b.short}", style: TextStyle(fontSize: 21, color: Colors.grey)) Text(" ${t.stats.b2b.short}", style: style)
]), ]),
TableRow(children: [ TableRow(children: [
Text("---", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)), Text("---", textAlign: TextAlign.right, style: style),
Text(" ${t.stats.spike}", style: TextStyle(fontSize: 21, color: Colors.grey)) Text(" ${t.stats.spike}", style: style)
]), ]),
if (width <= 600) TableRow(children: [ if (width <= 600) TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: const TextStyle(fontSize: 21, color: Colors.grey)), Text("-.--", textAlign: TextAlign.right, style: style),
Text(" ${t.stats.peakClimbSpeed.short}", style: TextStyle(fontSize: 21, color: Colors.grey)), Text(" ${t.stats.peakClimbSpeed.short}", style: style),
]) ])
]; ];
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
TextStyle tableTextStyle = TextStyle(fontSize: width > 768.0 ? 21 : 18);
TextStyle tableTextStyleMuted = TextStyle(fontSize: width > 768.0 ? 21 : 18, color: Colors.grey);
return Card( return Card(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), padding: const EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
@ -108,22 +110,22 @@ class ZenithThingy extends StatelessWidget{
defaultColumnWidth:const IntrinsicColumnWidth(), defaultColumnWidth:const IntrinsicColumnWidth(),
children: [ children: [
TableRow(children: [ TableRow(children: [
Text(f2.format(zenith!.aggregateStats.apm), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(f2.format(zenith!.aggregateStats.apm), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.apm.short}", style: TextStyle(fontSize: 21)), Text(" ${t.stats.apm.short}", style: tableTextStyle),
]), ]),
TableRow(children: [ TableRow(children: [
Text(f2.format(zenith!.aggregateStats.pps), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(f2.format(zenith!.aggregateStats.pps), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.pps.short}", style: TextStyle(fontSize: 21)), Text(" ${t.stats.pps.short}", style: tableTextStyle),
]), ]),
TableRow(children: [ TableRow(children: [
Text(f2.format(zenith!.aggregateStats.vs), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(f2.format(zenith!.aggregateStats.vs), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.vs.short}", style: TextStyle(fontSize: 21)), Text(" ${t.stats.vs.short}", style: tableTextStyle),
]), ]),
if (width <= 600) TableRow(children: [ if (width <= 600) TableRow(children: [
Text(f2.format(zenith!.stats.cps), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)), Text(f2.format(zenith!.stats.cps), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.climbSpeed.short}", style: TextStyle(fontSize: 21)), Text(" ${t.stats.climbSpeed.short}", style: tableTextStyle),
]), ]),
if (width <= 400) ...secondColumn().reversed if (width <= 400) ...secondColumn(tableTextStyle).reversed
], ],
), ),
), ),
@ -133,7 +135,7 @@ class ZenithThingy extends StatelessWidget{
child: Center( child: Center(
child: Table( child: Table(
defaultColumnWidth:const IntrinsicColumnWidth(), defaultColumnWidth:const IntrinsicColumnWidth(),
children: secondColumn(), children: secondColumn(tableTextStyle),
), ),
), ),
) )
@ -146,20 +148,20 @@ class ZenithThingy extends StatelessWidget{
defaultColumnWidth: IntrinsicColumnWidth(), defaultColumnWidth: IntrinsicColumnWidth(),
children: [ children: [
TableRow(children: [ TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)), Text("-.--", textAlign: TextAlign.right, style: tableTextStyleMuted),
Text(" ${t.stats.apm.short}", style: TextStyle(fontSize: 21, color: Colors.grey)), Text(" ${t.stats.apm.short}", style: tableTextStyleMuted),
]), ]),
TableRow(children: [ TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)), Text("-.--", textAlign: TextAlign.right, style: tableTextStyleMuted),
Text(" ${t.stats.pps.short}", style: TextStyle(fontSize: 21, color: Colors.grey)), Text(" ${t.stats.pps.short}", style: tableTextStyleMuted),
]), ]),
TableRow(children: [ TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)), Text("-.--", textAlign: TextAlign.right, style: tableTextStyleMuted),
Text(" ${t.stats.vs.short}", style: TextStyle(fontSize: 21, color: Colors.grey)), Text(" ${t.stats.vs.short}", style: tableTextStyleMuted),
]), ]),
if (width <= 600) TableRow(children: [ if (width <= 600) TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: const TextStyle(fontSize: 21, color: Colors.grey)), Text("-.--", textAlign: TextAlign.right, style: tableTextStyleMuted),
Text(" ${t.stats.climbSpeed.short}", style: TextStyle(fontSize: 21, color: Colors.grey)), Text(" ${t.stats.climbSpeed.short}", style: tableTextStyleMuted),
]) ])
], ],
), ),
@ -170,7 +172,7 @@ class ZenithThingy extends StatelessWidget{
child: Center( child: Center(
child: Table( child: Table(
defaultColumnWidth: IntrinsicColumnWidth(), defaultColumnWidth: IntrinsicColumnWidth(),
children: noRecordSecondColumn(), children: noRecordSecondColumn(tableTextStyleMuted),
), ),
), ),
) )

View File

@ -2,7 +2,7 @@ name: tetra_stats
description: Track your and other player stats in TETR.IO description: Track your and other player stats in TETR.IO
publish_to: 'none' publish_to: 'none'
version: 2.0.0+41 version: 2.0.1+42
environment: environment:
sdk: '>=3.0.0' sdk: '>=3.0.0'

View File

@ -150,19 +150,20 @@
let tip = document.querySelector("#tip"); let tip = document.querySelector("#tip");
const tips = [ const tips = [
// Promoting Tetra Stats "native" // Promoting Tetra Stats "native"
"Want a better perfomance?<br><a href=\"https://github.com/dan63047/TetraStats/releases\">Try out Tetra Stats \"Native\"</a>", "Did you know, that mobile browsers suck?<br>Fortunately, <a href=\"https://github.com/dan63047/TetraStats/releases\">we have a solution</a>",
"Imagine a world, where Tetra Stats was written in JS", "Imagine a world, where Tetra Stats was written in JS",
"Did you know, that Flutter for web sucks?", "Did you know, that Flutter for web sucks?",
"Welcome to fullscreen canvas", "Welcome to fullscreen canvas",
// An actual tips // An actual tips
"You can interact with most objects that have an accent color", "You can interact with most objects that have an accent color",
"Like Sheetbot graphs? Go to three dots menu → Settings → Customization", "Like Sheetbot graphs? Go to Settings → Customization",
"Click and hold on line chart graph, then start dragging to zoom in", "Click and hold on line chart graph, then start dragging to zoom in",
"Discord userID ≠ Discord username. It should look like a bunch of digits", "Discord userID ≠ Discord username. It should look like a bunch of digits",
// :droidsmile: // :droidsmile:
"Is she real?", "Is she real?",
"Stats doesn't matter that much, you know...",
"Check out <a href=\"https://github.com/dan63047/TetraStats/wiki\">wiki</a> for more information" "Check out <a href=\"https://github.com/dan63047/TetraStats/wiki\">wiki</a> for more information"
]; ];
tip.innerHTML = tips[Math.floor(Math.random() * tips.length)]; tip.innerHTML = tips[Math.floor(Math.random() * tips.length)];