2023-05-06 21:14:12 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-06-06 21:04:49 +00:00
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'dart:developer' as developer;
|
|
|
|
import 'package:flutter/services.dart';
|
2023-05-07 17:58:01 +00:00
|
|
|
import 'package:tetra_stats/data_objects/tetrio.dart';
|
2023-05-16 20:07:18 +00:00
|
|
|
import 'package:tetra_stats/services/tetrio_crud.dart';
|
2023-06-10 21:56:14 +00:00
|
|
|
import 'package:tetra_stats/services/crud_exceptions.dart';
|
|
|
|
import 'package:tetra_stats/widgets/stat_sell_num.dart';
|
|
|
|
import 'package:tetra_stats/widgets/tl_thingy.dart';
|
|
|
|
import 'package:tetra_stats/widgets/user_thingy.dart';
|
2023-05-30 20:37:10 +00:00
|
|
|
|
2023-06-03 14:56:08 +00:00
|
|
|
String _searchFor = "dan63047";
|
2023-06-04 15:10:20 +00:00
|
|
|
Future<TetrioPlayer>? me;
|
2023-06-08 16:47:33 +00:00
|
|
|
final TetrioService teto = TetrioService();
|
2023-06-06 21:04:49 +00:00
|
|
|
late SharedPreferences prefs;
|
2023-05-29 19:10:14 +00:00
|
|
|
const allowedHeightForPlayerIdInPixels = 40.0;
|
2023-05-25 19:21:56 +00:00
|
|
|
const allowedHeightForPlayerBioInPixels = 30.0;
|
|
|
|
const givenTextHeightByScreenPercentage = 0.3;
|
|
|
|
|
2023-05-07 17:58:01 +00:00
|
|
|
class MainView extends StatefulWidget {
|
|
|
|
const MainView({Key? key}) : super(key: key);
|
2023-05-06 21:14:12 +00:00
|
|
|
|
2023-05-29 19:10:14 +00:00
|
|
|
String get title => "Tetra Stats: $_searchFor";
|
|
|
|
|
2023-05-07 17:58:01 +00:00
|
|
|
@override
|
2023-06-05 22:21:29 +00:00
|
|
|
State<MainView> createState() => _MainState();
|
2023-05-07 17:58:01 +00:00
|
|
|
}
|
|
|
|
|
2023-06-06 21:04:49 +00:00
|
|
|
Future<void> copyToClipboard(String text) async {
|
|
|
|
await Clipboard.setData(ClipboardData(text: text));
|
|
|
|
}
|
|
|
|
|
2023-06-05 22:21:29 +00:00
|
|
|
class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
2023-06-03 14:56:08 +00:00
|
|
|
final bodyGlobalKey = GlobalKey();
|
|
|
|
final List<Widget> myTabs = [
|
2023-06-03 19:10:28 +00:00
|
|
|
const Tab(text: "Tetra League"),
|
|
|
|
const Tab(text: "40 Lines"),
|
|
|
|
const Tab(text: "Blitz"),
|
|
|
|
const Tab(text: "Other"),
|
2023-06-03 14:56:08 +00:00
|
|
|
];
|
2023-05-29 19:10:14 +00:00
|
|
|
bool _searchBoolean = false;
|
2023-06-03 14:56:08 +00:00
|
|
|
late TabController _tabController;
|
|
|
|
late ScrollController _scrollController;
|
|
|
|
late bool fixedScroll;
|
2023-05-29 19:10:14 +00:00
|
|
|
|
|
|
|
Widget _searchTextField() {
|
|
|
|
return TextField(
|
2023-06-03 19:10:28 +00:00
|
|
|
maxLength: 25,
|
2023-06-11 21:56:15 +00:00
|
|
|
autocorrect: false,
|
|
|
|
enableSuggestions: false,
|
2023-06-06 21:04:49 +00:00
|
|
|
decoration: const InputDecoration(counter: Offstage()),
|
2023-05-29 19:10:14 +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-04 15:10:20 +00:00
|
|
|
onSubmitted: (String value) {
|
2023-06-05 22:21:29 +00:00
|
|
|
changePlayer(value);
|
2023-06-04 15:10:20 +00:00
|
|
|
},
|
2023-05-29 19:10:14 +00:00
|
|
|
);
|
2023-05-06 21:14:12 +00:00
|
|
|
}
|
|
|
|
|
2023-06-03 14:56:08 +00:00
|
|
|
@override
|
|
|
|
void initState() {
|
2023-06-08 16:47:33 +00:00
|
|
|
teto.open();
|
2023-06-03 14:56:08 +00:00
|
|
|
_scrollController = ScrollController();
|
|
|
|
_tabController = TabController(length: 4, vsync: this);
|
2023-06-06 21:04:49 +00:00
|
|
|
_getPreferences().then((value) => changePlayer(prefs.getString("player") ?? "dan63047"));
|
2023-06-03 14:56:08 +00:00
|
|
|
super.initState();
|
2023-06-06 21:04:49 +00:00
|
|
|
developer.log("Main view initialized", name: "main_view");
|
2023-06-03 14:56:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
_tabController.dispose();
|
|
|
|
_scrollController.dispose();
|
|
|
|
super.dispose();
|
2023-06-06 21:04:49 +00:00
|
|
|
developer.log("Main view disposed", name: "main_view");
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> _getPreferences() async {
|
|
|
|
prefs = await SharedPreferences.getInstance();
|
2023-06-03 14:56:08 +00:00
|
|
|
}
|
|
|
|
|
2023-06-05 22:21:29 +00:00
|
|
|
void changePlayer(String player) {
|
|
|
|
setState(() {
|
2023-06-06 21:04:49 +00:00
|
|
|
_tabController.animateTo(0, duration: const Duration(milliseconds: 300));
|
2023-06-05 22:21:29 +00:00
|
|
|
_searchFor = player;
|
2023-06-08 16:47:33 +00:00
|
|
|
me = teto.fetchPlayer(player, false);
|
2023-06-05 22:21:29 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 21:56:14 +00:00
|
|
|
void _justUpdate() {
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
2023-05-06 21:14:12 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-05-07 17:58:01 +00:00
|
|
|
return Scaffold(
|
2023-06-05 22:21:29 +00:00
|
|
|
drawer: NavDrawer(changePlayer),
|
2023-05-29 19:10:14 +00:00
|
|
|
appBar: AppBar(
|
|
|
|
title: !_searchBoolean
|
|
|
|
? Text(
|
|
|
|
widget.title,
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: _searchTextField(),
|
|
|
|
backgroundColor: Colors.black,
|
|
|
|
actions: [
|
|
|
|
!_searchBoolean
|
|
|
|
? IconButton(
|
|
|
|
onPressed: () {
|
|
|
|
setState(() {
|
|
|
|
_searchBoolean = true;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(Icons.search),
|
|
|
|
tooltip: "Search player",
|
|
|
|
)
|
|
|
|
: IconButton(
|
|
|
|
onPressed: () {
|
|
|
|
setState(() {
|
|
|
|
_searchBoolean = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: const Icon(Icons.clear),
|
|
|
|
tooltip: "Close search",
|
2023-05-25 19:21:56 +00:00
|
|
|
),
|
2023-05-29 19:10:14 +00:00
|
|
|
PopupMenuButton(
|
2023-06-05 22:21:29 +00:00
|
|
|
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
2023-06-10 21:56:14 +00:00
|
|
|
// const PopupMenuItem(
|
|
|
|
// value: "/compare",
|
|
|
|
// child: Text('Compare'),
|
|
|
|
// ),
|
2023-06-05 22:21:29 +00:00
|
|
|
const PopupMenuItem(
|
|
|
|
value: "/states",
|
2023-06-10 21:56:14 +00:00
|
|
|
child: Text('Show stored data'),
|
2023-05-25 19:21:56 +00:00
|
|
|
),
|
2023-06-07 21:12:21 +00:00
|
|
|
const PopupMenuItem(
|
|
|
|
value: "/calc",
|
|
|
|
child: Text('Stats Calculator'),
|
|
|
|
),
|
2023-06-05 22:21:29 +00:00
|
|
|
const PopupMenuItem(
|
|
|
|
value: "/settings",
|
2023-05-29 19:10:14 +00:00
|
|
|
child: Text('Settings'),
|
2023-05-25 19:21:56 +00:00
|
|
|
),
|
2023-05-29 19:10:14 +00:00
|
|
|
],
|
2023-06-05 22:21:29 +00:00
|
|
|
onSelected: (value) {
|
|
|
|
Navigator.pushNamed(context, value);
|
|
|
|
},
|
2023-05-25 19:21:56 +00:00
|
|
|
),
|
|
|
|
],
|
2023-05-06 21:14:12 +00:00
|
|
|
),
|
2023-05-29 19:10:14 +00:00
|
|
|
body: SafeArea(
|
|
|
|
child: FutureBuilder<TetrioPlayer>(
|
|
|
|
future: me,
|
|
|
|
builder: (context, snapshot) {
|
2023-06-06 21:04:49 +00:00
|
|
|
developer.log("builder ($context): $snapshot", name: "main_view");
|
2023-06-08 16:47:33 +00:00
|
|
|
switch (snapshot.connectionState) {
|
|
|
|
case ConnectionState.none:
|
2023-06-11 21:56:15 +00:00
|
|
|
return const Center(
|
2023-06-08 16:47:33 +00:00
|
|
|
child: Text('none case of FutureBuilder',
|
2023-06-11 21:56:15 +00:00
|
|
|
style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42), textAlign: TextAlign.center));
|
2023-06-08 16:47:33 +00:00
|
|
|
case ConnectionState.waiting:
|
|
|
|
return const Center(child: CircularProgressIndicator(color: Colors.white));
|
|
|
|
case ConnectionState.active:
|
2023-06-11 21:56:15 +00:00
|
|
|
return const Center(
|
2023-06-08 16:47:33 +00:00
|
|
|
child: Text('active case of FutureBuilder',
|
2023-06-11 21:56:15 +00:00
|
|
|
style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42), textAlign: TextAlign.center));
|
2023-06-08 16:47:33 +00:00
|
|
|
case ConnectionState.done:
|
2023-06-11 21:56:15 +00:00
|
|
|
//bool bigScreen = MediaQuery.of(context).size.width > 1024;
|
2023-06-08 16:47:33 +00:00
|
|
|
if (snapshot.hasData) {
|
2023-06-10 21:56:14 +00:00
|
|
|
if (_searchFor.length > 16) _searchFor = snapshot.data!.username;
|
|
|
|
teto.isPlayerTracking(snapshot.data!.userId).then((value) {
|
|
|
|
if (value) teto.storeState(snapshot.data!);
|
|
|
|
});
|
2023-06-08 16:47:33 +00:00
|
|
|
return NestedScrollView(
|
|
|
|
controller: _scrollController,
|
|
|
|
headerSliverBuilder: (context, value) {
|
|
|
|
return [
|
2023-06-10 21:56:14 +00:00
|
|
|
SliverToBoxAdapter(
|
|
|
|
child: UserThingy(
|
|
|
|
player: snapshot.data!,
|
|
|
|
showStateTimestamp: false,
|
|
|
|
setState: _justUpdate,
|
|
|
|
)),
|
2023-06-08 16:47:33 +00:00
|
|
|
SliverToBoxAdapter(
|
|
|
|
child: TabBar(
|
|
|
|
controller: _tabController,
|
|
|
|
isScrollable: true,
|
|
|
|
tabs: myTabs,
|
|
|
|
onTap: (int tabId) {
|
|
|
|
setState(() {
|
|
|
|
developer.log("Tab changed to $tabId", name: "main_view");
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
},
|
|
|
|
body: TabBarView(
|
|
|
|
controller: _tabController,
|
|
|
|
children: [
|
2023-06-10 21:56:14 +00:00
|
|
|
TLThingy(tl: snapshot.data!.tlSeason1, userID: snapshot.data!.userId),
|
2023-06-08 16:47:33 +00:00
|
|
|
_RecordThingy(record: (snapshot.data!.sprint.isNotEmpty) ? snapshot.data!.sprint[0] : null),
|
|
|
|
_RecordThingy(record: (snapshot.data!.blitz.isNotEmpty) ? snapshot.data!.blitz[0] : null),
|
|
|
|
_OtherThingy(zen: snapshot.data!.zen, bio: snapshot.data!.bio)
|
|
|
|
],
|
2023-06-03 14:56:08 +00:00
|
|
|
),
|
2023-06-08 16:47:33 +00:00
|
|
|
);
|
|
|
|
} else if (snapshot.hasError) {
|
|
|
|
return Center(
|
|
|
|
child:
|
|
|
|
Text('${snapshot.error}', style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42), textAlign: TextAlign.center));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2023-06-11 21:56:15 +00:00
|
|
|
return const Center(
|
2023-06-08 16:47:33 +00:00
|
|
|
child: Text('default case of FutureBuilder',
|
2023-06-11 21:56:15 +00:00
|
|
|
style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42), textAlign: TextAlign.center));
|
2023-05-29 19:10:14 +00:00
|
|
|
}
|
2023-06-11 21:56:15 +00:00
|
|
|
return const Center(
|
|
|
|
child: Text('end of FutureBuilder', style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42), textAlign: TextAlign.center));
|
2023-05-29 19:10:14 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
2023-05-25 19:21:56 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2023-05-07 17:58:01 +00:00
|
|
|
|
2023-06-08 22:06:03 +00:00
|
|
|
class NavDrawer extends StatefulWidget {
|
2023-06-06 21:04:49 +00:00
|
|
|
final Function changePlayer;
|
2023-06-08 22:06:03 +00:00
|
|
|
|
2023-06-06 21:04:49 +00:00
|
|
|
const NavDrawer(this.changePlayer, {super.key});
|
2023-06-05 22:21:29 +00:00
|
|
|
|
2023-06-08 22:06:03 +00:00
|
|
|
@override
|
|
|
|
State<NavDrawer> createState() => _NavDrawerState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _NavDrawerState extends State<NavDrawer> {
|
|
|
|
late ScrollController _scrollController;
|
2023-06-10 21:56:14 +00:00
|
|
|
String homePlayerNickname = "Checking...";
|
2023-06-08 22:06:03 +00:00
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
2023-06-10 21:56:14 +00:00
|
|
|
_setHomePlayerNickname(prefs.getString("player"));
|
2023-06-08 22:06:03 +00:00
|
|
|
_scrollController = ScrollController();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
_scrollController.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
2023-06-10 21:56:14 +00:00
|
|
|
Future<void> _setHomePlayerNickname(String? n) async {
|
|
|
|
if (n != null) {
|
|
|
|
try {
|
|
|
|
homePlayerNickname = await teto.getNicknameByID(n);
|
|
|
|
} on TetrioPlayerNotExist {
|
|
|
|
homePlayerNickname = n;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
homePlayerNickname = "dan63047";
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
2023-05-25 19:21:56 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Drawer(
|
2023-06-08 22:06:03 +00:00
|
|
|
child: StreamBuilder(
|
|
|
|
stream: teto.allPlayers,
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
switch (snapshot.connectionState) {
|
|
|
|
case ConnectionState.none:
|
2023-06-11 21:56:15 +00:00
|
|
|
return const Center(child: Text('none case of StreamBuilder'));
|
2023-06-08 22:06:03 +00:00
|
|
|
case ConnectionState.waiting:
|
|
|
|
case ConnectionState.active:
|
|
|
|
final allPlayers = (snapshot.data != null) ? snapshot.data as Map<String, List<TetrioPlayer>> : <String, List<TetrioPlayer>>{};
|
|
|
|
List<String> keys = allPlayers.keys.toList();
|
|
|
|
return NestedScrollView(
|
|
|
|
headerSliverBuilder: (context, value) {
|
|
|
|
return [
|
|
|
|
const SliverToBoxAdapter(
|
|
|
|
child: DrawerHeader(
|
|
|
|
child: Text(
|
|
|
|
'Players you track',
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 25),
|
|
|
|
))),
|
|
|
|
SliverToBoxAdapter(
|
|
|
|
child: ListTile(
|
|
|
|
leading: const Icon(Icons.home),
|
2023-06-10 21:56:14 +00:00
|
|
|
title: Text(homePlayerNickname),
|
2023-06-08 22:06:03 +00:00
|
|
|
onTap: () {
|
|
|
|
developer.log("Navigator changed player", name: "main_view");
|
|
|
|
widget.changePlayer(prefs.getString("player") ?? "dan63047");
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
];
|
|
|
|
},
|
|
|
|
body: ListView.builder(
|
|
|
|
itemCount: allPlayers.length,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return ListTile(
|
|
|
|
title: Text(allPlayers[keys[index]]?.last.username as String),
|
|
|
|
onTap: () {
|
|
|
|
developer.log("Navigator changed player", name: "main_view");
|
|
|
|
widget.changePlayer(keys[index]);
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}));
|
|
|
|
case ConnectionState.done:
|
2023-06-11 21:56:15 +00:00
|
|
|
return const Center(child: Text('done case of StreamBuilder'));
|
2023-06-08 22:06:03 +00:00
|
|
|
}
|
|
|
|
},
|
2023-05-06 21:14:12 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2023-05-11 16:08:42 +00:00
|
|
|
}
|
2023-05-29 19:10:14 +00:00
|
|
|
|
2023-06-07 21:12:21 +00:00
|
|
|
class _RecordThingy extends StatelessWidget {
|
|
|
|
final RecordSingle? record;
|
|
|
|
const _RecordThingy({Key? key, required this.record}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return LayoutBuilder(builder: (context, constraints) {
|
|
|
|
bool bigScreen = constraints.maxWidth > 768;
|
|
|
|
return ListView.builder(
|
|
|
|
physics: const ClampingScrollPhysics(),
|
|
|
|
itemCount: 1,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return Column(
|
|
|
|
children: (record != null)
|
|
|
|
? [
|
|
|
|
if (record!.stream.contains("40l"))
|
|
|
|
Text("40 Lines", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28))
|
|
|
|
else if (record!.stream.contains("blitz"))
|
|
|
|
Text("Blitz", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
|
|
|
|
if (record!.stream.contains("40l"))
|
|
|
|
Text(record!.endContext!.finalTime.toString(), style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28))
|
|
|
|
else if (record!.stream.contains("blitz"))
|
|
|
|
Text(record!.endContext!.score.toString(), style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
|
2023-06-10 21:56:14 +00:00
|
|
|
if (record!.rank != null) StatCellNum(playerStat: record!.rank!, playerStatLabel: "Leaderboard Placement", isScreenBig: bigScreen),
|
2023-06-07 21:12:21 +00:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(0, 48, 0, 48),
|
|
|
|
child: Wrap(
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
alignment: WrapAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: WrapCrossAlignment.start,
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
spacing: 25,
|
|
|
|
children: [
|
|
|
|
if (record!.stream.contains("blitz"))
|
2023-06-10 21:56:14 +00:00
|
|
|
StatCellNum(playerStat: record!.endContext!.level, playerStatLabel: "Level", isScreenBig: bigScreen),
|
2023-06-07 21:12:21 +00:00
|
|
|
if (record!.stream.contains("blitz"))
|
2023-06-10 21:56:14 +00:00
|
|
|
StatCellNum(playerStat: record!.endContext!.spp, playerStatLabel: "Score\nPer Piece", fractionDigits: 2, isScreenBig: bigScreen),
|
|
|
|
StatCellNum(playerStat: record!.endContext!.piecesPlaced, playerStatLabel: "Pieces\nPlaced", isScreenBig: bigScreen),
|
|
|
|
StatCellNum(playerStat: record!.endContext!.pps, playerStatLabel: "Pieces\nPer Second", fractionDigits: 2, isScreenBig: bigScreen),
|
|
|
|
StatCellNum(playerStat: record!.endContext!.finesse.faults, playerStatLabel: "Finesse\nFaults", isScreenBig: bigScreen),
|
|
|
|
StatCellNum(
|
2023-06-07 21:12:21 +00:00
|
|
|
playerStat: record!.endContext!.finessePercentage * 100,
|
|
|
|
playerStatLabel: "Finesse\nPercentage",
|
|
|
|
fractionDigits: 2,
|
|
|
|
isScreenBig: bigScreen),
|
2023-06-10 21:56:14 +00:00
|
|
|
StatCellNum(playerStat: record!.endContext!.inputs, playerStatLabel: "Key\nPresses", isScreenBig: bigScreen),
|
|
|
|
StatCellNum(playerStat: record!.endContext!.kpp, playerStatLabel: "KP Per\nPiece", fractionDigits: 2, isScreenBig: bigScreen),
|
|
|
|
StatCellNum(playerStat: record!.endContext!.kps, playerStatLabel: "KP Per\nSecond", fractionDigits: 2, isScreenBig: bigScreen),
|
2023-06-07 21:12:21 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(0, 16, 0, 48),
|
|
|
|
child: SizedBox(
|
|
|
|
width: bigScreen ? MediaQuery.of(context).size.width * 0.4 : MediaQuery.of(context).size.width * 0.85,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text("All Clears:", style: TextStyle(fontSize: 24)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.allClears.toString(),
|
|
|
|
style: const TextStyle(fontSize: 24),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text("Holds:", style: TextStyle(fontSize: 24)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.holds.toString(),
|
|
|
|
style: const TextStyle(fontSize: 24),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text("T-spins total:", style: TextStyle(fontSize: 24)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.tSpins.toString(),
|
|
|
|
style: const TextStyle(fontSize: 24),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - T-spin zero:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.tSpinZeros.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - T-spin singles:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.tSpinSingles.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - T-spin doubles:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.tSpinDoubles.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - T-spin triples:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.tSpinTriples.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - T-spin mini zero:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.tSpinMiniZeros.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - T-spin mini singles:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.tSpinMiniSingles.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - T-spin mini doubles:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.tSpinMiniDoubles.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text("Line clears:", style: TextStyle(fontSize: 24)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.lines.toString(),
|
|
|
|
style: const TextStyle(fontSize: 24),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - Singles:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.singles.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - Doubles:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.doubles.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - Triples:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.triples.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
const Text(" - Quads:", style: TextStyle(fontSize: 18)),
|
|
|
|
Text(
|
|
|
|
record!.endContext!.clears.quads.toString(),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
: [Text("No record", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28))],
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _OtherThingy extends StatelessWidget {
|
|
|
|
final TetrioZen? zen;
|
|
|
|
final String? bio;
|
|
|
|
const _OtherThingy({Key? key, required this.zen, required this.bio}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return LayoutBuilder(builder: (context, constraints) {
|
|
|
|
bool bigScreen = constraints.maxWidth > 768;
|
|
|
|
return ListView.builder(
|
|
|
|
physics: const ClampingScrollPhysics(),
|
|
|
|
itemCount: 1,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Text("Other info", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
|
|
|
|
if (zen != null)
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(0, 48, 0, 48),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Text("Zen", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
|
|
|
|
Text("Level ${zen!.level}", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
|
|
|
|
Text(
|
|
|
|
"Score ${zen!.score}",
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (bio != null)
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 48),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Text("Bio", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
|
|
|
|
Text(bio!, style: const TextStyle(fontSize: 18)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|