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';
const String dbName = "TetraStats.db";
const String webVersionDomain = "ts.dan63.by";
const String webVersionDomain = "tsbeta.dan63.by";
const String tetrioUsersTable = "tetrioUsers";
const String tetrioUsersToTrackTable = "tetrioUsersToTrack";
const String tetraLeagueMatchesTable = "tetrioAlphaLeagueMathces";

View File

@ -746,11 +746,8 @@ class CompareState extends State<CompareView> {
await addRankAverages(nickname.substring(4).toLowerCase());
return null;
}else{
late TetrioPlayer player;
late Summaries summary;
List<dynamic> requests = await Future.wait([teto.fetchPlayer(nickname), teto.fetchSummaries(players.last.userId)]);
player = requests[0];
summary = requests[1];
TetrioPlayer player = await teto.fetchPlayer(nickname);
Summaries summary = await teto.fetchSummaries(player.userId);
players.add(player);
summaries.add(summary);
addvaluesEntrys(players.last, summaries.last);
@ -848,14 +845,15 @@ class CompareState extends State<CompareView> {
),
body: SafeArea(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Center(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
@ -865,7 +863,7 @@ class CompareState extends State<CompareView> {
width: 300.0,
child: Card(
child: Padding(
padding: const EdgeInsets.fromLTRB(90.0, 18.0, 5.0, 0),
padding: const EdgeInsets.fromLTRB(18.0, 120.0, 5.0, 0),
child: Text(t.comparison, style: TextStyle(fontSize: 28)),
),
),
@ -943,9 +941,10 @@ class CompareState extends State<CompareView> {
),
),
]),
],
),
),
],
),
),
),
);

View File

