Experimental changes for tl_match_view

This commit is contained in:
dan63047 2024-03-03 01:26:31 +03:00
parent 0d2d83a98a
commit 49c5dfdf5a
5 changed files with 1179 additions and 919 deletions

View File

@ -68,72 +68,77 @@ class CalcState extends State<CalcView> {
), ),
backgroundColor: Colors.black, backgroundColor: Colors.black,
body: SafeArea( body: SafeArea(
child: NestedScrollView( child: Center(
controller: _scrollController, child: Container(
headerSliverBuilder: (context, value) { constraints: BoxConstraints(maxWidth: 768),
return [ child: NestedScrollView(
SliverToBoxAdapter( controller: _scrollController,
child: Padding( headerSliverBuilder: (context, value) {
padding: const EdgeInsets.fromLTRB(14, 16, 16, 32), return [
child: Row( SliverToBoxAdapter(
children: [ child: Padding(
Expanded( padding: const EdgeInsets.fromLTRB(14, 16, 16, 32),
child: Padding( child: Row(
padding: const EdgeInsets.only(right: 12), children: [
child: TextField( Expanded(
onSubmitted: (value) => calc(), child: Padding(
controller: apmController, padding: const EdgeInsets.only(right: 12),
keyboardType: TextInputType.number, child: TextField(
decoration: const InputDecoration(label: Text("APM"), alignLabelWithHint: true), onSubmitted: (value) => calc(),
), controller: apmController,
)), keyboardType: TextInputType.number,
Expanded( decoration: const InputDecoration(label: Text("APM"), alignLabelWithHint: true),
child: TextField( ),
onSubmitted: (value) => calc(), )),
controller: ppsController, Expanded(
keyboardType: TextInputType.number, child: TextField(
decoration: const InputDecoration(label: Text("PPS"), alignLabelWithHint: true), onSubmitted: (value) => calc(),
)), controller: ppsController,
Expanded( keyboardType: TextInputType.number,
child: Padding( decoration: const InputDecoration(label: Text("PPS"), alignLabelWithHint: true),
padding: const EdgeInsets.only(left: 12), )),
child: TextField( Expanded(
onSubmitted: (value) => calc(), child: Padding(
controller: vsController, padding: const EdgeInsets.only(left: 12),
keyboardType: TextInputType.number, child: TextField(
decoration: const InputDecoration(label: Text("VS"), alignLabelWithHint: true), onSubmitted: (value) => calc(),
), controller: vsController,
)), keyboardType: TextInputType.number,
TextButton( decoration: const InputDecoration(label: Text("VS"), alignLabelWithHint: true),
onPressed: () => calc(), ),
child: Text(t.calc), )),
TextButton(
onPressed: () => calc(),
child: Text(t.calc),
),
],
), ),
], ),
), ),
), const SliverToBoxAdapter(
), child: Divider(),
const SliverToBoxAdapter( )
child: Divider(), ];
) },
]; body: nerdStats == null
}, ? Text(t.calcViewNoValues)
body: nerdStats == null : ListView(
? Text(t.calcViewNoValues) children: [
: ListView( _ListEntry(value: nerdStats!.app, label: t.statCellNum.app.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3),
children: [ _ListEntry(value: nerdStats!.vsapm, label: "VS/APM", fractionDigits: 3),
_ListEntry(value: nerdStats!.app, label: t.statCellNum.app.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3), _ListEntry(value: nerdStats!.dss, label: t.statCellNum.dss.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3),
_ListEntry(value: nerdStats!.vsapm, label: "VS/APM", fractionDigits: 3), _ListEntry(value: nerdStats!.dsp, label: t.statCellNum.dsp.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3),
_ListEntry(value: nerdStats!.dss, label: t.statCellNum.dss.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3), _ListEntry(value: nerdStats!.appdsp, label: "APP + DS/P", fractionDigits: 3),
_ListEntry(value: nerdStats!.dsp, label: t.statCellNum.dsp.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3), _ListEntry(value: nerdStats!.cheese, label: t.statCellNum.cheese.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3),
_ListEntry(value: nerdStats!.appdsp, label: "APP + DS/P", fractionDigits: 3), _ListEntry(value: nerdStats!.gbe, label: t.statCellNum.gbe.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3),
_ListEntry(value: nerdStats!.cheese, label: t.statCellNum.cheese.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3), _ListEntry(value: nerdStats!.nyaapp, label: t.statCellNum.nyaapp.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3),
_ListEntry(value: nerdStats!.gbe, label: t.statCellNum.gbe.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3), _ListEntry(value: nerdStats!.area, label: t.statCellNum.area.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3),
_ListEntry(value: nerdStats!.nyaapp, label: t.statCellNum.nyaapp.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3), _ListEntry(value: estTr!.esttr, label: t.statCellNum.estOfTR, fractionDigits: 3),
_ListEntry(value: nerdStats!.area, label: t.statCellNum.area.replaceAll(RegExp(r'\n'), " "), fractionDigits: 3), Graphs(apm!, pps!, vs!, nerdStats!, playstyle!),
_ListEntry(value: estTr!.esttr, label: t.statCellNum.estOfTR, fractionDigits: 3), ],
Graphs(apm!, pps!, vs!, nerdStats!, playstyle!), )),
], ),
)), ),
), ),
); );
} }

