2023-06-17 21:50:52 +00:00
|
|
|
import 'dart:math';
|
|
|
|
import 'package:fl_chart/fl_chart.dart';
|
2023-07-06 12:48:04 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
2023-06-17 21:50:52 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
import 'package:tetra_stats/data_objects/tetrio.dart';
|
2023-07-14 20:21:49 +00:00
|
|
|
import 'package:tetra_stats/gen/strings.g.dart';
|
2023-06-17 21:50:52 +00:00
|
|
|
import 'package:tetra_stats/services/tetrio_crud.dart';
|
|
|
|
|
2023-07-06 12:48:04 +00:00
|
|
|
enum Mode{
|
|
|
|
player,
|
|
|
|
stats,
|
|
|
|
averages
|
|
|
|
}
|
|
|
|
Mode greenSideMode = Mode.player;
|
|
|
|
List<dynamic> theGreenSide = [null, null, null]; // TetrioPlayer?, List<DropdownMenuItem<TetrioPlayer>>?, TetraLeagueAlpha?
|
|
|
|
Mode redSideMode = Mode.player;
|
|
|
|
List<dynamic> theRedSide = [null, null, null];
|
2023-06-17 21:50:52 +00:00
|
|
|
final TetrioService teto = TetrioService();
|
2023-07-14 20:21:49 +00:00
|
|
|
final DateFormat dateFormat = DateFormat.yMd(LocaleSettings.currentLocale.languageCode).add_Hm();
|
2023-07-06 12:48:04 +00:00
|
|
|
// ignore: unnecessary_string_escapes
|
|
|
|
var numbersReg = RegExp(r'\d+(\.\d*)*');
|
2023-06-17 21:50:52 +00:00
|
|
|
|
|
|
|
class CompareView extends StatefulWidget {
|
2023-07-06 12:48:04 +00:00
|
|
|
final List<dynamic> greenSide;
|
|
|
|
final List<dynamic> redSide;
|
|
|
|
final Mode greenMode;
|
|
|
|
final Mode redMode;
|
|
|
|
const CompareView({Key? key, required this.greenSide, required this.redSide, required this.greenMode, required this.redMode})
|
2023-06-19 20:42:37 +00:00
|
|
|
: super(key: key);
|
2023-06-17 21:50:52 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() => CompareState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class CompareState extends State<CompareView> {
|
|
|
|
late ScrollController _scrollController;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
theGreenSide = widget.greenSide;
|
2023-07-06 12:48:04 +00:00
|
|
|
fetchGreenSide(widget.greenSide[0].userId);
|
|
|
|
if (widget.redSide[0] != null) fetchRedSide(widget.redSide[0].userId);
|
2023-06-17 21:50:52 +00:00
|
|
|
_scrollController = ScrollController();
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
2023-06-19 20:42:37 +00:00
|
|
|
@override
|
|
|
|
void dispose(){
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide = [null, null, null];
|
2023-07-06 13:26:20 +00:00
|
|
|
greenSideMode = Mode.player;
|
2023-07-06 12:48:04 +00:00
|
|
|
theRedSide = [null, null, null];
|
2023-07-06 13:26:20 +00:00
|
|
|
redSideMode = Mode.player;
|
2023-06-19 20:42:37 +00:00
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
2023-06-17 21:50:52 +00:00
|
|
|
void fetchRedSide(String user) async {
|
|
|
|
try {
|
2023-07-10 17:42:20 +00:00
|
|
|
if (user.startsWith("\$avg")){
|
|
|
|
try{
|
|
|
|
var average = (await teto.fetchTLLeaderboard()).getAverageOfRank(user.substring(4).toLowerCase())[0];
|
|
|
|
redSideMode = Mode.averages;
|
|
|
|
theRedSide = [null, null, average];
|
|
|
|
return setState(() {});
|
|
|
|
}on Exception {
|
|
|
|
ScaffoldMessenger.of(context)
|
2023-07-14 20:21:49 +00:00
|
|
|
.showSnackBar(SnackBar(content: Text(t.compareViewWrongValue(value: user))));
|
2023-07-10 17:42:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2023-07-06 12:48:04 +00:00
|
|
|
var tearDownToNumbers = numbersReg.allMatches(user);
|
|
|
|
if (tearDownToNumbers.length == 3) {
|
|
|
|
redSideMode = Mode.stats;
|
|
|
|
var threeNumbers = tearDownToNumbers.toList();
|
|
|
|
double apm = double.parse(threeNumbers[0][0]!);
|
|
|
|
double pps = double.parse(threeNumbers[1][0]!);
|
|
|
|
double vs = double.parse(threeNumbers[2][0]!);
|
|
|
|
theRedSide = [null,
|
|
|
|
null,
|
|
|
|
TetraLeagueAlpha(
|
2023-07-17 17:57:24 +00:00
|
|
|
timestamp: DateTime.now(),
|
2023-07-06 12:48:04 +00:00
|
|
|
apm: apm,
|
|
|
|
pps: pps,
|
|
|
|
vs: vs,
|
|
|
|
rd: noTrRd,
|
|
|
|
gamesPlayed: -1,
|
|
|
|
gamesWon: -1,
|
|
|
|
bestRank: "z",
|
|
|
|
decaying: true,
|
|
|
|
rating: -1,
|
|
|
|
rank: "z",
|
|
|
|
percentileRank: "z",
|
|
|
|
percentile: 1,
|
|
|
|
standing: -1,
|
|
|
|
standingLocal: -1,
|
|
|
|
nextAt: -1,
|
|
|
|
prevAt: -1)
|
|
|
|
];
|
|
|
|
return setState(() {});
|
|
|
|
}
|
|
|
|
var player = await teto.fetchPlayer(user);
|
|
|
|
redSideMode = Mode.player;
|
2023-06-19 20:42:37 +00:00
|
|
|
late List<TetrioPlayer> states;
|
2023-07-06 12:48:04 +00:00
|
|
|
List<DropdownMenuItem<TetrioPlayer>>? dStates = <DropdownMenuItem<TetrioPlayer>>[];
|
2023-06-19 20:42:37 +00:00
|
|
|
try{
|
2023-07-06 12:48:04 +00:00
|
|
|
states = await teto.getPlayer(player.userId);
|
2023-06-19 20:42:37 +00:00
|
|
|
for (final TetrioPlayer state in states) {
|
2023-07-06 12:48:04 +00:00
|
|
|
dStates.add(DropdownMenuItem<TetrioPlayer>(
|
2023-06-19 20:42:37 +00:00
|
|
|
value: state, child: Text(dateFormat.format(state.state))));
|
|
|
|
}
|
2023-07-06 12:48:04 +00:00
|
|
|
dStates.firstWhere((element) => element.value == player, orElse: () {
|
|
|
|
dStates?.add(DropdownMenuItem<TetrioPlayer>(
|
2023-07-14 20:21:49 +00:00
|
|
|
value: player, child: Text(t.mostRecentOne)));
|
2023-06-29 22:41:11 +00:00
|
|
|
return DropdownMenuItem<TetrioPlayer>(
|
2023-07-14 20:21:49 +00:00
|
|
|
value: player, child: Text(t.mostRecentOne));
|
2023-06-29 22:41:11 +00:00
|
|
|
},);
|
2023-06-19 20:42:37 +00:00
|
|
|
}on Exception {
|
2023-07-06 12:48:04 +00:00
|
|
|
dStates = null;
|
2023-06-19 20:42:37 +00:00
|
|
|
}
|
2023-07-06 12:48:04 +00:00
|
|
|
theRedSide = [player, dStates, player.tlSeason1];
|
2023-06-17 21:50:52 +00:00
|
|
|
} on Exception {
|
2023-06-19 20:42:37 +00:00
|
|
|
ScaffoldMessenger.of(context)
|
2023-07-14 20:21:49 +00:00
|
|
|
.showSnackBar(SnackBar(content: Text(t.compareViewWrongValue(value: user))));
|
2023-06-17 21:50:52 +00:00
|
|
|
}
|
2023-07-11 20:51:53 +00:00
|
|
|
_justUpdate();
|
2023-06-17 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
2023-06-19 20:42:37 +00:00
|
|
|
void changeRedSide(TetrioPlayer user) {
|
2023-07-06 12:48:04 +00:00
|
|
|
setState(() {theRedSide[0] = user;
|
|
|
|
theRedSide[2] = user.tlSeason1;});
|
2023-06-19 20:42:37 +00:00
|
|
|
}
|
|
|
|
|
2023-06-17 21:50:52 +00:00
|
|
|
void fetchGreenSide(String user) async {
|
|
|
|
try {
|
2023-07-10 17:42:20 +00:00
|
|
|
if (user.startsWith("\$avg")){
|
|
|
|
try{
|
|
|
|
var average = (await teto.fetchTLLeaderboard()).getAverageOfRank(user.substring(4).toLowerCase())[0];
|
|
|
|
greenSideMode = Mode.averages;
|
|
|
|
theGreenSide = [null, null, average];
|
|
|
|
return setState(() {});
|
|
|
|
}on Exception {
|
|
|
|
ScaffoldMessenger.of(context)
|
|
|
|
.showSnackBar(SnackBar(content: Text("Falied to assign $user")));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2023-07-06 12:48:04 +00:00
|
|
|
var tearDownToNumbers = numbersReg.allMatches(user);
|
|
|
|
if (tearDownToNumbers.length == 3) {
|
|
|
|
greenSideMode = Mode.stats;
|
|
|
|
var threeNumbers = tearDownToNumbers.toList();
|
|
|
|
double apm = double.parse(threeNumbers[0][0]!);
|
|
|
|
double pps = double.parse(threeNumbers[1][0]!);
|
|
|
|
double vs = double.parse(threeNumbers[2][0]!);
|
2023-07-06 13:26:20 +00:00
|
|
|
theGreenSide = [null,
|
2023-07-06 12:48:04 +00:00
|
|
|
null,
|
|
|
|
TetraLeagueAlpha(
|
2023-07-17 17:57:24 +00:00
|
|
|
timestamp: DateTime.now(),
|
2023-07-06 12:48:04 +00:00
|
|
|
apm: apm,
|
|
|
|
pps: pps,
|
|
|
|
vs: vs,
|
|
|
|
rd: noTrRd,
|
|
|
|
gamesPlayed: -1,
|
|
|
|
gamesWon: -1,
|
|
|
|
bestRank: "z",
|
|
|
|
decaying: true,
|
|
|
|
rating: -1,
|
|
|
|
rank: "z",
|
|
|
|
percentileRank: "z",
|
|
|
|
percentile: 1,
|
|
|
|
standing: -1,
|
|
|
|
standingLocal: -1,
|
|
|
|
nextAt: -1,
|
|
|
|
prevAt: -1)
|
|
|
|
];
|
|
|
|
return setState(() {});
|
|
|
|
}
|
|
|
|
var player = await teto.fetchPlayer(user);
|
|
|
|
greenSideMode = Mode.player;
|
2023-06-19 20:42:37 +00:00
|
|
|
late List<TetrioPlayer> states;
|
2023-07-06 12:48:04 +00:00
|
|
|
List<DropdownMenuItem<TetrioPlayer>>? dStates = <DropdownMenuItem<TetrioPlayer>>[];
|
2023-06-19 20:42:37 +00:00
|
|
|
try{
|
2023-07-06 12:48:04 +00:00
|
|
|
states = await teto.getPlayer(player.userId);
|
2023-06-19 20:42:37 +00:00
|
|
|
for (final TetrioPlayer state in states) {
|
2023-07-06 12:48:04 +00:00
|
|
|
dStates.add(DropdownMenuItem<TetrioPlayer>(
|
2023-06-19 20:42:37 +00:00
|
|
|
value: state, child: Text(dateFormat.format(state.state))));
|
|
|
|
}
|
2023-07-06 12:48:04 +00:00
|
|
|
dStates.firstWhere((element) => element.value == player, orElse: () {
|
|
|
|
dStates?.add(DropdownMenuItem<TetrioPlayer>(
|
2023-07-14 20:21:49 +00:00
|
|
|
value: player, child: Text(t.mostRecentOne)));
|
2023-06-29 22:41:11 +00:00
|
|
|
return DropdownMenuItem<TetrioPlayer>(
|
2023-07-14 20:21:49 +00:00
|
|
|
value: player, child: Text(t.mostRecentOne));
|
2023-06-29 22:41:11 +00:00
|
|
|
},);
|
2023-06-19 20:42:37 +00:00
|
|
|
}on Exception {
|
2023-07-06 12:48:04 +00:00
|
|
|
dStates = null;
|
2023-06-19 20:42:37 +00:00
|
|
|
}
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide = [player, dStates, player.tlSeason1];
|
2023-06-17 21:50:52 +00:00
|
|
|
} on Exception {
|
2023-06-19 20:42:37 +00:00
|
|
|
ScaffoldMessenger.of(context)
|
|
|
|
.showSnackBar(SnackBar(content: Text("Falied to assign $user")));
|
2023-06-17 21:50:52 +00:00
|
|
|
}
|
2023-07-11 20:51:53 +00:00
|
|
|
_justUpdate();
|
2023-06-17 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
2023-06-19 20:42:37 +00:00
|
|
|
void changeGreenSide(TetrioPlayer user) {
|
2023-07-06 12:48:04 +00:00
|
|
|
setState(() {theGreenSide[0] = user;
|
|
|
|
theGreenSide[2] = user.tlSeason1;});
|
2023-06-19 20:42:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double getWinrateByTR(double yourGlicko, double yourRD, double notyourGlicko,
|
|
|
|
double notyourRD) {
|
2023-06-17 21:50:52 +00:00
|
|
|
return ((1 /
|
2023-06-19 20:42:37 +00:00
|
|
|
(1 +
|
|
|
|
pow(
|
|
|
|
10,
|
|
|
|
(notyourGlicko - yourGlicko) /
|
|
|
|
(400 *
|
|
|
|
sqrt(1 +
|
|
|
|
(3 *
|
|
|
|
pow(0.0057564273, 2) *
|
|
|
|
(pow(yourRD, 2) + pow(notyourRD, 2)) /
|
|
|
|
pow(pi, 2))))))));
|
2023-06-17 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void _justUpdate() {
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-07-14 20:21:49 +00:00
|
|
|
final t = Translations.of(context);
|
2023-06-17 21:50:52 +00:00
|
|
|
bool bigScreen = MediaQuery.of(context).size.width > 768;
|
2023-07-06 12:48:04 +00:00
|
|
|
String titleGreenSide;
|
|
|
|
String titleRedSide;
|
|
|
|
switch (greenSideMode){
|
|
|
|
case Mode.player:
|
|
|
|
titleGreenSide = theGreenSide[0] != null ? theGreenSide[0].username.toUpperCase() : "???";
|
|
|
|
break;
|
|
|
|
case Mode.stats:
|
|
|
|
titleGreenSide = "${theGreenSide[2].apm} APM, ${theGreenSide[2].pps} PPS, ${theGreenSide[2].vs} VS";
|
|
|
|
break;
|
|
|
|
case Mode.averages:
|
2023-07-14 20:21:49 +00:00
|
|
|
titleGreenSide = t.averageXrank(rankLetter: theGreenSide[2].rank.toUpperCase());
|
2023-07-06 12:48:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (redSideMode){
|
|
|
|
case Mode.player:
|
|
|
|
titleRedSide = theRedSide[0] != null ? theRedSide[0].username.toUpperCase() : "???";
|
|
|
|
break;
|
|
|
|
case Mode.stats:
|
|
|
|
titleRedSide = "${theRedSide[2].apm} APM, ${theRedSide[2].pps} PPS, ${theRedSide[2].vs} VS";
|
|
|
|
break;
|
|
|
|
case Mode.averages:
|
2023-08-21 15:39:04 +00:00
|
|
|
titleRedSide = t.averageXrank(rankLetter: theRedSide[2].rank.toUpperCase());
|
2023-07-06 12:48:04 +00:00
|
|
|
break;
|
|
|
|
}
|
2023-06-17 21:50:52 +00:00
|
|
|
return Scaffold(
|
2023-07-14 20:21:49 +00:00
|
|
|
appBar: AppBar(title: Text("$titleGreenSide ${t.vs} $titleRedSide")),
|
2023-06-17 21:50:52 +00:00
|
|
|
backgroundColor: Colors.black,
|
|
|
|
body: SafeArea(
|
|
|
|
child: NestedScrollView(
|
|
|
|
controller: _scrollController,
|
|
|
|
headerSliverBuilder: (context, value) {
|
|
|
|
return [
|
|
|
|
SliverToBoxAdapter(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: [Colors.green, Colors.transparent],
|
|
|
|
begin: Alignment.bottomCenter,
|
|
|
|
end: Alignment.topCenter,
|
|
|
|
stops: [0.0, 0.4],
|
|
|
|
)),
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
|
|
|
|
child: PlayerSelector(
|
2023-07-06 12:48:04 +00:00
|
|
|
data: theGreenSide,
|
|
|
|
mode: greenSideMode,
|
2023-06-19 20:42:37 +00:00
|
|
|
fetch: fetchGreenSide,
|
|
|
|
change: changeGreenSide,
|
2023-06-17 21:50:52 +00:00
|
|
|
updateState: _justUpdate,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const Padding(
|
|
|
|
padding: EdgeInsets.only(top: 16),
|
|
|
|
child: Text("VS"),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: [Colors.red, Colors.transparent],
|
|
|
|
begin: Alignment.bottomCenter,
|
|
|
|
end: Alignment.topCenter,
|
|
|
|
stops: [0.0, 0.4],
|
|
|
|
)),
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
|
|
|
|
child: PlayerSelector(
|
2023-07-06 12:48:04 +00:00
|
|
|
data: theRedSide,
|
|
|
|
mode: redSideMode,
|
2023-06-19 20:42:37 +00:00
|
|
|
fetch: fetchRedSide,
|
|
|
|
change: changeRedSide,
|
2023-06-17 21:50:52 +00:00
|
|
|
updateState: _justUpdate,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SliverToBoxAdapter(
|
|
|
|
child: Divider(),
|
|
|
|
)
|
|
|
|
];
|
|
|
|
},
|
2023-07-06 12:48:04 +00:00
|
|
|
body: ListView(
|
|
|
|
children: !listEquals(theGreenSide, [null, null, null]) && !listEquals(theRedSide, [null, null, null])? [
|
|
|
|
if (theGreenSide[0] != null &&
|
|
|
|
theRedSide[0] != null &&
|
|
|
|
theGreenSide[0]!.role != "banned" &&
|
|
|
|
theRedSide[0]!.role != "banned")
|
2023-06-17 21:50:52 +00:00
|
|
|
Column(
|
|
|
|
children: [
|
2023-06-19 20:42:37 +00:00
|
|
|
CompareRegTimeThingy(
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[0].registrationTime,
|
|
|
|
redSide: theRedSide[0].registrationTime,
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.registred),
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.level,
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[0].level,
|
|
|
|
redSide: theRedSide[0].level,
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: true,
|
|
|
|
fractionDigits: 2,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (!theGreenSide[0].gameTime.isNegative &&
|
|
|
|
!theRedSide[0].gameTime.isNegative)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[0].gameTime.inMicroseconds /
|
2023-06-19 20:42:37 +00:00
|
|
|
1000000 /
|
|
|
|
60 /
|
|
|
|
60,
|
2023-07-06 12:48:04 +00:00
|
|
|
redSide: theRedSide[0].gameTime.inMicroseconds /
|
2023-06-19 20:42:37 +00:00
|
|
|
1000000 /
|
|
|
|
60 /
|
|
|
|
60,
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.hoursPlayed.replaceAll(RegExp(r'\n'), " "),
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: true,
|
|
|
|
fractionDigits: 2,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[0].gamesPlayed >= 0 &&
|
|
|
|
theRedSide[0].gamesPlayed >= 0)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.onlineGames.replaceAll(RegExp(r'\n'), " "),
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[0].gamesPlayed,
|
|
|
|
redSide: theRedSide[0].gamesPlayed,
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[0].gamesWon >= 0 &&
|
|
|
|
theRedSide[0].gamesWon >= 0)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.gamesWon.replaceAll(RegExp(r'\n'), " "),
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[0].gamesWon,
|
|
|
|
redSide: theRedSide[0].gamesWon,
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.friends,
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[0].friendCount,
|
|
|
|
redSide: theRedSide[0].friendCount,
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
const Divider(),
|
2023-06-17 21:50:52 +00:00
|
|
|
],
|
2023-07-06 12:48:04 +00:00
|
|
|
),
|
|
|
|
if (theGreenSide[0] != null &&
|
|
|
|
theRedSide[0] != null &&
|
|
|
|
(theGreenSide[0]!.role == "banned" ||
|
|
|
|
theRedSide[0]!.role == "banned"))
|
2023-06-19 20:42:37 +00:00
|
|
|
CompareBoolThingy(
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[0].role == "banned",
|
|
|
|
redSide: theRedSide[0].role == "banned",
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.normalBanned,
|
2023-06-19 20:42:37 +00:00
|
|
|
trueIsBetter: false),
|
2023-07-06 12:48:04 +00:00
|
|
|
(theGreenSide[2].gamesPlayed > 0 || greenSideMode == Mode.stats) &&
|
|
|
|
(theRedSide[2].gamesPlayed > 0 || redSideMode == Mode.stats)
|
2023-06-17 21:50:52 +00:00
|
|
|
? Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(bottom: 16),
|
2023-07-14 20:21:49 +00:00
|
|
|
child: Text(t.tetraLeague,
|
2023-06-19 20:42:37 +00:00
|
|
|
style: TextStyle(
|
|
|
|
fontFamily: "Eurostile Round Extended",
|
|
|
|
fontSize: bigScreen ? 42 : 28)),
|
2023-06-17 21:50:52 +00:00
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].gamesPlayed > 9 &&
|
|
|
|
theRedSide[2].gamesPlayed > 9 &&
|
2023-07-10 17:42:20 +00:00
|
|
|
greenSideMode != Mode.stats &&
|
|
|
|
redSideMode != Mode.stats)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
|
|
|
label: "TR",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].rating,
|
|
|
|
redSide: theRedSide[2].rating,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-10 17:42:20 +00:00
|
|
|
if (greenSideMode != Mode.stats &&
|
|
|
|
redSideMode != Mode.stats)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.gamesPlayed.replaceAll(RegExp(r'\n'), " "),
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].gamesPlayed,
|
|
|
|
redSide: theRedSide[2].gamesPlayed,
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-10 17:42:20 +00:00
|
|
|
if (greenSideMode != Mode.stats &&
|
|
|
|
redSideMode != Mode.stats)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.gamesWonTL.replaceAll(RegExp(r'\n'), " "),
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].gamesWon,
|
|
|
|
redSide: theRedSide[2].gamesWon,
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-10 17:42:20 +00:00
|
|
|
if (greenSideMode != Mode.stats &&
|
|
|
|
redSideMode != Mode.stats)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
|
|
|
label: "WR %",
|
2023-06-19 20:42:37 +00:00
|
|
|
greenSide:
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide[2].winrate * 100,
|
|
|
|
redSide: theRedSide[2].winrate * 100,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].gamesPlayed > 9 &&
|
|
|
|
theRedSide[2].gamesPlayed > 9 &&
|
2023-07-10 17:42:20 +00:00
|
|
|
greenSideMode != Mode.stats &&
|
|
|
|
redSideMode != Mode.stats)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
|
|
|
label: "Glicko",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].glicko!,
|
|
|
|
redSide: theRedSide[2].glicko!,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].gamesPlayed > 9 &&
|
|
|
|
theRedSide[2].gamesPlayed > 9 &&
|
2023-07-10 17:42:20 +00:00
|
|
|
greenSideMode != Mode.stats &&
|
|
|
|
redSideMode != Mode.stats)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
|
|
|
label: "RD",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].rd!,
|
|
|
|
redSide: theRedSide[2].rd!,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: false,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].standing > 0 &&
|
|
|
|
theRedSide[2].standing > 0 &&
|
|
|
|
greenSideMode == Mode.player &&
|
|
|
|
redSideMode == Mode.player)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.lbpShort,
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].standing,
|
|
|
|
redSide: theRedSide[2].standing,
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: false,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].standingLocal > 0 &&
|
|
|
|
theRedSide[2].standingLocal > 0 &&
|
|
|
|
greenSideMode == Mode.player &&
|
|
|
|
redSideMode == Mode.player)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.lbpcShort,
|
2023-06-19 20:42:37 +00:00
|
|
|
greenSide:
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide[2].standingLocal,
|
|
|
|
redSide: theRedSide[2].standingLocal,
|
2023-06-17 21:50:52 +00:00
|
|
|
higherIsBetter: false,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].apm != null &&
|
|
|
|
theRedSide[2].apm != null)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
|
|
|
label: "APM",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].apm!,
|
|
|
|
redSide: theRedSide[2].apm!,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].pps != null &&
|
|
|
|
theRedSide[2].pps != null)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
|
|
|
label: "PPS",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].pps!,
|
|
|
|
redSide: theRedSide[2].pps!,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].vs != null &&
|
|
|
|
theRedSide[2].vs != null)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
|
|
|
label: "VS",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].vs!,
|
|
|
|
redSide: theRedSide[2].vs!,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: CompareBoolThingy(
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].gamesPlayed > 0,
|
|
|
|
redSide: theRedSide[2].gamesPlayed > 0,
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.playedTL,
|
2023-06-17 21:50:52 +00:00
|
|
|
trueIsBetter: false),
|
|
|
|
const Divider(),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].nerdStats != null &&
|
|
|
|
theRedSide[2].nerdStats != null)
|
2023-06-17 21:50:52 +00:00
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(bottom: 16),
|
2023-07-14 20:21:49 +00:00
|
|
|
child: Text(t.nerdStats,
|
2023-06-19 20:42:37 +00:00
|
|
|
style: TextStyle(
|
|
|
|
fontFamily: "Eurostile Round Extended",
|
|
|
|
fontSize: bigScreen ? 42 : 28)),
|
2023-06-17 21:50:52 +00:00
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "APP",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].nerdStats!.app,
|
|
|
|
redSide: theRedSide[2].nerdStats!.app,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "VS/APM",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].nerdStats!.vsapm,
|
|
|
|
redSide: theRedSide[2].nerdStats!.vsapm,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "DS/S",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].nerdStats!.dss,
|
|
|
|
redSide: theRedSide[2].nerdStats!.dss,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "DS/P",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].nerdStats!.dsp,
|
|
|
|
redSide: theRedSide[2].nerdStats!.dsp,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "APP + DS/P",
|
2023-06-19 20:42:37 +00:00
|
|
|
greenSide:
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide[2].nerdStats!.appdsp,
|
|
|
|
redSide: theRedSide[2].nerdStats!.appdsp,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.statCellNum.cheese.replaceAll(RegExp(r'\n'), " "),
|
2023-06-19 20:42:37 +00:00
|
|
|
greenSide:
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide[2].nerdStats!.cheese,
|
|
|
|
redSide: theRedSide[2].nerdStats!.cheese,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: "Gb Eff.",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].nerdStats!.gbe,
|
|
|
|
redSide: theRedSide[2].nerdStats!.gbe,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: "wAPP",
|
2023-06-19 20:42:37 +00:00
|
|
|
greenSide:
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide[2].nerdStats!.nyaapp,
|
|
|
|
redSide: theRedSide[2].nerdStats!.nyaapp,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "Area",
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].nerdStats!.area,
|
|
|
|
redSide: theRedSide[2].nerdStats!.area,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
2023-07-15 16:22:25 +00:00
|
|
|
label: t.statCellNum.estOfTRShort,
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].estTr!.esttr,
|
|
|
|
redSide: theRedSide[2].estTr!.esttr,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
if (theGreenSide[2].gamesPlayed > 9 &&
|
|
|
|
theGreenSide[2].gamesPlayed > 9 &&
|
2023-07-10 17:42:20 +00:00
|
|
|
greenSideMode != Mode.stats &&
|
|
|
|
redSideMode != Mode.stats)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-15 16:22:25 +00:00
|
|
|
label: t.statCellNum.accOfEstShort,
|
2023-07-06 12:48:04 +00:00
|
|
|
greenSide: theGreenSide[2].esttracc!,
|
|
|
|
redSide: theRedSide[2].esttracc!,
|
2023-06-17 21:50:52 +00:00
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-09-05 20:32:34 +00:00
|
|
|
CompareThingy(
|
|
|
|
label: "Opener",
|
|
|
|
greenSide: theGreenSide[2].playstyle!.opener,
|
|
|
|
redSide: theRedSide[2].playstyle!.opener,
|
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "Plonk",
|
|
|
|
greenSide: theGreenSide[2].playstyle!.plonk,
|
|
|
|
redSide: theRedSide[2].playstyle!.plonk,
|
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "Stride",
|
|
|
|
greenSide: theGreenSide[2].playstyle!.stride,
|
|
|
|
redSide: theRedSide[2].playstyle!.stride,
|
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
|
|
|
CompareThingy(
|
|
|
|
label: "Inf. DS",
|
|
|
|
greenSide: theGreenSide[2].playstyle!.infds,
|
|
|
|
redSide: theRedSide[2].playstyle!.infds,
|
|
|
|
fractionDigits: 3,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-06-17 21:50:52 +00:00
|
|
|
Wrap(
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
alignment: WrapAlignment.spaceAround,
|
|
|
|
spacing: 25,
|
|
|
|
crossAxisAlignment: WrapCrossAlignment.start,
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
children: [
|
|
|
|
Padding(
|
2023-09-02 22:48:50 +00:00
|
|
|
padding: const EdgeInsets.fromLTRB(18, 0, 18, 44),
|
|
|
|
child: SizedBox(
|
|
|
|
height: 310,
|
|
|
|
width: 310,
|
|
|
|
child: RadarChart(
|
|
|
|
RadarChartData(
|
|
|
|
radarShape: RadarShape.polygon,
|
|
|
|
tickCount: 4,
|
|
|
|
ticksTextStyle: const TextStyle(color: Colors.transparent, fontSize: 10),
|
|
|
|
radarBorderData: const BorderSide(color: Colors.transparent, width: 1),
|
|
|
|
gridBorderData: const BorderSide(color: Colors.white24, width: 1),
|
|
|
|
tickBorderData: const BorderSide(color: Colors.transparent, width: 1),
|
|
|
|
getTitle: (index, angle) {
|
|
|
|
switch (index) {
|
|
|
|
case 0:
|
|
|
|
return RadarChartTitle(
|
|
|
|
text: 'APM',
|
|
|
|
angle: angle,
|
|
|
|
positionPercentageOffset: 0.05
|
|
|
|
);
|
|
|
|
case 1:
|
|
|
|
return RadarChartTitle(
|
|
|
|
text: 'PPS',
|
|
|
|
angle: angle,
|
|
|
|
positionPercentageOffset: 0.05
|
|
|
|
);
|
|
|
|
case 2:
|
|
|
|
return RadarChartTitle(text: 'VS', angle: angle, positionPercentageOffset: 0.05);
|
|
|
|
case 3:
|
|
|
|
return RadarChartTitle(text: 'APP', angle: angle + 180, positionPercentageOffset: 0.05);
|
|
|
|
case 4:
|
|
|
|
return RadarChartTitle(text: 'DS/S', angle: angle + 180, positionPercentageOffset: 0.05);
|
|
|
|
case 5:
|
|
|
|
return RadarChartTitle(text: 'DS/P', angle: angle + 180, positionPercentageOffset: 0.05);
|
|
|
|
case 6:
|
|
|
|
return RadarChartTitle(text: 'APP+DS/P', angle: angle + 180, positionPercentageOffset: 0.05);
|
|
|
|
case 7:
|
|
|
|
return RadarChartTitle(text: 'VS/APM', angle: angle + 180, positionPercentageOffset: 0.05);
|
|
|
|
case 8:
|
|
|
|
return RadarChartTitle(text: 'Cheese', angle: angle, positionPercentageOffset: 0.05);
|
|
|
|
case 9:
|
|
|
|
return RadarChartTitle(text: 'Gb Eff.', angle: angle, positionPercentageOffset: 0.05);
|
|
|
|
default:
|
|
|
|
return const RadarChartTitle(text: '');
|
|
|
|
}
|
2023-06-17 21:50:52 +00:00
|
|
|
},
|
|
|
|
dataSets: [
|
|
|
|
RadarDataSet(
|
2023-07-06 12:48:04 +00:00
|
|
|
fillColor: const Color.fromARGB(115, 76, 175, 79),
|
2023-06-17 21:50:52 +00:00
|
|
|
borderColor: Colors.green,
|
|
|
|
dataEntries: [
|
2023-07-06 12:48:04 +00:00
|
|
|
RadarEntry(value: theGreenSide[2].apm! * apmWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].pps! * ppsWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].vs! * vsWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].nerdStats!.app * appWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].nerdStats!.dss * dssWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].nerdStats!.dsp * dspWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].nerdStats!.appdsp * appdspWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].nerdStats!.vsapm * vsapmWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].nerdStats!.cheese * cheeseWeight),
|
|
|
|
RadarEntry(value: theGreenSide[2].nerdStats!.gbe * gbeWeight),
|
2023-06-17 21:50:52 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
RadarDataSet(
|
2023-07-06 12:48:04 +00:00
|
|
|
fillColor: const Color.fromARGB(115, 244, 67, 54),
|
2023-06-17 21:50:52 +00:00
|
|
|
borderColor: Colors.red,
|
|
|
|
dataEntries: [
|
2023-07-06 12:48:04 +00:00
|
|
|
RadarEntry(value: theRedSide[2].apm! * apmWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].pps! * ppsWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].vs! * vsWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].nerdStats!.app * appWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].nerdStats!.dss * dssWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].nerdStats!.dsp * dspWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].nerdStats!.appdsp * appdspWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].nerdStats!.vsapm * vsapmWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].nerdStats!.cheese * cheeseWeight),
|
|
|
|
RadarEntry(value: theRedSide[2].nerdStats!.gbe * gbeWeight),
|
2023-06-17 21:50:52 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
RadarDataSet(
|
|
|
|
fillColor: Colors.transparent,
|
|
|
|
borderColor: Colors.transparent,
|
|
|
|
dataEntries: [
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
swapAnimationDuration: const Duration(milliseconds: 150),
|
|
|
|
swapAnimationCurve: Curves.linear,
|
2023-06-17 21:50:52 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
2023-09-02 22:48:50 +00:00
|
|
|
padding: const EdgeInsets.fromLTRB(18, 0, 18, 44),
|
|
|
|
child: SizedBox(
|
|
|
|
height: 310,
|
|
|
|
width: 310,
|
|
|
|
child: RadarChart(
|
|
|
|
RadarChartData(
|
|
|
|
radarShape: RadarShape.polygon,
|
|
|
|
tickCount: 4,
|
|
|
|
ticksTextStyle: const TextStyle(color: Colors.white24, fontSize: 10),
|
|
|
|
radarBorderData: const BorderSide(color: Colors.transparent, width: 1),
|
|
|
|
gridBorderData: const BorderSide(color: Colors.white24, width: 1),
|
|
|
|
tickBorderData: const BorderSide(color: Colors.transparent, width: 1),
|
|
|
|
titleTextStyle: const TextStyle(height: 1.1),
|
|
|
|
radarTouchData: RadarTouchData(),
|
2023-06-17 21:50:52 +00:00
|
|
|
getTitle: (index, angle) {
|
|
|
|
switch (index) {
|
|
|
|
case 0:
|
2023-09-02 22:48:50 +00:00
|
|
|
return RadarChartTitle(text: 'Opener',angle: angle, positionPercentageOffset: 0.05);
|
2023-06-17 21:50:52 +00:00
|
|
|
case 1:
|
2023-09-02 22:48:50 +00:00
|
|
|
return RadarChartTitle(text: 'Stride', angle: angle, positionPercentageOffset: 0.05);
|
2023-06-17 21:50:52 +00:00
|
|
|
case 2:
|
2023-09-02 22:48:50 +00:00
|
|
|
return RadarChartTitle(text: 'Inf Ds', angle: angle + 180, positionPercentageOffset: 0.05);
|
2023-06-17 21:50:52 +00:00
|
|
|
case 3:
|
2023-09-02 22:48:50 +00:00
|
|
|
return RadarChartTitle(text: 'Plonk', angle: angle, positionPercentageOffset: 0.05);
|
2023-06-17 21:50:52 +00:00
|
|
|
default:
|
2023-07-06 12:48:04 +00:00
|
|
|
return const RadarChartTitle(text: '');
|
2023-06-17 21:50:52 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
dataSets: [
|
|
|
|
RadarDataSet(
|
2023-07-06 12:48:04 +00:00
|
|
|
fillColor: const Color.fromARGB(115, 76, 175, 79),
|
2023-06-17 21:50:52 +00:00
|
|
|
borderColor: Colors.green,
|
|
|
|
dataEntries: [
|
2023-07-06 12:48:04 +00:00
|
|
|
RadarEntry(value: theGreenSide[2].playstyle!.opener),
|
|
|
|
RadarEntry(value: theGreenSide[2].playstyle!.stride),
|
|
|
|
RadarEntry(value: theGreenSide[2].playstyle!.infds),
|
|
|
|
RadarEntry(value: theGreenSide[2].playstyle!.plonk),
|
2023-06-17 21:50:52 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
RadarDataSet(
|
2023-07-06 12:48:04 +00:00
|
|
|
fillColor: const Color.fromARGB(115, 244, 67, 54),
|
2023-06-17 21:50:52 +00:00
|
|
|
borderColor: Colors.red,
|
|
|
|
dataEntries: [
|
2023-07-06 12:48:04 +00:00
|
|
|
RadarEntry(value: theRedSide[2].playstyle!.opener),
|
|
|
|
RadarEntry(value: theRedSide[2].playstyle!.stride),
|
|
|
|
RadarEntry(value: theRedSide[2].playstyle!.infds),
|
|
|
|
RadarEntry(value: theRedSide[2].playstyle!.plonk),
|
2023-06-17 21:50:52 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
RadarDataSet(
|
|
|
|
fillColor: Colors.transparent,
|
|
|
|
borderColor: Colors.transparent,
|
|
|
|
dataEntries: [
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
const RadarEntry(value: 0),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
RadarDataSet(
|
|
|
|
fillColor: Colors.transparent,
|
|
|
|
borderColor: Colors.transparent,
|
|
|
|
dataEntries: [
|
|
|
|
const RadarEntry(value: 1),
|
|
|
|
const RadarEntry(value: 1),
|
|
|
|
const RadarEntry(value: 1),
|
|
|
|
const RadarEntry(value: 1),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
2023-07-06 12:48:04 +00:00
|
|
|
swapAnimationDuration: const Duration(milliseconds: 150), // Optional
|
|
|
|
swapAnimationCurve: Curves.linear, // Optional
|
2023-06-17 21:50:52 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const Divider(),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(bottom: 16),
|
2023-07-14 20:21:49 +00:00
|
|
|
child: Text(t.winChance,
|
2023-06-19 20:42:37 +00:00
|
|
|
style: TextStyle(
|
|
|
|
fontFamily: "Eurostile Round Extended",
|
|
|
|
fontSize: bigScreen ? 42 : 28)),
|
2023-06-17 21:50:52 +00:00
|
|
|
),
|
2023-07-10 17:42:20 +00:00
|
|
|
if (greenSideMode != Mode.stats && redSideMode != Mode.stats &&
|
|
|
|
theGreenSide[2].gamesPlayed > 9 && theRedSide[2].gamesPlayed > 9)
|
2023-06-17 21:50:52 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.byGlicko,
|
2023-06-19 20:42:37 +00:00
|
|
|
greenSide: getWinrateByTR(
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide[2].glicko!,
|
|
|
|
theGreenSide[2].rd!,
|
|
|
|
theRedSide[2].glicko!,
|
|
|
|
theRedSide[2].rd!) *
|
2023-06-17 21:50:52 +00:00
|
|
|
100,
|
2023-06-19 20:42:37 +00:00
|
|
|
redSide: getWinrateByTR(
|
2023-07-06 12:48:04 +00:00
|
|
|
theRedSide[2].glicko!,
|
|
|
|
theRedSide[2].rd!,
|
|
|
|
theGreenSide[2].glicko!,
|
|
|
|
theGreenSide[2].rd!) *
|
2023-06-17 21:50:52 +00:00
|
|
|
100,
|
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-06-28 16:50:40 +00:00
|
|
|
CompareThingy(
|
2023-07-14 20:21:49 +00:00
|
|
|
label: t.byEstTR,
|
2023-06-28 16:50:40 +00:00
|
|
|
greenSide: getWinrateByTR(
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide[2].estTr!.estglicko,
|
2023-07-10 17:42:20 +00:00
|
|
|
theGreenSide[2].rd ?? noTrRd,
|
2023-07-06 12:48:04 +00:00
|
|
|
theRedSide[2].estTr!.estglicko,
|
2023-07-10 17:42:20 +00:00
|
|
|
theRedSide[2].rd ?? noTrRd) *
|
2023-06-28 16:50:40 +00:00
|
|
|
100,
|
|
|
|
redSide: getWinrateByTR(
|
2023-07-06 12:48:04 +00:00
|
|
|
theRedSide[2].estTr!.estglicko,
|
2023-07-10 17:42:20 +00:00
|
|
|
theRedSide[2].rd ?? noTrRd,
|
2023-07-06 12:48:04 +00:00
|
|
|
theGreenSide[2].estTr!.estglicko,
|
2023-07-10 17:42:20 +00:00
|
|
|
theGreenSide[2].rd ?? noTrRd) *
|
2023-06-28 16:50:40 +00:00
|
|
|
100,
|
|
|
|
fractionDigits: 2,
|
|
|
|
higherIsBetter: true,
|
|
|
|
),
|
2023-06-17 21:50:52 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
2023-09-23 19:09:36 +00:00
|
|
|
] : [Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Text(t.compareViewNoValues(avgR: "\$avgR"), textAlign: TextAlign.center),
|
|
|
|
)], // This is so fucked up holy shit
|
2023-06-17 21:50:52 +00:00
|
|
|
)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class PlayerSelector extends StatelessWidget {
|
2023-07-06 12:48:04 +00:00
|
|
|
final List data;
|
|
|
|
final Mode mode;
|
2023-06-19 20:42:37 +00:00
|
|
|
final Function fetch;
|
2023-06-17 21:50:52 +00:00
|
|
|
final Function change;
|
|
|
|
final Function updateState;
|
2023-08-21 15:39:04 +00:00
|
|
|
const PlayerSelector(
|
2023-06-19 20:42:37 +00:00
|
|
|
{super.key,
|
2023-07-06 12:48:04 +00:00
|
|
|
required this.data,
|
|
|
|
required this.mode,
|
2023-06-19 20:42:37 +00:00
|
|
|
required this.updateState,
|
2023-07-06 12:48:04 +00:00
|
|
|
required this.fetch,
|
|
|
|
required this.change});
|
2023-06-17 21:50:52 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final TextEditingController playerController = TextEditingController();
|
2023-07-10 17:42:20 +00:00
|
|
|
String underFieldString = "";
|
2023-07-06 12:48:04 +00:00
|
|
|
if (!listEquals(data, [null, null, null])){
|
|
|
|
switch (mode){
|
|
|
|
case Mode.player:
|
2023-07-10 17:42:20 +00:00
|
|
|
playerController.text = data[0] != null ? data[0].username : "";
|
2023-07-06 12:48:04 +00:00
|
|
|
break;
|
|
|
|
case Mode.stats:
|
|
|
|
playerController.text = "${data[2].apm} ${data[2].pps} ${data[2].vs}";
|
|
|
|
break;
|
|
|
|
case Mode.averages:
|
2023-07-10 17:42:20 +00:00
|
|
|
playerController.text = "\$avg${data[2].rank.toUpperCase()}";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!listEquals(data, [null, null, null])){
|
|
|
|
switch (mode){
|
|
|
|
case Mode.player:
|
|
|
|
underFieldString = data[0] != null ? data[0].toString() : "???";
|
|
|
|
break;
|
|
|
|
case Mode.stats:
|
|
|
|
underFieldString = "${data[2].apm} APM, ${data[2].pps} PPS, ${data[2].vs} VS";
|
|
|
|
break;
|
|
|
|
case Mode.averages:
|
2023-07-14 20:21:49 +00:00
|
|
|
underFieldString = t.averageXrank(rankLetter: data[2].rank.toUpperCase());
|
2023-07-06 12:48:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-06-17 21:50:52 +00:00
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
TextField(
|
|
|
|
autocorrect: false,
|
|
|
|
enableSuggestions: false,
|
|
|
|
maxLength: 25,
|
|
|
|
controller: playerController,
|
|
|
|
decoration: const InputDecoration(counter: Offstage()),
|
|
|
|
onSubmitted: (String value) {
|
2023-07-10 17:42:20 +00:00
|
|
|
underFieldString = "Fetching...";
|
2023-06-19 20:42:37 +00:00
|
|
|
fetch(value);
|
2023-06-17 21:50:52 +00:00
|
|
|
}),
|
2023-07-10 17:42:20 +00:00
|
|
|
if (data[0] != null && data[1] != null)
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(bottom: 8.0),
|
|
|
|
child: DropdownButton(
|
|
|
|
items: data[1],
|
|
|
|
value: data[0],
|
|
|
|
onChanged: (value) => change(value!),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
else Text(
|
|
|
|
underFieldString,
|
2023-06-17 21:50:52 +00:00
|
|
|
style: const TextStyle(
|
|
|
|
shadows: <Shadow>[
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 3.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 8.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2023-06-19 20:42:37 +00:00
|
|
|
),
|
2023-06-17 21:50:52 +00:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class CompareThingy extends StatelessWidget {
|
|
|
|
final num greenSide;
|
|
|
|
final num redSide;
|
|
|
|
final String label;
|
|
|
|
final bool higherIsBetter;
|
|
|
|
final int? fractionDigits;
|
2023-06-19 20:42:37 +00:00
|
|
|
const CompareThingy(
|
|
|
|
{super.key,
|
|
|
|
required this.greenSide,
|
|
|
|
required this.redSide,
|
|
|
|
required this.label,
|
|
|
|
required this.higherIsBetter,
|
|
|
|
this.fractionDigits});
|
2023-06-17 21:50:52 +00:00
|
|
|
|
|
|
|
String verdict(num greenSide, num redSide, int fraction) {
|
|
|
|
var f = NumberFormat("+#,###.##;-#,###.##");
|
|
|
|
f.maximumFractionDigits = fraction;
|
|
|
|
return f.format((greenSide - redSide));
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-07-15 16:22:25 +00:00
|
|
|
var f = NumberFormat.decimalPattern(LocaleSettings.currentLocale.languageCode);
|
2023-06-17 21:50:52 +00:00
|
|
|
f.maximumFractionDigits = fractionDigits ?? 0;
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: const [Colors.green, Colors.transparent],
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
stops: [
|
|
|
|
0.0,
|
|
|
|
higherIsBetter
|
|
|
|
? greenSide > redSide
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
: greenSide < redSide
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
child: Text(
|
|
|
|
f.format(greenSide),
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 22,
|
|
|
|
shadows: <Shadow>[
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 3.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 8.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
label,
|
|
|
|
style: const TextStyle(fontSize: 22),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
Text(
|
2023-06-19 20:42:37 +00:00
|
|
|
verdict(greenSide, redSide,
|
|
|
|
fractionDigits != null ? fractionDigits! + 2 : 0),
|
2023-06-17 21:50:52 +00:00
|
|
|
style: const TextStyle(fontSize: 16),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: const [Colors.red, Colors.transparent],
|
|
|
|
begin: Alignment.centerRight,
|
|
|
|
end: Alignment.centerLeft,
|
|
|
|
stops: [
|
|
|
|
0.0,
|
|
|
|
higherIsBetter
|
|
|
|
? redSide > greenSide
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
: redSide < greenSide
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
child: Text(
|
|
|
|
f.format(redSide),
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 22,
|
|
|
|
shadows: <Shadow>[
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 3.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 8.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class CompareBoolThingy extends StatelessWidget {
|
|
|
|
final bool greenSide;
|
|
|
|
final bool redSide;
|
|
|
|
final String label;
|
|
|
|
final bool trueIsBetter;
|
2023-06-19 20:42:37 +00:00
|
|
|
const CompareBoolThingy(
|
|
|
|
{super.key,
|
|
|
|
required this.greenSide,
|
|
|
|
required this.redSide,
|
|
|
|
required this.label,
|
|
|
|
required this.trueIsBetter});
|
2023-06-17 21:50:52 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
|
|
|
|
child: Row(children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: const [Colors.green, Colors.transparent],
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
stops: [
|
|
|
|
0.0,
|
|
|
|
trueIsBetter
|
|
|
|
? greenSide
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
: !greenSide
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
child: Text(
|
2023-07-14 20:21:49 +00:00
|
|
|
greenSide ? t.yes : t.no,
|
2023-06-17 21:50:52 +00:00
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 22,
|
|
|
|
shadows: <Shadow>[
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 3.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 8.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
label,
|
|
|
|
style: const TextStyle(fontSize: 22),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
const Text(
|
|
|
|
"---",
|
|
|
|
style: TextStyle(fontSize: 16),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: const [Colors.red, Colors.transparent],
|
|
|
|
begin: Alignment.centerRight,
|
|
|
|
end: Alignment.centerLeft,
|
|
|
|
stops: [
|
|
|
|
0.0,
|
|
|
|
trueIsBetter
|
|
|
|
? redSide
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
: !redSide
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
child: Text(
|
2023-07-14 20:21:49 +00:00
|
|
|
redSide ? t.yes : t.no,
|
2023-06-17 21:50:52 +00:00
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 22,
|
|
|
|
shadows: <Shadow>[
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 3.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 8.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class CompareDurationThingy extends StatelessWidget {
|
|
|
|
final Duration greenSide;
|
|
|
|
final Duration redSide;
|
|
|
|
final String label;
|
|
|
|
final bool higherIsBetter;
|
2023-06-19 20:42:37 +00:00
|
|
|
const CompareDurationThingy(
|
|
|
|
{super.key,
|
|
|
|
required this.greenSide,
|
|
|
|
required this.redSide,
|
|
|
|
required this.label,
|
|
|
|
required this.higherIsBetter});
|
2023-06-17 21:50:52 +00:00
|
|
|
|
|
|
|
Duration verdict(Duration greenSide, Duration redSide) {
|
|
|
|
return greenSide - redSide;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
greenSide.toString(),
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 22,
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
)),
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
label,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 22,
|
|
|
|
shadows: <Shadow>[
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 3.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 8.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
verdict(greenSide, redSide).toString(),
|
|
|
|
style: const TextStyle(fontSize: 16),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
redSide.toString(),
|
|
|
|
style: const TextStyle(fontSize: 22),
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class CompareRegTimeThingy extends StatelessWidget {
|
|
|
|
final DateTime? greenSide;
|
|
|
|
final DateTime? redSide;
|
|
|
|
final String label;
|
|
|
|
final int? fractionDigits;
|
2023-06-19 20:42:37 +00:00
|
|
|
const CompareRegTimeThingy(
|
|
|
|
{super.key,
|
|
|
|
required this.greenSide,
|
|
|
|
required this.redSide,
|
|
|
|
required this.label,
|
|
|
|
this.fractionDigits});
|
2023-06-17 21:50:52 +00:00
|
|
|
|
|
|
|
String verdict(DateTime? greenSide, DateTime? redSide) {
|
2023-07-14 20:21:49 +00:00
|
|
|
var f = NumberFormat("#,### ${t.daysLater};#,### ${t.dayseBefore}");
|
2023-06-17 21:50:52 +00:00
|
|
|
String result = "---";
|
2023-06-23 18:38:15 +00:00
|
|
|
if (greenSide != null && redSide != null) {
|
2023-06-19 20:42:37 +00:00
|
|
|
result = f.format(greenSide.difference(redSide).inDays);
|
2023-06-23 18:38:15 +00:00
|
|
|
}
|
2023-06-17 21:50:52 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-07-15 16:22:25 +00:00
|
|
|
DateFormat f = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode);
|
2023-06-17 21:50:52 +00:00
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: const [Colors.green, Colors.transparent],
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
end: Alignment.centerRight,
|
|
|
|
stops: [
|
|
|
|
0.0,
|
|
|
|
greenSide == null
|
|
|
|
? 0.6
|
|
|
|
: redSide != null && greenSide!.isBefore(redSide!)
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
child: Text(
|
2023-07-14 20:21:49 +00:00
|
|
|
greenSide != null ? f.format(greenSide!) : t.fromBeginning,
|
2023-06-17 21:50:52 +00:00
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 22,
|
|
|
|
shadows: <Shadow>[
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 3.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 8.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
label,
|
|
|
|
style: const TextStyle(fontSize: 22),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
verdict(greenSide, redSide),
|
|
|
|
style: const TextStyle(fontSize: 16),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: const [Colors.red, Colors.transparent],
|
|
|
|
begin: Alignment.centerRight,
|
|
|
|
end: Alignment.centerLeft,
|
|
|
|
stops: [
|
|
|
|
0.0,
|
|
|
|
redSide == null
|
|
|
|
? 0.6
|
|
|
|
: greenSide != null && redSide!.isBefore(greenSide!)
|
|
|
|
? 0.6
|
|
|
|
: 0
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
child: Text(
|
2023-07-14 20:21:49 +00:00
|
|
|
redSide != null ? f.format(redSide!) : t.fromBeginning,
|
2023-06-17 21:50:52 +00:00
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 22,
|
|
|
|
shadows: <Shadow>[
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 3.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Shadow(
|
|
|
|
offset: Offset(0.0, 0.0),
|
|
|
|
blurRadius: 8.0,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|