@ -199,7 +199,7 @@ class ZenithCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
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),
],
),
@ -238,10 +238,16 @@ class ZenithCard extends StatelessWidget {
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) 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(
direction: Axis.horizontal,
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});
Widget result(){
TextStyle tableTextStyle = TextStyle(fontSize: width > 768.0 ? 21 : 18);
return Card(
child: Column(
children: [
@ -303,9 +310,9 @@ class RecordCard extends StatelessWidget {
"blitz" => readableIntDifference(record!.stats.score, blitzAverages[rank]!),
_ => record!.stats.score.toString()
}, 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),
"blitz" => readableIntDifference(record!.stats.score, closestAverage!.value),
_ => record!.stats.score.toString()
@ -337,17 +344,17 @@ class RecordCard extends StatelessWidget {
"blitz" => record!.stats.level.toString(),
"5mblast" => NumberFormat.decimalPattern().format(record!.stats.spp),
_ => "What if "
}, textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
}, textAlign: TextAlign.right, style: tableTextStyle),
Text(switch(record!.gamemode){
"40l" => " ${t.stats.pieces.full}",
"blitz" => " ${t.stats.level.full}",
"5mblast" => " ${t.stats.spp.short}",
_ => " i wanted to"
}, textAlign: TextAlign.left, style: const TextStyle(fontSize: 21)),
}, textAlign: TextAlign.left, style: tableTextStyle),
]),
TableRow(children: [
Text(f2.format(record!.stats.pps), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.pps.short}", textAlign: TextAlign.left, style: TextStyle(fontSize: 21)),
Text(f2.format(record!.stats.pps), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.pps.short}", textAlign: TextAlign.left, style: tableTextStyle),
]),
TableRow(children: [
Text(switch(record!.gamemode){
@ -355,13 +362,13 @@ class RecordCard extends StatelessWidget {
"blitz" => f2.format(record!.stats.spp),
"5mblast" => record!.stats.piecesPlaced.toString(),
_ => "but god said"
}, textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
}, textAlign: TextAlign.right, style: tableTextStyle),
Text(switch(record!.gamemode){
"40l" => " ${t.stats.kpp.short}",
"blitz" => " ${t.stats.spp.short}",
"5mblast" => " ${t.stats.pieces.short}",
_ => " 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(),
children: [
TableRow(children: [
Text(intf.format(record!.stats.inputs), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.kp.short}", textAlign: TextAlign.left, style: TextStyle(fontSize: 21)),
Text(intf.format(record!.stats.inputs), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.kp.short}", textAlign: TextAlign.left, style: tableTextStyle),
]),
TableRow(children: [
Text(f2.format(record!.stats.kps), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.kps.short}", textAlign: TextAlign.left, style: TextStyle(fontSize: 21)),
Text(f2.format(record!.stats.kps), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.kps.short}", textAlign: TextAlign.left, style: tableTextStyle),
]),
TableRow(children: [
Text(switch(record!.gamemode){
@ -384,13 +391,13 @@ class RecordCard extends StatelessWidget {
"blitz" => record!.stats.piecesPlaced.toString(),
"5mblast" => record!.stats.piecesPlaced.toString(),
_ => "but god said"
}, textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
}, textAlign: TextAlign.right, style: tableTextStyle),
Text(switch(record!.gamemode){
"40l" => " ",
"blitz" => " ${t.stats.pieces.short}",
"5mblast" => " ${t.stats.pieces.short}",
_ => " 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: [
Text(t.gamemodes['40l']!, style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center),
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(),
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: [
Text(t.gamemodes['blitz']!, style: Theme.of(context).textTheme.titleSmall, textAlign: TextAlign.center),
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(),
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,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(t.gamemodes["league"]!, style: Theme.of(context).textTheme.titleLarge),
if (toCompare != null) Text(t.comparingWith(newDate: timestamp(toSee.timestamp), oldDate: timestamp(toCompare.timestamp)), textAlign: TextAlign.center)
Text(t.gamemodes["league"]!, style: widget.constraints.maxWidth > 768.0 ? Theme.of(context).textTheme.titleLarge : Theme.of(context).textTheme.titleSmall),
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) 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(
direction: Axis.horizontal,
children: [
@ -963,7 +976,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
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)
],
),
@ -1122,7 +1135,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
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.hasData){
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;
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;
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!.sprint!.stats.finalTime < sprintAverages[snapshot.data!.summaries!.league.rank]! : 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));
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,
selected: <CardMod>{cardMod},
segments: modeButtons[rightCard]!,
@ -1332,7 +1345,7 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
});
},
),
SegmentedButton<Cards>(
if (!widget.noSidebar) SegmentedButton<Cards>(
showSelectedIcon: false,
segments: <ButtonSegment<Cards>>[
ButtonSegment<Cards>(

View File

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

View File

@ -24,30 +24,30 @@ class TetraLeagueThingy extends StatelessWidget{
List<TableRow> secondColumn(){
return [
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(
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))
]),
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(
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))
]),
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(
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))
]),
];
@ -80,36 +80,36 @@ class TetraLeagueThingy extends StatelessWidget{
defaultColumnWidth:const IntrinsicColumnWidth(),
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(
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))
]),
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(
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))
]),
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(
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 (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(" ${t.stats.winrate.short}", style: TextStyle(fontSize: 21, 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))),
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: 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: 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 (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});
List<TableRow> secondColumn(){
List<TableRow> secondColumn(TextStyle style){
return [
TableRow(children: [
Text(intf.format(zenith!.stats.kills), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.kos.short}", style: TextStyle(fontSize: 21))
Text(intf.format(zenith!.stats.kills), textAlign: TextAlign.right, style: style),
Text(" ${t.stats.kos.short}", style: style)
]),
TableRow(children: [
Text(zenith!.stats.topBtB.toString(), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.b2b.short}", style: TextStyle(fontSize: 21))
Text(zenith!.stats.topBtB.toString(), textAlign: TextAlign.right, style: style),
Text(" ${t.stats.b2b.short}", style: style)
]),
TableRow(children: [
Text(zenith!.stats.garbage.maxspike_nomult.toString(), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.spike}", style: TextStyle(fontSize: 21))
Text(zenith!.stats.garbage.maxspike_nomult.toString(), textAlign: TextAlign.right, style: style),
Text(" ${t.stats.spike}", style: style)
]),
if (width <= 600) TableRow(children: [
Text(f2.format(zenith!.stats.zenith!.peakrank), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.peakClimbSpeed.short}", style: TextStyle(fontSize: 21)),
Text(f2.format(zenith!.stats.zenith!.peakrank), textAlign: TextAlign.right, style: style),
Text(" ${t.stats.peakClimbSpeed.short}", style: style),
])
];
}
List<TableRow> noRecordSecondColumn(){
List<TableRow> noRecordSecondColumn(TextStyle style){
return [
TableRow(children: [
Text("---", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)),
Text(" ${t.stats.kos.short}", style: TextStyle(fontSize: 21, color: Colors.grey))
Text("---", textAlign: TextAlign.right, style: style),
Text(" ${t.stats.kos.short}", style: style)
]),
TableRow(children: [
Text("---", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)),
Text(" ${t.stats.b2b.short}", style: TextStyle(fontSize: 21, color: Colors.grey))
Text("---", textAlign: TextAlign.right, style: style),
Text(" ${t.stats.b2b.short}", style: style)
]),
TableRow(children: [
Text("---", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)),
Text(" ${t.stats.spike}", style: TextStyle(fontSize: 21, color: Colors.grey))
Text("---", textAlign: TextAlign.right, style: style),
Text(" ${t.stats.spike}", style: style)
]),
if (width <= 600) TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: const TextStyle(fontSize: 21, color: Colors.grey)),
Text(" ${t.stats.peakClimbSpeed.short}", style: TextStyle(fontSize: 21, color: Colors.grey)),
Text("-.--", textAlign: TextAlign.right, style: style),
Text(" ${t.stats.peakClimbSpeed.short}", style: style),
])
];
}
@override
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(
child: Padding(
padding: const EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
@ -108,22 +110,22 @@ class ZenithThingy extends StatelessWidget{
defaultColumnWidth:const IntrinsicColumnWidth(),
children: [
TableRow(children: [
Text(f2.format(zenith!.aggregateStats.apm), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.apm.short}", style: TextStyle(fontSize: 21)),
Text(f2.format(zenith!.aggregateStats.apm), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.apm.short}", style: tableTextStyle),
]),
TableRow(children: [
Text(f2.format(zenith!.aggregateStats.pps), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.pps.short}", style: TextStyle(fontSize: 21)),
Text(f2.format(zenith!.aggregateStats.pps), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.pps.short}", style: tableTextStyle),
]),
TableRow(children: [
Text(f2.format(zenith!.aggregateStats.vs), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.vs.short}", style: TextStyle(fontSize: 21)),
Text(f2.format(zenith!.aggregateStats.vs), textAlign: TextAlign.right, style: tableTextStyle),
Text(" ${t.stats.vs.short}", style: tableTextStyle),
]),
if (width <= 600) TableRow(children: [
Text(f2.format(zenith!.stats.cps), textAlign: TextAlign.right, style: const TextStyle(fontSize: 21)),
Text(" ${t.stats.climbSpeed.short}", style: TextStyle(fontSize: 21)),
Text(f2.format(zenith!.stats.cps), textAlign: TextAlign.right, style: tableTextStyle),
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: Table(
defaultColumnWidth:const IntrinsicColumnWidth(),
children: secondColumn(),
children: secondColumn(tableTextStyle),
),
),
)
@ -146,20 +148,20 @@ class ZenithThingy extends StatelessWidget{
defaultColumnWidth: IntrinsicColumnWidth(),
children: [
TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)),
Text(" ${t.stats.apm.short}", style: TextStyle(fontSize: 21, color: Colors.grey)),
Text("-.--", textAlign: TextAlign.right, style: tableTextStyleMuted),
Text(" ${t.stats.apm.short}", style: tableTextStyleMuted),
]),
TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)),
Text(" ${t.stats.pps.short}", style: TextStyle(fontSize: 21, color: Colors.grey)),
Text("-.--", textAlign: TextAlign.right, style: tableTextStyleMuted),
Text(" ${t.stats.pps.short}", style: tableTextStyleMuted),
]),
TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: TextStyle(fontSize: 21, color: Colors.grey)),
Text(" ${t.stats.vs.short}", style: TextStyle(fontSize: 21, color: Colors.grey)),
Text("-.--", textAlign: TextAlign.right, style: tableTextStyleMuted),
Text(" ${t.stats.vs.short}", style: tableTextStyleMuted),
]),
if (width <= 600) TableRow(children: [
Text("-.--", textAlign: TextAlign.right, style: const TextStyle(fontSize: 21, color: Colors.grey)),
Text(" ${t.stats.climbSpeed.short}", style: TextStyle(fontSize: 21, color: Colors.grey)),
Text("-.--", textAlign: TextAlign.right, style: tableTextStyleMuted),
Text(" ${t.stats.climbSpeed.short}", style: tableTextStyleMuted),
])
],
),
@ -170,7 +172,7 @@ class ZenithThingy extends StatelessWidget{
child: Center(
child: Table(
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
publish_to: 'none'
version: 2.0.0+41
version: 2.0.1+42
environment:
sdk: '>=3.0.0'

View File

@ -150,19 +150,20 @@
let tip = document.querySelector("#tip");
const tips = [
// 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",
"Did you know, that Flutter for web sucks?",
"Welcome to fullscreen canvas",
// An actual tips
"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",
"Discord userID ≠ Discord username. It should look like a bunch of digits",
// :droidsmile:
"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"
];
tip.innerHTML = tips[Math.floor(Math.random() * tips.length)];