ok it's a table...???

This commit is contained in:
dan63047 2024-10-06 01:32:09 +03:00
parent 4df644f0f6
commit 52c0b67207
3 changed files with 313 additions and 75 deletions

View File

@ -50,6 +50,8 @@ ThemeData theme = ThemeData(
shadowColor: WidgetStatePropertyAll(Colors.cyanAccent.shade200),
)
),
dividerColor: Color.fromARGB(50, 158, 158, 158),
dividerTheme: DividerThemeData(color: Color.fromARGB(50, 158, 158, 158)),
scaffoldBackgroundColor: Colors.black
);

View File

@ -61,7 +61,7 @@ class CompareState extends State<CompareView> {
}
void getSummariesForInit() async {
summaries[0] = await teto.fetchSummaries(widget.initPlayer.userId);
summaries.add(await teto.fetchSummaries(widget.initPlayer.userId));
setState(() {
});
@ -98,7 +98,7 @@ class CompareState extends State<CompareView> {
return Scaffold(
floatingActionButtonLocation: FloatingActionButtonLocation.startTop,
floatingActionButton: Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(16.0),
child: FloatingActionButton(
onPressed: () => Navigator.pop(context),
tooltip: 'Fuck go back',
@ -106,71 +106,306 @@ class CompareState extends State<CompareView> {
),
),
body: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
child: Table(
defaultColumnWidth: FixedColumnWidth(350),
columnWidths: {
0: FixedColumnWidth(200.000)
},
children: [
TableRow(
children: [
Center(child: Text("player")),
for (var p in players) HeaderCard(p),
AddNewColumnCard(addPlayer)
]
),
TableRow(
children: [
Text("Account Created"),
for (var p in players) Text(timestamp(p.registrationTime!)),
Container()
]
),
TableRow(
children: [
Text("XP"),
for (var p in players) RichText(text: p.xp.isNegative ? TextSpan(text: "hidden", style: TextStyle(fontFamily: "Eurostile Round", color: Colors.grey)) : TextSpan(text: intf.format(p.xp), style: TextStyle(fontFamily: "Eurostile Round"), children: [TextSpan(text: " (lvl ${intf.format(p.level.floor())})", style: TextStyle(color: Colors.grey))])),
Container()
]
),
TableRow(
children: [
Text("Time Played"),
for (var p in players) Text(p.gameTime.isNegative ? "hidden" : playtime(p.gameTime), style: TextStyle(color: p.gameTime.isNegative ? Colors.grey : Colors.white)),
Container()
]
),
TableRow(
children: [
Text("Online Games Played"),
for (var p in players) Text(p.gamesPlayed.isNegative ? "hidden" : intf.format(p.gamesPlayed), style: TextStyle(color: p.gamesPlayed.isNegative ? Colors.grey : Colors.white)),
Container()
]
),
TableRow(
children: [
Text("Online Games Won"),
for (var p in players) Text(p.gamesWon.isNegative ? "hidden" : intf.format(p.gamesWon), style: TextStyle(color: p.gamesWon.isNegative ? Colors.grey : Colors.white)),
Container()
]
),
TableRow(
children: [
Text("Followers"),
for (var p in players) Text(intf.format(p.friendCount)),
Container()
]
),
],
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
SizedBox(
width: 200.0, height: 175.0, child: Expanded(child: Card(child: Padding(
padding: const EdgeInsets.fromLTRB(80.0, 10.0, 5.0, 0),
child: Text("Comparison", style: TextStyle(fontSize: 20)),
),
))
),
for (var p in players) SizedBox(width: 350.0, child: HeaderCard(p)),
SizedBox(width: 350.0, child: AddNewColumnCard(addPlayer))
]
),
Table(
border: TableBorder(verticalInside: BorderSide(color: Colors.grey)),
defaultColumnWidth: FixedColumnWidth(350),
columnWidths: {
0: FixedColumnWidth(200.000)
},
children: [
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Account Created")),
for (var p in players) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(timestamp(p.registrationTime!)))
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("XP")),
for (var p in players) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: RichText(text: p.xp.isNegative ? TextSpan(text: "hidden", style: TextStyle(fontFamily: "Eurostile Round", color: Colors.grey)) : TextSpan(text: intf.format(p.xp), style: TextStyle(fontFamily: "Eurostile Round"), children: [TextSpan(text: " (lvl ${intf.format(p.level.floor())})", style: TextStyle(color: Colors.grey))])))
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Time Played")),
for (var p in players) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(p.gameTime.isNegative ? "hidden" : playtime(p.gameTime), style: TextStyle(color: p.gameTime.isNegative ? Colors.grey : Colors.white)))
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Online Games Played")),
for (var p in players) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(p.gamesPlayed.isNegative ? "hidden" : intf.format(p.gamesPlayed), style: TextStyle(color: p.gamesPlayed.isNegative ? Colors.grey : Colors.white))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Online Games Won")),
for (var p in players) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(p.gamesWon.isNegative ? "hidden" : intf.format(p.gamesWon), style: TextStyle(color: p.gamesWon.isNegative ? Colors.grey : Colors.white))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Followers")),
for (var p in players) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(intf.format(p.friendCount))),
]
),
],
),
SizedBox(
width: 200+(summaries.length*350),
child: ExpansionTile(
title: Text("Tetra League"),
children: [
Table(
border: TableBorder(verticalInside: BorderSide(color: Colors.grey)),
defaultColumnWidth: FixedColumnWidth(350),
columnWidths: {
0: FixedColumnWidth(200.000)
},
children: [
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Tetra Rating")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.tr.isNegative ? "---" : f4.format(s.league.tr))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Glicko")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.glicko!.isNegative ? "---" : f4.format(s.league.glicko))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("RD")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.rd!.isNegative ? "---" : f4.format(s.league.rd))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("GLIXARE")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.gxe.isNegative ? "---" : f4.format(s.league.gxe))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("S1-like TR")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.s1tr.isNegative ? "---" : f4.format(s.league.s1tr))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Games Played")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(intf.format(s.league.gamesPlayed))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Games Won")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(intf.format(s.league.gamesWon))),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Winrate")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.winrate.isNaN ? "---" : f4.format(s.league.winrate*100)+"%")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Attack Per Minute")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.apm != null ? f2.format(s.league.apm) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Pieces Per Second")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.apm != null ? f2.format(s.league.pps) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Versus Score")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.apm != null ? f2.format(s.league.vs) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Nerd Stats")),
for (var _ in summaries) Container(),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Attack Per Piece")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.app) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("VS / APM")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.vsapm) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Downstack Per Second")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.dss) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Downstack Per Piece")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.dsp) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("APP + DSP")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.appdsp) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Cheese Index")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.cheese) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Garbage Efficiency")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.gbe) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Weighted APP")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.nyaapp) : "---")),
]
),
TableRow(
children: [
Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text("Area")),
for (var s in summaries) Container(padding: EdgeInsets.fromLTRB(16.0, 0, 16.0, 0), child: Text(s.league.nerdStats != null ? f4.format(s.league.nerdStats!.area) : "---")),
]
),
],
),
],
)
)
],
),
),
),
);
}
}
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// SizedBox(
// height: 175.0,
// width: 300.0,
// child: Expanded(
// child: Card(
// child: Padding(
// padding: const EdgeInsets.fromLTRB(80.0, 10.0, 5.0, 0),
// child: Text("Comparison", style: TextStyle(fontSize: 28)),
// ),
// ),
// ),
// ),
// for (var p in players) SizedBox(
// width: 300.0,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// HeaderCard(p),
// ],
// ),
// ),
// SizedBox(width: 300, child: AddNewColumnCard(addPlayer))
// ]
// ),
// Row(
// children: [
// SizedBox(
// width: 300.0,
// child: Card(
// child: Column(children: [
// Text("Registration Date"),
// const Divider(),
// Text("XP"),
// const Divider(),
// Text("Time Played"),
// const Divider(),
// Text("Online Games Played"),
// const Divider(),
// Text("Online Games Won"),
// const Divider(),
// Text("Followers"),
// ]),
// ),
// ),
// for (var p in players) SizedBox(
// width: 300.0,
// child: Card(
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Text(timestamp(p.registrationTime!)),
// const Divider(),
// RichText(text: p.xp.isNegative ? TextSpan(text: "hidden", style: TextStyle(fontFamily: "Eurostile Round", color: Colors.grey)) : TextSpan(text: intf.format(p.xp), style: TextStyle(fontFamily: "Eurostile Round"), children: [TextSpan(text: " (lvl ${intf.format(p.level.floor())})", style: TextStyle(color: Colors.grey))])),
// const Divider(),
// Text(p.gameTime.isNegative ? "hidden" : playtime(p.gameTime), style: TextStyle(color: p.gameTime.isNegative ? Colors.grey : Colors.white)),
// const Divider(),
// Text(p.gamesPlayed.isNegative ? "hidden" : intf.format(p.gamesPlayed), style: TextStyle(color: p.gamesPlayed.isNegative ? Colors.grey : Colors.white)),
// const Divider(),
// Text(p.gamesWon.isNegative ? "hidden" : intf.format(p.gamesWon), style: TextStyle(color: p.gamesWon.isNegative ? Colors.grey : Colors.white)),
// const Divider(),
// Text(intf.format(p.friendCount))
// ],
// ),
// ),
// ),
// ]
// ),
// SizedBox(
// width: 500,
// child: ExpansionTile(
// title: Text("Test"),
// children: [Text("test1"), Text("test2")],
// ),
// )
// ])
class HeaderCard extends StatelessWidget{
final TetrioPlayer player;
@ -196,9 +431,10 @@ class HeaderCard extends StatelessWidget{
if (player.bannerRevision != null) FadeInImage.memoryNetwork(image: kIsWeb ? "https://ts.dan63.by/oskware_bridge.php?endpoint=TetrioBanner&user=${player.userId}&rv=${player.bannerRevision}" : "https://tetr.io/user-content/banners/${player.userId}.jpg?rv=${player.bannerRevision}",
placeholder: kTransparentImage,
fit: BoxFit.cover,
height: 120,
height: 120.0,
fadeInCurve: Easing.standard, fadeInDuration: Durations.long4
),
)
else SizedBox(height: 120.0),
Positioned(
top: 20.0,
child: ClipRRect(

View File

@ -552,7 +552,7 @@ class _DestinationCalculatorState extends State<DestinationCalculator> {
},
),
));
rSideWidgets.add(const Divider(color: Color.fromARGB(50, 158, 158, 158)));
rSideWidgets.add(const Divider());
}
int combo = -1;
@ -1254,7 +1254,7 @@ class _DestinationLeaderboardsState extends State<DestinationLeaderboards> {
)
],
),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
Expanded(
child: ListView.builder(
controller: _scrollController,
@ -1906,9 +1906,9 @@ class LeagueCard extends StatelessWidget{
],
)
else Text("Tetra League", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
TLRatingThingy(userID: "", tlData: league, showPositions: true),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
Text("${league.apm != null ? f2.format(league.apm) : "-.--"} APM • ${league.pps != null ? f2.format(league.pps) : "-.--"} PPS • ${league.vs != null ? f2.format(league.vs) : "-.--"} VS • ${league.nerdStats != null ? f2.format(league.nerdStats!.app) : "-.--"} APP • ${league.nerdStats != null ? f2.format(league.nerdStats!.vsapm) : "-.--"} VS/APM", style: const TextStyle(color: Colors.grey))
],
),
@ -1962,9 +1962,9 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("40 Lines", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
RecordSummary(record: summaries.sprint, betterThanClosestAverage: sprintBetterThanClosestAverage, betterThanRankAverage: sprintBetterThanRankAverage, closestAverage: closestAverageSprint, rank: summaries.league.percentileRank),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
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))
],
),
@ -1979,9 +1979,9 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("Blitz", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
RecordSummary(record: summaries.blitz, betterThanClosestAverage: blitzBetterThanClosestAverage, betterThanRankAverage: blitzBetterThanRankAverage, closestAverage: closestAverageBlitz, rank: summaries.league.percentileRank),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
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))
],
),
@ -2001,9 +2001,9 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("QP", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
RecordSummary(record: summaries.zenith, hideRank: true),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
Text("Overall PB: ${(summaries.achievements.isNotEmpty && summaries.achievements.firstWhere((e) => e.k == 18).v != null) ? f2.format(summaries.achievements.firstWhere((e) => e.k == 18).v!) : "-.--"} m", style: const TextStyle(color: Colors.grey))
],
),
@ -2018,9 +2018,9 @@ class _DestinationHomeState extends State<DestinationHome> with SingleTickerProv
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("QP Expert", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
RecordSummary(record: summaries.zenithEx, hideRank: true,),
const Divider(color: Color.fromARGB(50, 158, 158, 158)),
const Divider(),
Text("Overall PB: ${(summaries.achievements.isNotEmpty && summaries.achievements.firstWhere((e) => e.k == 19).v != null) ? f2.format(summaries.achievements.firstWhere((e) => e.k == 19).v!) : "-.--"} m", style: const TextStyle(color: Colors.grey))
],
),