TetraStats/lib/widgets/sp_trailing_stats.dart

47 lines
3.1 KiB
Dart
Raw Normal View History

2024-06-13 21:12:48 +00:00
import 'package:flutter/material.dart';
2024-09-05 21:42:21 +00:00
import 'package:tetra_stats/data_objects/record_single.dart';
2024-12-02 20:45:15 +00:00
import 'package:tetra_stats/gen/strings.g.dart';
2024-06-13 21:12:48 +00:00
import 'package:tetra_stats/utils/numers_formats.dart';
import 'package:tetra_stats/utils/relative_timestamps.dart';
2024-06-13 21:12:48 +00:00
class SpTrailingStats extends StatelessWidget{
final RecordSingle record;
2024-07-27 19:10:45 +00:00
final String gamemode;
2024-06-13 21:12:48 +00:00
const SpTrailingStats(this.record, this.gamemode, {super.key});
2024-06-13 21:12:48 +00:00
@override
Widget build(BuildContext context) {
const TextStyle style = TextStyle(height: 1.1, fontWeight: FontWeight.w100, fontSize: 13);
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
2024-07-27 19:10:45 +00:00
Text(switch(gamemode){
2024-12-02 20:45:15 +00:00
"40l" => "${record.stats.piecesPlaced} ${t.stats.pieces.short}, ${f2.format(record.stats.pps)} ${t.stats.pps.short}",
"blitz" => "${record.stats.piecesPlaced} ${t.stats.pieces.short}, ${f2.format(record.stats.pps)} ${t.stats.pps.short}",
"5mblast" => "${record.stats.piecesPlaced} ${t.stats.pieces.short}, ${f2.format(record.stats.pps)} ${t.stats.pps.short}",
"zenith" => "${f2.format(record.aggregateStats.apm)} ${t.stats.apm.short}, ${f2.format(record.aggregateStats.pps)} ${t.stats.pps.short}",
"zenithex" => "${f2.format(record.aggregateStats.apm)} ${t.stats.apm.short}, ${f2.format(record.aggregateStats.pps)} ${t.stats.pps.short}",
String() => "huh"
}, style: style, textAlign: TextAlign.right),
Text(switch(gamemode){
2024-12-02 20:45:15 +00:00
"40l" => "${intf.format(record.stats.finessePercentage*100)}% ${t.stats.finesse.short}, ${record.stats.finesse?.faults} ${t.stats.finesseFaults.short}",
"blitz" => "${intf.format(record.stats.finessePercentage*100)}% ${t.stats.finesse.short}, ${record.stats.finesse?.faults} ${t.stats.finesseFaults.short}",
"5mblast" => "${intf.format(record.stats.finessePercentage*100)}% ${t.stats.finesse.short}, ${record.stats.finesse?.faults} ${t.stats.finesseFaults.short}",
"zenith" => "${f2.format(record.stats.cps)} ${t.stats.climbSpeed.short} (${f2.format(record.stats.zenith!.peakrank)} ${t.stats.peak})",
"zenithex" => "${f2.format(record.stats.cps)} ${t.stats.climbSpeed.short} (${f2.format(record.stats.zenith!.peakrank)} ${t.stats.peak})",
String() => "huh"
}, style: style, textAlign: TextAlign.right),
Text(switch(gamemode){
2024-12-02 20:45:15 +00:00
"40l" => "${f2.format(record.stats.kps)} ${t.stats.kps.short}, ${f2.format(record.stats.kpp)} ${t.stats.kpp.short}",
"blitz" => "${intf.format(record.stats.spp)} ${t.stats.spp.short}, ${t.stats.level.short} ${record.stats.level}",
"5mblast" => "${intf.format(record.stats.spp)} ${t.stats.spp.short}, ${record.stats.lines} ${t.stats.linesShort}",
"zenith" => "${record.stats.kills} ${t.stats.kos.short}, ${getMoreNormalTime(record.stats.finalTime)}",
"zenithex" => "${record.stats.kills} ${t.stats.kos.short}, ${getMoreNormalTime(record.stats.finalTime)}",
2024-06-13 21:12:48 +00:00
String() => "huh"
}, style: style, textAlign: TextAlign.right)
],
);
}
}