View File

@ -256,443 +256,453 @@ class CompareState extends State<CompareView> {
appBar: AppBar(title: Text("$titleGreenSide ${t.vs} $titleRedSide")), appBar: AppBar(title: Text("$titleGreenSide ${t.vs} $titleRedSide")),
backgroundColor: Colors.black, backgroundColor: Colors.black,
body: SafeArea( body: SafeArea(
child: NestedScrollView( child: Center(
controller: _scrollController, child: Container(
headerSliverBuilder: (context, value) { constraints: BoxConstraints(maxWidth: 768),
return [ child: NestedScrollView(
SliverToBoxAdapter( controller: _scrollController,
child: Padding( headerSliverBuilder: (context, value) {
padding: const EdgeInsets.fromLTRB(16, 16, 16, 32), return [
child: Row( SliverToBoxAdapter(
mainAxisAlignment: MainAxisAlignment.spaceBetween, child: Padding(
crossAxisAlignment: CrossAxisAlignment.start, padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
children: [ child: Row(
Expanded( mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Container( crossAxisAlignment: CrossAxisAlignment.start,
decoration: const BoxDecoration( children: [
gradient: LinearGradient( Expanded(
colors: [Colors.green, Colors.transparent], child: Container(
begin: Alignment.bottomCenter, decoration: const BoxDecoration(
end: Alignment.topCenter, gradient: LinearGradient(
stops: [0.0, 0.4], colors: [Colors.green, Colors.transparent],
)), begin: Alignment.bottomCenter,
child: Padding( end: Alignment.topCenter,
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0), stops: [0.0, 0.4],
child: PlayerSelector( )),
data: theGreenSide, child: Padding(
mode: greenSideMode, padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
fetch: fetchGreenSide, child: PlayerSelector(
change: changeGreenSide, data: theGreenSide,
updateState: _justUpdate, mode: greenSideMode,
fetch: fetchGreenSide,
change: changeGreenSide,
updateState: _justUpdate,
),
),
), ),
), ),
), const Padding(
), padding: EdgeInsets.only(top: 16),
const Padding( child: Text("VS"),
padding: EdgeInsets.only(top: 16), ),
child: Text("VS"), Expanded(
), child: Container(
Expanded( decoration: const BoxDecoration(
child: Container( gradient: LinearGradient(
decoration: const BoxDecoration( colors: [Colors.red, Colors.transparent],
gradient: LinearGradient( begin: Alignment.bottomCenter,
colors: [Colors.red, Colors.transparent], end: Alignment.topCenter,
begin: Alignment.bottomCenter, stops: [0.0, 0.4],
end: Alignment.topCenter, )),
stops: [0.0, 0.4], child: Padding(
)), padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: Padding( child: PlayerSelector(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0), data: theRedSide,
child: PlayerSelector( mode: redSideMode,
data: theRedSide, fetch: fetchRedSide,
mode: redSideMode, change: changeRedSide,
fetch: fetchRedSide, updateState: _justUpdate,
change: changeRedSide, ),
updateState: _justUpdate, ),
), ),
), ),
), ],
), ),
], ),
), ),
const SliverToBoxAdapter(
child: Divider(),
)
];
},
body: Center(
child: Container(
constraints: BoxConstraints(maxWidth: 768),
child: 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")
Column(
children: [
CompareRegTimeThingy(
greenSide: theGreenSide[0].registrationTime,
redSide: theRedSide[0].registrationTime,
label: t.registred),
CompareThingy(
label: t.statCellNum.level,
greenSide: theGreenSide[0].level,
redSide: theRedSide[0].level,
higherIsBetter: true,
fractionDigits: 2,
),
if (!theGreenSide[0].gameTime.isNegative &&
!theRedSide[0].gameTime.isNegative)
CompareThingy(
greenSide: theGreenSide[0].gameTime.inMicroseconds /
1000000 /
60 /
60,
redSide: theRedSide[0].gameTime.inMicroseconds /
1000000 /
60 /
60,
label: t.statCellNum.hoursPlayed.replaceAll(RegExp(r'\n'), " "),
higherIsBetter: true,
fractionDigits: 2,
),
if (theGreenSide[0].gamesPlayed >= 0 &&
theRedSide[0].gamesPlayed >= 0)
CompareThingy(
label: t.statCellNum.onlineGames.replaceAll(RegExp(r'\n'), " "),
greenSide: theGreenSide[0].gamesPlayed,
redSide: theRedSide[0].gamesPlayed,
higherIsBetter: true,
),
if (theGreenSide[0].gamesWon >= 0 &&
theRedSide[0].gamesWon >= 0)
CompareThingy(
label: t.statCellNum.gamesWon.replaceAll(RegExp(r'\n'), " "),
greenSide: theGreenSide[0].gamesWon,
redSide: theRedSide[0].gamesWon,
higherIsBetter: true,
),
CompareThingy(
label: t.statCellNum.friends,
greenSide: theGreenSide[0].friendCount,
redSide: theRedSide[0].friendCount,
higherIsBetter: true,
),
const Divider(),
],
),
if (theGreenSide[0] != null &&
theRedSide[0] != null &&
(theGreenSide[0]!.role == "banned" ||
theRedSide[0]!.role == "banned"))
CompareBoolThingy(
greenSide: theGreenSide[0].role == "banned",
redSide: theRedSide[0].role == "banned",
label: t.normalBanned,
trueIsBetter: false),
(theGreenSide[2].gamesPlayed > 0 || greenSideMode == Mode.stats) &&
(theRedSide[2].gamesPlayed > 0 || redSideMode == Mode.stats)
? Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(t.tetraLeague,
style: TextStyle(
fontFamily: "Eurostile Round Extended",
fontSize: bigScreen ? 42 : 28)),
),
if (theGreenSide[2].gamesPlayed > 9 &&
theRedSide[2].gamesPlayed > 9 &&
greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: "TR",
greenSide: theGreenSide[2].rating,
redSide: theRedSide[2].rating,
fractionDigits: 2,
higherIsBetter: true,
),
if (greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: t.statCellNum.gamesPlayed.replaceAll(RegExp(r'\n'), " "),
greenSide: theGreenSide[2].gamesPlayed,
redSide: theRedSide[2].gamesPlayed,
higherIsBetter: true,
),
if (greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: t.statCellNum.gamesWonTL.replaceAll(RegExp(r'\n'), " "),
greenSide: theGreenSide[2].gamesWon,
redSide: theRedSide[2].gamesWon,
higherIsBetter: true,
),
if (greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: "WR %",
greenSide:
theGreenSide[2].winrate * 100,
redSide: theRedSide[2].winrate * 100,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].gamesPlayed > 9 &&
theRedSide[2].gamesPlayed > 9 &&
greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: "Glicko",
greenSide: theGreenSide[2].glicko!,
redSide: theRedSide[2].glicko!,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].gamesPlayed > 9 &&
theRedSide[2].gamesPlayed > 9 &&
greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: "RD",
greenSide: theGreenSide[2].rd!,
redSide: theRedSide[2].rd!,
fractionDigits: 3,
higherIsBetter: false,
),
if (theGreenSide[2].standing > 0 &&
theRedSide[2].standing > 0 &&
greenSideMode == Mode.player &&
redSideMode == Mode.player)
CompareThingy(
label: t.statCellNum.lbpShort,
greenSide: theGreenSide[2].standing,
redSide: theRedSide[2].standing,
higherIsBetter: false,
),
if (theGreenSide[2].standingLocal > 0 &&
theRedSide[2].standingLocal > 0 &&
greenSideMode == Mode.player &&
redSideMode == Mode.player)
CompareThingy(
label: t.statCellNum.lbpcShort,
greenSide:
theGreenSide[2].standingLocal,
redSide: theRedSide[2].standingLocal,
higherIsBetter: false,
),
if (theGreenSide[2].apm != null &&
theRedSide[2].apm != null)
CompareThingy(
label: "APM",
greenSide: theGreenSide[2].apm!,
redSide: theRedSide[2].apm!,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].pps != null &&
theRedSide[2].pps != null)
CompareThingy(
label: "PPS",
greenSide: theGreenSide[2].pps!,
redSide: theRedSide[2].pps!,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].vs != null &&
theRedSide[2].vs != null)
CompareThingy(
label: "VS",
greenSide: theGreenSide[2].vs!,
redSide: theRedSide[2].vs!,
fractionDigits: 2,
higherIsBetter: true,
),
],
)
: CompareBoolThingy(
greenSide: theGreenSide[2].gamesPlayed > 0,
redSide: theRedSide[2].gamesPlayed > 0,
label: t.playedTL,
trueIsBetter: false),
const Divider(),
if (theGreenSide[2].nerdStats != null &&
theRedSide[2].nerdStats != null)
Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(t.nerdStats,
style: TextStyle(
fontFamily: "Eurostile Round Extended",
fontSize: bigScreen ? 42 : 28)),
),
CompareThingy(
label: "APP",
greenSide: theGreenSide[2].nerdStats!.app,
redSide: theRedSide[2].nerdStats!.app,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "VS/APM",
greenSide: theGreenSide[2].nerdStats!.vsapm,
redSide: theRedSide[2].nerdStats!.vsapm,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "DS/S",
greenSide: theGreenSide[2].nerdStats!.dss,
redSide: theRedSide[2].nerdStats!.dss,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "DS/P",
greenSide: theGreenSide[2].nerdStats!.dsp,
redSide: theRedSide[2].nerdStats!.dsp,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "APP + DS/P",
greenSide:
theGreenSide[2].nerdStats!.appdsp,
redSide: theRedSide[2].nerdStats!.appdsp,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: t.statCellNum.cheese.replaceAll(RegExp(r'\n'), " "),
greenSide:
theGreenSide[2].nerdStats!.cheese,
redSide: theRedSide[2].nerdStats!.cheese,
fractionDigits: 2,
higherIsBetter: true,
),
CompareThingy(
label: "Gb Eff.",
greenSide: theGreenSide[2].nerdStats!.gbe,
redSide: theRedSide[2].nerdStats!.gbe,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "wAPP",
greenSide:
theGreenSide[2].nerdStats!.nyaapp,
redSide: theRedSide[2].nerdStats!.nyaapp,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "Area",
greenSide: theGreenSide[2].nerdStats!.area,
redSide: theRedSide[2].nerdStats!.area,
fractionDigits: 2,
higherIsBetter: true,
),
CompareThingy(
label: t.statCellNum.estOfTRShort,
greenSide: theGreenSide[2].estTr!.esttr,
redSide: theRedSide[2].estTr!.esttr,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].gamesPlayed > 9 &&
theGreenSide[2].gamesPlayed > 9 &&
greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: t.statCellNum.accOfEstShort,
greenSide: theGreenSide[2].esttracc!,
redSide: theRedSide[2].esttracc!,
fractionDigits: 2,
higherIsBetter: true,
),
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,
),
VsGraphs(theGreenSide[2].apm!, theGreenSide[2].pps!, theGreenSide[2].vs!, theGreenSide[2].nerdStats!, theGreenSide[2].playstyle!, theRedSide[2].apm!, theRedSide[2].pps!, theRedSide[2].vs!, theRedSide[2].nerdStats!, theRedSide[2].playstyle!),
const Divider(),
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(t.winChance,
style: TextStyle(
fontFamily: "Eurostile Round Extended",
fontSize: bigScreen ? 42 : 28)),
),
if (greenSideMode != Mode.stats && redSideMode != Mode.stats &&
theGreenSide[2].gamesPlayed > 9 && theRedSide[2].gamesPlayed > 9)
CompareThingy(
label: t.byGlicko,
greenSide: getWinrateByTR(
theGreenSide[2].glicko!,
theGreenSide[2].rd!,
theRedSide[2].glicko!,
theRedSide[2].rd!) *
100,
redSide: getWinrateByTR(
theRedSide[2].glicko!,
theRedSide[2].rd!,
theGreenSide[2].glicko!,
theGreenSide[2].rd!) *
100,
fractionDigits: 2,
higherIsBetter: true,
postfix: "%",
),
CompareThingy(
label: t.byEstTR,
greenSide: getWinrateByTR(
theGreenSide[2].estTr!.estglicko,
theGreenSide[2].rd ?? noTrRd,
theRedSide[2].estTr!.estglicko,
theRedSide[2].rd ?? noTrRd) *
100,
redSide: getWinrateByTR(
theRedSide[2].estTr!.estglicko,
theRedSide[2].rd ?? noTrRd,
theGreenSide[2].estTr!.estglicko,
theGreenSide[2].rd ?? noTrRd) *
100,
fractionDigits: 2,
higherIsBetter: true,
postfix: "%",
),
],
)
] : [Padding(
padding: const EdgeInsets.all(8.0),
child: Text(t.compareViewNoValues(avgR: "\$avgR"), textAlign: TextAlign.center),
)], // This is so fucked up holy shit
),
), ),
),
const SliverToBoxAdapter(
child: Divider(),
) )
]; ),
}, ),
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")
Column(
children: [
CompareRegTimeThingy(
greenSide: theGreenSide[0].registrationTime,
redSide: theRedSide[0].registrationTime,
label: t.registred),
CompareThingy(
label: t.statCellNum.level,
greenSide: theGreenSide[0].level,
redSide: theRedSide[0].level,
higherIsBetter: true,
fractionDigits: 2,
),
if (!theGreenSide[0].gameTime.isNegative &&
!theRedSide[0].gameTime.isNegative)
CompareThingy(
greenSide: theGreenSide[0].gameTime.inMicroseconds /
1000000 /
60 /
60,
redSide: theRedSide[0].gameTime.inMicroseconds /
1000000 /
60 /
60,
label: t.statCellNum.hoursPlayed.replaceAll(RegExp(r'\n'), " "),
higherIsBetter: true,
fractionDigits: 2,
),
if (theGreenSide[0].gamesPlayed >= 0 &&
theRedSide[0].gamesPlayed >= 0)
CompareThingy(
label: t.statCellNum.onlineGames.replaceAll(RegExp(r'\n'), " "),
greenSide: theGreenSide[0].gamesPlayed,
redSide: theRedSide[0].gamesPlayed,
higherIsBetter: true,
),
if (theGreenSide[0].gamesWon >= 0 &&
theRedSide[0].gamesWon >= 0)
CompareThingy(
label: t.statCellNum.gamesWon.replaceAll(RegExp(r'\n'), " "),
greenSide: theGreenSide[0].gamesWon,
redSide: theRedSide[0].gamesWon,
higherIsBetter: true,
),
CompareThingy(
label: t.statCellNum.friends,
greenSide: theGreenSide[0].friendCount,
redSide: theRedSide[0].friendCount,
higherIsBetter: true,
),
const Divider(),
],
),
if (theGreenSide[0] != null &&
theRedSide[0] != null &&
(theGreenSide[0]!.role == "banned" ||
theRedSide[0]!.role == "banned"))
CompareBoolThingy(
greenSide: theGreenSide[0].role == "banned",
redSide: theRedSide[0].role == "banned",
label: t.normalBanned,
trueIsBetter: false),
(theGreenSide[2].gamesPlayed > 0 || greenSideMode == Mode.stats) &&
(theRedSide[2].gamesPlayed > 0 || redSideMode == Mode.stats)
? Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(t.tetraLeague,
style: TextStyle(
fontFamily: "Eurostile Round Extended",
fontSize: bigScreen ? 42 : 28)),
),
if (theGreenSide[2].gamesPlayed > 9 &&
theRedSide[2].gamesPlayed > 9 &&
greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: "TR",
greenSide: theGreenSide[2].rating,
redSide: theRedSide[2].rating,
fractionDigits: 2,
higherIsBetter: true,
),
if (greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: t.statCellNum.gamesPlayed.replaceAll(RegExp(r'\n'), " "),
greenSide: theGreenSide[2].gamesPlayed,
redSide: theRedSide[2].gamesPlayed,
higherIsBetter: true,
),
if (greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: t.statCellNum.gamesWonTL.replaceAll(RegExp(r'\n'), " "),
greenSide: theGreenSide[2].gamesWon,
redSide: theRedSide[2].gamesWon,
higherIsBetter: true,
),
if (greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: "WR %",
greenSide:
theGreenSide[2].winrate * 100,
redSide: theRedSide[2].winrate * 100,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].gamesPlayed > 9 &&
theRedSide[2].gamesPlayed > 9 &&
greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: "Glicko",
greenSide: theGreenSide[2].glicko!,
redSide: theRedSide[2].glicko!,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].gamesPlayed > 9 &&
theRedSide[2].gamesPlayed > 9 &&
greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: "RD",
greenSide: theGreenSide[2].rd!,
redSide: theRedSide[2].rd!,
fractionDigits: 3,
higherIsBetter: false,
),
if (theGreenSide[2].standing > 0 &&
theRedSide[2].standing > 0 &&
greenSideMode == Mode.player &&
redSideMode == Mode.player)
CompareThingy(
label: t.statCellNum.lbpShort,
greenSide: theGreenSide[2].standing,
redSide: theRedSide[2].standing,
higherIsBetter: false,
),
if (theGreenSide[2].standingLocal > 0 &&
theRedSide[2].standingLocal > 0 &&
greenSideMode == Mode.player &&
redSideMode == Mode.player)
CompareThingy(
label: t.statCellNum.lbpcShort,
greenSide:
theGreenSide[2].standingLocal,
redSide: theRedSide[2].standingLocal,
higherIsBetter: false,
),
if (theGreenSide[2].apm != null &&
theRedSide[2].apm != null)
CompareThingy(
label: "APM",
greenSide: theGreenSide[2].apm!,
redSide: theRedSide[2].apm!,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].pps != null &&
theRedSide[2].pps != null)
CompareThingy(
label: "PPS",
greenSide: theGreenSide[2].pps!,
redSide: theRedSide[2].pps!,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].vs != null &&
theRedSide[2].vs != null)
CompareThingy(
label: "VS",
greenSide: theGreenSide[2].vs!,
redSide: theRedSide[2].vs!,
fractionDigits: 2,
higherIsBetter: true,
),
],
)
: CompareBoolThingy(
greenSide: theGreenSide[2].gamesPlayed > 0,
redSide: theRedSide[2].gamesPlayed > 0,
label: t.playedTL,
trueIsBetter: false),
const Divider(),
if (theGreenSide[2].nerdStats != null &&
theRedSide[2].nerdStats != null)
Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(t.nerdStats,
style: TextStyle(
fontFamily: "Eurostile Round Extended",
fontSize: bigScreen ? 42 : 28)),
),
CompareThingy(
label: "APP",
greenSide: theGreenSide[2].nerdStats!.app,
redSide: theRedSide[2].nerdStats!.app,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "VS/APM",
greenSide: theGreenSide[2].nerdStats!.vsapm,
redSide: theRedSide[2].nerdStats!.vsapm,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "DS/S",
greenSide: theGreenSide[2].nerdStats!.dss,
redSide: theRedSide[2].nerdStats!.dss,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "DS/P",
greenSide: theGreenSide[2].nerdStats!.dsp,
redSide: theRedSide[2].nerdStats!.dsp,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "APP + DS/P",
greenSide:
theGreenSide[2].nerdStats!.appdsp,
redSide: theRedSide[2].nerdStats!.appdsp,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: t.statCellNum.cheese.replaceAll(RegExp(r'\n'), " "),
greenSide:
theGreenSide[2].nerdStats!.cheese,
redSide: theRedSide[2].nerdStats!.cheese,
fractionDigits: 2,
higherIsBetter: true,
),
CompareThingy(
label: "Gb Eff.",
greenSide: theGreenSide[2].nerdStats!.gbe,
redSide: theRedSide[2].nerdStats!.gbe,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "wAPP",
greenSide:
theGreenSide[2].nerdStats!.nyaapp,
redSide: theRedSide[2].nerdStats!.nyaapp,
fractionDigits: 3,
higherIsBetter: true,
),
CompareThingy(
label: "Area",
greenSide: theGreenSide[2].nerdStats!.area,
redSide: theRedSide[2].nerdStats!.area,
fractionDigits: 2,
higherIsBetter: true,
),
CompareThingy(
label: t.statCellNum.estOfTRShort,
greenSide: theGreenSide[2].estTr!.esttr,
redSide: theRedSide[2].estTr!.esttr,
fractionDigits: 2,
higherIsBetter: true,
),
if (theGreenSide[2].gamesPlayed > 9 &&
theGreenSide[2].gamesPlayed > 9 &&
greenSideMode != Mode.stats &&
redSideMode != Mode.stats)
CompareThingy(
label: t.statCellNum.accOfEstShort,
greenSide: theGreenSide[2].esttracc!,
redSide: theRedSide[2].esttracc!,
fractionDigits: 2,
higherIsBetter: true,
),
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,
),
VsGraphs(theGreenSide[2].apm!, theGreenSide[2].pps!, theGreenSide[2].vs!, theGreenSide[2].nerdStats!, theGreenSide[2].playstyle!, theRedSide[2].apm!, theRedSide[2].pps!, theRedSide[2].vs!, theRedSide[2].nerdStats!, theRedSide[2].playstyle!),
const Divider(),
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(t.winChance,
style: TextStyle(
fontFamily: "Eurostile Round Extended",
fontSize: bigScreen ? 42 : 28)),
),
if (greenSideMode != Mode.stats && redSideMode != Mode.stats &&
theGreenSide[2].gamesPlayed > 9 && theRedSide[2].gamesPlayed > 9)
CompareThingy(
label: t.byGlicko,
greenSide: getWinrateByTR(
theGreenSide[2].glicko!,
theGreenSide[2].rd!,
theRedSide[2].glicko!,
theRedSide[2].rd!) *
100,
redSide: getWinrateByTR(
theRedSide[2].glicko!,
theRedSide[2].rd!,
theGreenSide[2].glicko!,
theGreenSide[2].rd!) *
100,
fractionDigits: 2,
higherIsBetter: true,
postfix: "%",
),
CompareThingy(
label: t.byEstTR,
greenSide: getWinrateByTR(
theGreenSide[2].estTr!.estglicko,
theGreenSide[2].rd ?? noTrRd,
theRedSide[2].estTr!.estglicko,
theRedSide[2].rd ?? noTrRd) *
100,
redSide: getWinrateByTR(
theRedSide[2].estTr!.estglicko,
theRedSide[2].rd ?? noTrRd,
theGreenSide[2].estTr!.estglicko,
theGreenSide[2].rd ?? noTrRd) *
100,
fractionDigits: 2,
higherIsBetter: true,
postfix: "%",
),
],
)
] : [Padding(
padding: const EdgeInsets.all(8.0),
child: Text(t.compareViewNoValues(avgR: "\$avgR"), textAlign: TextAlign.center),
)], // This is so fucked up holy shit
)
), ),
), ),
); );
@ -786,6 +796,8 @@ class PlayerSelector extends StatelessWidget {
} }
} }
const TextStyle verdictStyle = TextStyle(fontSize: 14, fontFamily: "Eurostile Round Condensed", color: Colors.grey, height: 1.1);
class CompareThingy extends StatelessWidget { class CompareThingy extends StatelessWidget {
final num greenSide; final num greenSide;
final num redSide; final num redSide;
@ -868,7 +880,7 @@ class CompareThingy extends StatelessWidget {
Text( Text(
verdict(greenSide, redSide, verdict(greenSide, redSide,
fractionDigits != null ? fractionDigits! + 2 : 0), fractionDigits != null ? fractionDigits! + 2 : 0),
style: const TextStyle(fontSize: 16), style: verdictStyle,
textAlign: TextAlign.center, textAlign: TextAlign.center,
) )
], ],
@ -981,11 +993,7 @@ class CompareBoolThingy extends StatelessWidget {
style: const TextStyle(fontSize: 22), style: const TextStyle(fontSize: 22),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
const Text( const Text("---", style: verdictStyle, textAlign: TextAlign.center)
"---",
style: TextStyle(fontSize: 16),
textAlign: TextAlign.center,
)
], ],
), ),
Expanded( Expanded(
@ -1085,10 +1093,7 @@ class CompareDurationThingy extends StatelessWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
Text( Text(
verdict(greenSide, redSide).toString(), verdict(greenSide, redSide).toString(), style: verdictStyle, textAlign: TextAlign.center)
style: const TextStyle(fontSize: 16),
textAlign: TextAlign.center,
)
], ],
), ),
Expanded( Expanded(
@ -1176,11 +1181,7 @@ class CompareRegTimeThingy extends StatelessWidget {
style: const TextStyle(fontSize: 22), style: const TextStyle(fontSize: 22),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
Text( Text(verdict(greenSide, redSide), style: verdictStyle, textAlign: TextAlign.center)
verdict(greenSide, redSide),
style: const TextStyle(fontSize: 16),
textAlign: TextAlign.center,
)
], ],
), ),
Expanded( Expanded(

View File

@ -20,6 +20,7 @@ import 'package:tetra_stats/utils/text_shadow.dart';
import 'package:tetra_stats/views/ranks_averages_view.dart' show RankAveragesView; import 'package:tetra_stats/views/ranks_averages_view.dart' show RankAveragesView;
import 'package:tetra_stats/views/tl_leaderboard_view.dart' show TLLeaderboardView; import 'package:tetra_stats/views/tl_leaderboard_view.dart' show TLLeaderboardView;
import 'package:tetra_stats/views/tl_match_view.dart' show TlMatchResultView; import 'package:tetra_stats/views/tl_match_view.dart' show TlMatchResultView;
import 'package:tetra_stats/widgets/list_tile_trailing_stats.dart';
import 'package:tetra_stats/widgets/search_box.dart'; import 'package:tetra_stats/widgets/search_box.dart';
import 'package:tetra_stats/widgets/stat_sell_num.dart'; import 'package:tetra_stats/widgets/stat_sell_num.dart';
import 'package:tetra_stats/widgets/tl_thingy.dart'; import 'package:tetra_stats/widgets/tl_thingy.dart';
@ -582,18 +583,14 @@ class _TLRecords extends StatelessWidget {
style: bigScreen ? const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, shadows: textShadow) : const TextStyle(fontSize: 28, shadows: textShadow)), style: bigScreen ? const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, shadows: textShadow) : const TextStyle(fontSize: 28, shadows: textShadow)),
title: Text("vs. ${data[index].endContext.firstWhere((element) => element.userId != userID).username}"), title: Text("vs. ${data[index].endContext.firstWhere((element) => element.userId != userID).username}"),
subtitle: Text(_dateFormat.format(data[index].timestamp)), subtitle: Text(_dateFormat.format(data[index].timestamp)),
trailing: Table(defaultColumnWidth: const IntrinsicColumnWidth(), trailing: TrailingStats(
defaultVerticalAlignment: TableCellVerticalAlignment.baseline, data[index].endContext.firstWhere((element) => element.userId == userID).secondary,
textBaseline: TextBaseline.alphabetic, data[index].endContext.firstWhere((element) => element.userId == userID).tertiary,
columnWidths: const { data[index].endContext.firstWhere((element) => element.userId == userID).extra,
0: FixedColumnWidth(50), data[index].endContext.firstWhere((element) => element.userId != userID).secondary,
2: FixedColumnWidth(50), data[index].endContext.firstWhere((element) => element.userId != userID).tertiary,
}, data[index].endContext.firstWhere((element) => element.userId != userID).extra
children: [ ),
TableRow(children: [Text(_f2.format(data[index].endContext.firstWhere((element) => element.userId == userID).secondary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(_f2.format(data[index].endContext.firstWhere((element) => element.userId != userID).secondary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" APM", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]),
TableRow(children: [Text(_f2.format(data[index].endContext.firstWhere((element) => element.userId == userID).tertiary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(_f2.format(data[index].endContext.firstWhere((element) => element.userId != userID).tertiary), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" PPS", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]),
TableRow(children: [Text(_f2.format(data[index].endContext.firstWhere((element) => element.userId == userID).extra), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(_f2.format(data[index].endContext.firstWhere((element) => element.userId != userID).extra), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" VS", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]),
],),
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => TlMatchResultView(record: data[index], initPlayerId: userID))), onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => TlMatchResultView(record: data[index], initPlayerId: userID))),
), ),
); );

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:tetra_stats/gen/strings.g.dart';
class TrailingStats extends StatelessWidget{
final double yourAPM;
final double yourPPS;
final double yourVS;
final double notyourAPM;
final double notyourPPS;
final double notyourVS;
const TrailingStats(this.yourAPM, this.yourPPS, this.yourVS, this.notyourAPM, this.notyourPPS, this.notyourVS, {super.key});
@override
Widget build(BuildContext context) {
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
return Table(
defaultColumnWidth: const IntrinsicColumnWidth(),
defaultVerticalAlignment: TableCellVerticalAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
columnWidths: const {
0: FixedColumnWidth(42),
2: FixedColumnWidth(42),
},
children: [
TableRow(children: [Text(f2.format(yourAPM), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(f2.format(notyourAPM), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" APM", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]),
TableRow(children: [Text(f2.format(yourPPS), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(f2.format(notyourPPS), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" PPS", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]),
TableRow(children: [Text(f2.format(yourVS), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" :", style: TextStyle(height: 1.1)), Text(f2.format(notyourVS), textAlign: TextAlign.right, style: const TextStyle(height: 1.1)), const Text(" VS", textAlign: TextAlign.right, style: TextStyle(height: 1.1))]),
],
);
}
}