Design changes

Colors in TL matches list, new search bar
This commit is contained in:
dan63047 2024-02-09 00:39:54 +03:00
parent 638b2f6850
commit 7688b49ef9
10 changed files with 487 additions and 396 deletions

View File

@ -4,9 +4,9 @@
/// To regenerate, run: `dart run slang` /// To regenerate, run: `dart run slang`
/// ///
/// Locales: 2 /// Locales: 2
/// Strings: 1016 (508 per locale) /// Strings: 1018 (509 per locale)
/// ///
/// Built on 2024-02-06 at 20:25 UTC /// Built on 2024-02-08 at 20:30 UTC
// coverage:ignore-file // coverage:ignore-file
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -165,6 +165,7 @@ class Translations implements BaseTranslations<AppLocale, Translations> {
late final _StringsNewsPartsEn newsParts = _StringsNewsPartsEn._(_root); late final _StringsNewsPartsEn newsParts = _StringsNewsPartsEn._(_root);
String get openSearch => 'Search player'; String get openSearch => 'Search player';
String get closeSearch => 'Close search'; String get closeSearch => 'Close search';
String get searchHint => 'Nickname, ID or Discord userID (with "ds:" prefix)';
String get refresh => 'Refresh'; String get refresh => 'Refresh';
String get fetchAndsaveTLHistory => 'Get player history'; String get fetchAndsaveTLHistory => 'Get player history';
String get fetchAndSaveOldTLmatches => 'Get Tetra League matches history'; String get fetchAndSaveOldTLmatches => 'Get Tetra League matches history';
@ -265,7 +266,7 @@ class Translations implements BaseTranslations<AppLocale, Translations> {
String get winChance => 'Win Chance'; String get winChance => 'Win Chance';
String get byGlicko => 'By Glicko'; String get byGlicko => 'By Glicko';
String get byEstTR => 'By Est. TR'; String get byEstTR => 'By Est. TR';
String compareViewNoValues({required Object avgR}) => 'Please, enter username, user ID, APM-PPS-VS values (divider doesn\'t matter, only order matter) or ${avgR} (where R is rank) to both of fields'; String compareViewNoValues({required Object avgR}) => 'Please, enter username, user ID, APM-PPS-VS values (divider doesn\'t matter, only order matter) or ${avgR} (where R is rank) to both fields';
String compareViewWrongValue({required Object value}) => 'Falied to assign ${value}'; String compareViewWrongValue({required Object value}) => 'Falied to assign ${value}';
String get mostRecentOne => 'Most recent one'; String get mostRecentOne => 'Most recent one';
String get yes => 'Yes'; String get yes => 'Yes';
@ -757,6 +758,7 @@ class _StringsRu implements Translations {
@override late final _StringsNewsPartsRu newsParts = _StringsNewsPartsRu._(_root); @override late final _StringsNewsPartsRu newsParts = _StringsNewsPartsRu._(_root);
@override String get openSearch => 'Искать игрока'; @override String get openSearch => 'Искать игрока';
@override String get closeSearch => 'Закрыть поиск'; @override String get closeSearch => 'Закрыть поиск';
@override String get searchHint => 'Ник, ID или ID в Discord (с префиксом "ds:")';
@override String get refresh => 'Обновить'; @override String get refresh => 'Обновить';
@override String get fetchAndsaveTLHistory => 'Получить историю игрока'; @override String get fetchAndsaveTLHistory => 'Получить историю игрока';
@override String get fetchAndSaveOldTLmatches => 'Получить старые матчи Тетра Лиги'; @override String get fetchAndSaveOldTLmatches => 'Получить старые матчи Тетра Лиги';
@ -1341,6 +1343,7 @@ extension on Translations {
case 'newsParts.unknownNews': return ({required Object type}) => 'Unknown news of type ${type}'; case 'newsParts.unknownNews': return ({required Object type}) => 'Unknown news of type ${type}';
case 'openSearch': return 'Search player'; case 'openSearch': return 'Search player';
case 'closeSearch': return 'Close search'; case 'closeSearch': return 'Close search';
case 'searchHint': return 'Nickname, ID or Discord userID (with "ds:" prefix)';
case 'refresh': return 'Refresh'; case 'refresh': return 'Refresh';
case 'fetchAndsaveTLHistory': return 'Get player history'; case 'fetchAndsaveTLHistory': return 'Get player history';
case 'fetchAndSaveOldTLmatches': return 'Get Tetra League matches history'; case 'fetchAndSaveOldTLmatches': return 'Get Tetra League matches history';
@ -1441,7 +1444,7 @@ extension on Translations {
case 'winChance': return 'Win Chance'; case 'winChance': return 'Win Chance';
case 'byGlicko': return 'By Glicko'; case 'byGlicko': return 'By Glicko';
case 'byEstTR': return 'By Est. TR'; case 'byEstTR': return 'By Est. TR';
case 'compareViewNoValues': return ({required Object avgR}) => 'Please, enter username, user ID, APM-PPS-VS values (divider doesn\'t matter, only order matter) or ${avgR} (where R is rank) to both of fields'; case 'compareViewNoValues': return ({required Object avgR}) => 'Please, enter username, user ID, APM-PPS-VS values (divider doesn\'t matter, only order matter) or ${avgR} (where R is rank) to both fields';
case 'compareViewWrongValue': return ({required Object value}) => 'Falied to assign ${value}'; case 'compareViewWrongValue': return ({required Object value}) => 'Falied to assign ${value}';
case 'mostRecentOne': return 'Most recent one'; case 'mostRecentOne': return 'Most recent one';
case 'yes': return 'Yes'; case 'yes': return 'Yes';
@ -1859,6 +1862,7 @@ extension on _StringsRu {
case 'newsParts.unknownNews': return ({required Object type}) => 'Неизвестная новость типа ${type}'; case 'newsParts.unknownNews': return ({required Object type}) => 'Неизвестная новость типа ${type}';
case 'openSearch': return 'Искать игрока'; case 'openSearch': return 'Искать игрока';
case 'closeSearch': return 'Закрыть поиск'; case 'closeSearch': return 'Закрыть поиск';
case 'searchHint': return 'Ник, ID или ID в Discord (с префиксом "ds:")';
case 'refresh': return 'Обновить'; case 'refresh': return 'Обновить';
case 'fetchAndsaveTLHistory': return 'Получить историю игрока'; case 'fetchAndsaveTLHistory': return 'Получить историю игрока';
case 'fetchAndSaveOldTLmatches': return 'Получить старые матчи Тетра Лиги'; case 'fetchAndSaveOldTLmatches': return 'Получить старые матчи Тетра Лиги';

View File

@ -0,0 +1,6 @@
import 'package:flutter/material.dart';
const List<Shadow> textShadow = <Shadow>[ // man i love this 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),
];

View File

@ -16,9 +16,11 @@ import 'package:tetra_stats/gen/strings.g.dart';
import 'package:tetra_stats/services/tetrio_crud.dart'; import 'package:tetra_stats/services/tetrio_crud.dart';
import 'package:tetra_stats/main.dart' show prefs; import 'package:tetra_stats/main.dart' show prefs;
import 'package:tetra_stats/services/crud_exceptions.dart'; import 'package:tetra_stats/services/crud_exceptions.dart';
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/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';
import 'package:tetra_stats/widgets/user_thingy.dart'; import 'package:tetra_stats/widgets/user_thingy.dart';
@ -40,10 +42,6 @@ final NumberFormat secs = NumberFormat("00.###");
final NumberFormat _f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2); final NumberFormat _f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
final NumberFormat _f4 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 4); final NumberFormat _f4 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 4);
final DateFormat _dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms(); final DateFormat _dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms();
final List<Shadow> textShadow = <Shadow>[ // man i love this shadow
const Shadow(offset: Offset(0.0, 0.0), blurRadius: 3.0, color: Colors.black),
const Shadow(offset: Offset(0.0, 0.0), blurRadius: 8.0, color: Colors.black),
];
class MainView extends StatefulWidget { class MainView extends StatefulWidget {
@ -74,19 +72,6 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
late TabController _tabController; late TabController _tabController;
late bool fixedScroll; late bool fixedScroll;
Widget _searchTextField() {
return TextField(
maxLength: 25,
autocorrect: false,
enableSuggestions: false,
decoration: const InputDecoration(counter: Offstage()),
style: TextStyle(shadows: textShadow),
onSubmitted: (String value) {
changePlayer(value);
},
);
}
@override @override
void initState() { void initState() {
initDB(); initDB();
@ -265,11 +250,12 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final t = Translations.of(context); final t = Translations.of(context);
bool bigScreen = MediaQuery.of(context).size.width > 768;
return Scaffold( return Scaffold(
drawer: widget.player == null ? NavDrawer(changePlayer) : null, // Side menu hidden if player provided drawer: widget.player == null ? NavDrawer(changePlayer) : null, // Side menu hidden if player provided
drawerEdgeDragWidth: MediaQuery.of(context).size.width * 0.2, // 20% of left side of the screen used of Drawer gesture drawerEdgeDragWidth: MediaQuery.of(context).size.width * 0.2, // 20% of left side of the screen used of Drawer gesture
appBar: AppBar( appBar: AppBar(
title: _showSearchBar ? _searchTextField() : Text(widget.title, style: TextStyle(shadows: textShadow)), title: _showSearchBar ? SearchBox(onSubmit: changePlayer, bigScreen: bigScreen) : Text(widget.title, style: const TextStyle(shadows: textShadow)),
backgroundColor: Colors.black, backgroundColor: Colors.black,
actions: widget.player == null ? [ // search bar and PopupMenuButton hidden if player provided TODO: Subject to change actions: widget.player == null ? [ // search bar and PopupMenuButton hidden if player provided TODO: Subject to change
_showSearchBar _showSearchBar
@ -346,7 +332,6 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
case ConnectionState.active: case ConnectionState.active:
return const Center(child: CircularProgressIndicator(color: Colors.white)); return const Center(child: CircularProgressIndicator(color: Colors.white));
case ConnectionState.done: case ConnectionState.done:
//bool bigScreen = MediaQuery.of(context).size.width > 1024;
if (snapshot.hasData) { if (snapshot.hasData) {
return RefreshIndicator( return RefreshIndicator(
onRefresh: () { onRefresh: () {
@ -577,31 +562,40 @@ class _TLRecords extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool bigScreen = MediaQuery.of(context).size.width > 768;
if (data.isEmpty) return Center(child: Text(t.noRecords, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28))); if (data.isEmpty) return Center(child: Text(t.noRecords, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28)));
bool bigScreen = MediaQuery.of(context).size.width > 768;
return ListView.builder( return ListView.builder(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
itemCount: data.length, itemCount: data.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return ListTile( var accentColor = data[index].endContext.firstWhere((element) => element.userId == userID).success ? Colors.green : Colors.red;
leading: Text("${data[index].endContext.firstWhere((element) => element.userId == userID).points} : ${data[index].endContext.firstWhere((element) => element.userId != userID).points}", return Container(
style: bigScreen ? const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28) : decoration: BoxDecoration(
const TextStyle(fontSize: 28)), gradient: LinearGradient(
title: Text("vs. ${data[index].endContext.firstWhere((element) => element.userId != userID).username}"), stops: const [0, 0.05],
subtitle: Text(_dateFormat.format(data[index].timestamp)), colors: [accentColor, Colors.transparent]
trailing: Table(defaultColumnWidth: const IntrinsicColumnWidth(), )
defaultVerticalAlignment: TableCellVerticalAlignment.baseline, ),
textBaseline: TextBaseline.alphabetic, child: ListTile(
columnWidths: const { // tileColor: data[index].endContext.firstWhere((element) => element.userId == userID).success ? Colors.green[900] : Colors.red[900],
0: FixedColumnWidth(50), leading: Text("${data[index].endContext.firstWhere((element) => element.userId == userID).points} : ${data[index].endContext.firstWhere((element) => element.userId != userID).points}",
2: FixedColumnWidth(50), 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}"),
children: [ subtitle: Text(_dateFormat.format(data[index].timestamp)),
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))]), trailing: Table(defaultColumnWidth: const IntrinsicColumnWidth(),
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))]), defaultVerticalAlignment: TableCellVerticalAlignment.baseline,
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))]), textBaseline: TextBaseline.alphabetic,
],), columnWidths: const {
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => TlMatchResultView(record: data[index], initPlayerId: userID))), 0: FixedColumnWidth(50),
2: FixedColumnWidth(50),
},
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))),
),
); );
}); });
} }
@ -645,7 +639,7 @@ class _HistoryChartThigy extends StatefulWidget{
final NumberFormat yFormat; final NumberFormat yFormat;
/// Implements graph for the _History widget. Requires [data] which is a list of dots for the graph. [yAxisTitle] used to keep track of changes. /// Implements graph for the _History widget. Requires [data] which is a list of dots for the graph. [yAxisTitle] used to keep track of changes.
/// [bigScreen] tells if screen wide enough, [leftSpace] sets size, reserved for titles on the left from the graph and [yFormat] sets numer format /// [bigScreen] tells if screen wide enough, [leftSpace] sets size, reserved for titles on the left from the graph and [yFormat] sets number format
/// for left titles /// for left titles
const _HistoryChartThigy({required this.data, required this.yAxisTitle, required this.bigScreen, required this.leftSpace, required this.yFormat}); const _HistoryChartThigy({required this.data, required this.yAxisTitle, required this.bigScreen, required this.leftSpace, required this.yFormat});
@ -921,6 +915,7 @@ class _RecordThingy extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (record == null) return Center(child: Text(t.noRecord, textAlign: TextAlign.center, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28)));
return LayoutBuilder(builder: (context, constraints) { return LayoutBuilder(builder: (context, constraints) {
bool bigScreen = constraints.maxWidth > 768; bool bigScreen = constraints.maxWidth > 768;
return ListView.builder( return ListView.builder(
@ -928,7 +923,7 @@ class _RecordThingy extends StatelessWidget {
itemCount: 1, itemCount: 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Column( return Column(
children: (record != null) ? [ children: [
// show mode title // show mode title
if (record!.stream.contains("40l")) Text(t.sprint, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)) if (record!.stream.contains("40l")) Text(t.sprint, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28))
else if (record!.stream.contains("blitz")) Text(t.blitz, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)), else if (record!.stream.contains("blitz")) Text(t.blitz, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
@ -1080,9 +1075,6 @@ class _RecordThingy extends StatelessWidget {
), ),
), ),
] ]
: [ // If no record, show this
Text(t.noRecord, textAlign: TextAlign.center, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28))
],
); );
}); });
}); });

View File

@ -7,7 +7,8 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/data_objects/tetrio.dart';
import 'package:tetra_stats/gen/strings.g.dart'; import 'package:tetra_stats/gen/strings.g.dart';
import 'package:tetra_stats/views/main_view.dart' show MainView, textShadow; import 'package:tetra_stats/views/main_view.dart' show MainView;
import 'package:tetra_stats/utils/text_shadow.dart';
import 'package:window_manager/window_manager.dart'; import 'package:window_manager/window_manager.dart';
var _chartsShortTitlesDropdowns = <DropdownMenuItem>[for (MapEntry e in chartsShortTitles.entries) DropdownMenuItem(value: e.key, child: Text(e.value),)]; var _chartsShortTitlesDropdowns = <DropdownMenuItem>[for (MapEntry e in chartsShortTitles.entries) DropdownMenuItem(value: e.key, child: Text(e.value),)];

View File

@ -0,0 +1,89 @@
import 'package:flutter/material.dart';
import 'package:tetra_stats/gen/strings.g.dart';
import 'package:tetra_stats/utils/text_shadow.dart';
const int length = 25;
final TextEditingController controller = TextEditingController();
class SearchBox extends StatefulWidget {
final Function onSubmit;
final bool bigScreen;
const SearchBox({required this.onSubmit, required this.bigScreen, super.key});
@override
State<StatefulWidget> createState() => _SearchBoxState();
}
class _SearchBoxState extends State<SearchBox>{
late FocusNode textbotFocus;
@override
void initState() {
textbotFocus = FocusNode();
controller.addListener(() {
setState(() {});
});
super.initState();
}
@override
void dispose(){
controller.clear();
textbotFocus.dispose();
super.dispose();
}
Color getColorOfCounter(){
// if limit was hit
if ((length - controller.text.length) <= 0) return Colors.redAccent;
// if input more than 16 symbols (username length limit)
if ((length - controller.text.length) < 9) return Colors.yellowAccent;
// if we good (we not)
return Colors.grey;
}
double getFontSizeOfCounter(){
return (length - controller.text.length) <= 0 ? 24 : 16;
}
@override
Widget build(BuildContext context) {
final t = Translations.of(context);
return Row(
mainAxisSize: MainAxisSize.min,
//alignment: Alignment.centerRight,
children: [
Expanded(
child: TextField(
controller: controller,
maxLength: length,
focusNode: textbotFocus,
autofocus: true,
autocorrect: false,
enableSuggestions: false,
decoration: InputDecoration(
counter: const Offstage(),
hintText: widget.bigScreen ? t.searchHint : null,
),
style: const TextStyle(shadows: textShadow, fontSize: 18),
onSubmitted: (String value) {
widget.onSubmit(value);
textbotFocus.unfocus();
},
),
),
AnimatedDefaultTextStyle(
style: TextStyle(
fontFamily: "Eurostile Round",
fontSize: getFontSizeOfCounter(),
color: getColorOfCounter(),
shadows: textShadow
),
duration: Durations.short4,
curve: Curves.easeOutCirc,
child: Text("${length - controller.text.length}")
)
]
);
}
}

View File

@ -47,6 +47,7 @@ class _TLThingyState extends State<TLThingy> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final t = Translations.of(context); final t = Translations.of(context);
if (currentTl.gamesPlayed == 0) return Center(child: Text(widget.guest ? t.anonTL : widget.bot ? t.botTL : t.neverPlayedTL, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28), textAlign: TextAlign.center,));
return LayoutBuilder(builder: (context, constraints) { return LayoutBuilder(builder: (context, constraints) {
bool bigScreen = constraints.maxWidth > 768; bool bigScreen = constraints.maxWidth > 768;
return ListView.builder( return ListView.builder(
@ -54,364 +55,360 @@ class _TLThingyState extends State<TLThingy> {
itemCount: 1, itemCount: 1,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Column( return Column(
children: (currentTl.gamesPlayed > 0) children: [
? [ if (widget.showTitle) Text(t.tetraLeague, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
if (widget.showTitle) Text(t.tetraLeague, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)), if (oldTl != null) Text(t.comparingWith(newDate: dateFormat.format(currentTl.timestamp), oldDate: dateFormat.format(oldTl!.timestamp)),
if (oldTl != null) Text(t.comparingWith(newDate: dateFormat.format(currentTl.timestamp), oldDate: dateFormat.format(oldTl!.timestamp)), textAlign: TextAlign.center,),
textAlign: TextAlign.center,), if (oldTl != null) RangeSlider(values: _currentRangeValues, max: widget.states.length.toDouble(),
if (oldTl != null) RangeSlider(values: _currentRangeValues, max: widget.states.length.toDouble(), labels: RangeLabels(
labels: RangeLabels( _currentRangeValues.start.round().toString(),
_currentRangeValues.start.round().toString(), _currentRangeValues.end.round().toString(),
_currentRangeValues.end.round().toString(), ),
), onChanged: (RangeValues values) {
onChanged: (RangeValues values) { setState(() {
setState(() { _currentRangeValues = values;
_currentRangeValues = values; if (values.start.round() == 0){
if (values.start.round() == 0){ currentTl = widget.tl;
currentTl = widget.tl; }else{
}else{ currentTl = sortedStates[values.start.round()-1].tlSeason1;
currentTl = sortedStates[values.start.round()-1].tlSeason1; }
} if (values.end.round() == 0){
if (values.end.round() == 0){ oldTl = widget.tl;
oldTl = widget.tl; }else{
}else{ oldTl = sortedStates[values.end.round()-1].tlSeason1;
oldTl = sortedStates[values.end.round()-1].tlSeason1; }
} });
}); },
}, ),
), if (currentTl.gamesPlayed >= 10)
if (currentTl.gamesPlayed >= 10) Wrap(
Wrap( direction: Axis.horizontal,
direction: Axis.horizontal, alignment: WrapAlignment.spaceAround,
alignment: WrapAlignment.spaceAround, crossAxisAlignment: WrapCrossAlignment.center,
crossAxisAlignment: WrapCrossAlignment.center, clipBehavior: Clip.hardEdge,
clipBehavior: Clip.hardEdge, children: [
children: [ widget.userID == "5e32fc85ab319c2ab1beb07c" // he love her so much, you can't even imagine
widget.userID == "5e32fc85ab319c2ab1beb07c" // he love her so much, you can't even imagine ? Image.asset("res/icons/kagari.png", height: 128) // Btw why she wearing Kazamatsuri high school uniform?
? Image.asset("res/icons/kagari.png", height: 128) // Btw why she wearing Kazamatsuri high school uniform? : Image.asset("res/tetrio_tl_alpha_ranks/${currentTl.rank}.png", height: 128),
: Image.asset("res/tetrio_tl_alpha_ranks/${currentTl.rank}.png", height: 128), Column(
Column( children: [
children: [ Text("${f2.format(currentTl.rating)} TR", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
Text("${f2.format(currentTl.rating)} TR", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)), if (oldTl != null) Text(
if (oldTl != null) Text( "${fDiff.format(currentTl.rating - oldTl!.rating)} TR",
"${fDiff.format(currentTl.rating - oldTl!.rating)} TR",
textAlign: TextAlign.center,
style: TextStyle(
color: currentTl.rating - oldTl!.rating < 0 ?
Colors.red :
Colors.green
),
),
Column(
children: [
RichText(
textAlign: TextAlign.center,
softWrap: true,
text: TextSpan(
style: DefaultTextStyle.of(context).style,
children: [
TextSpan(text: "${t.top} ${f2.format(currentTl.percentile * 100)}% (${currentTl.percentileRank.toUpperCase()})"),
if (currentTl.bestRank != "z") const TextSpan(text: ""),
if (currentTl.bestRank != "z") TextSpan(text: "${t.topRank}: ${currentTl.bestRank.toUpperCase()}"),
if (widget.topTR != null) TextSpan(text: " (${f2.format(widget.topTR)} TR)"),
TextSpan(text: " • Glicko: ${f2.format(currentTl.glicko!)}±"),
TextSpan(text: f2.format(currentTl.rd!), style: currentTl.decaying ? TextStyle(color: currentTl.rd! > 98 ? Colors.red : Colors.yellow) : null),
if (currentTl.decaying) WidgetSpan(child: Icon(Icons.trending_up, color: currentTl.rd! > 98 ? Colors.red : Colors.yellow,), alignment: PlaceholderAlignment.middle, baseline: TextBaseline.alphabetic)
],
),
),
],
),
],
),
],
),
if (currentTl.gamesPlayed >= 10 && currentTl.rd! < 100 && currentTl.nextAt >=0 && currentTl.prevAt >= 0) Padding(
padding: const EdgeInsets.all(8.0),
child: SfLinearGauge(
minimum: currentTl.nextAt.toDouble(),
maximum: currentTl.prevAt.toDouble(),
interval: currentTl.prevAt.toDouble() - currentTl.nextAt.toDouble(),
ranges: [LinearGaugeRange(startValue: currentTl.standing.toDouble() <= currentTl.prevAt.toDouble() ? currentTl.standing.toDouble() : currentTl.prevAt.toDouble(), endValue: currentTl.prevAt.toDouble(), color: Colors.cyanAccent,)],
markerPointers: [LinearShapePointer(value: currentTl.standing.toDouble() <= currentTl.prevAt.toDouble() ? currentTl.standing.toDouble() : currentTl.prevAt.toDouble(), position: LinearElementPosition.inside, shapeType: LinearShapePointerType.triangle, color: Colors.white, height: 20),
LinearWidgetPointer(offset: 4, position: LinearElementPosition.outside, value: currentTl.standing.toDouble() <= currentTl.prevAt.toDouble() ? currentTl.standing.toDouble() : currentTl.prevAt.toDouble(), child: Text(NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 0).format(currentTl.standing)))],
isAxisInversed: true,
isMirrored: true,
showTicks: true,
showLabels: true
),
),
if (currentTl.gamesPlayed < 10)
Text(t.gamesUntilRanked(left: 10 - currentTl.gamesPlayed),
softWrap: true,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontFamily: "Eurostile Round Extended", color: currentTl.rating - oldTl!.rating < 0 ?
fontSize: bigScreen ? 42 : 28, Colors.red :
overflow: TextOverflow.visible, Colors.green
)), ),
),
Column(
children: [
RichText(
textAlign: TextAlign.center,
softWrap: true,
text: TextSpan(
style: DefaultTextStyle.of(context).style,
children: [
TextSpan(text: "${t.top} ${f2.format(currentTl.percentile * 100)}% (${currentTl.percentileRank.toUpperCase()})"),
if (currentTl.bestRank != "z") const TextSpan(text: ""),
if (currentTl.bestRank != "z") TextSpan(text: "${t.topRank}: ${currentTl.bestRank.toUpperCase()}"),
if (widget.topTR != null) TextSpan(text: " (${f2.format(widget.topTR)} TR)"),
TextSpan(text: " • Glicko: ${f2.format(currentTl.glicko!)}±"),
TextSpan(text: f2.format(currentTl.rd!), style: currentTl.decaying ? TextStyle(color: currentTl.rd! > 98 ? Colors.red : Colors.yellow) : null),
if (currentTl.decaying) WidgetSpan(child: Icon(Icons.trending_up, color: currentTl.rd! > 98 ? Colors.red : Colors.yellow,), alignment: PlaceholderAlignment.middle, baseline: TextBaseline.alphabetic)
],
),
),
],
),
],
),
],
),
if (currentTl.gamesPlayed >= 10 && currentTl.rd! < 100 && currentTl.nextAt >=0 && currentTl.prevAt >= 0) Padding(
padding: const EdgeInsets.all(8.0),
child: SfLinearGauge(
minimum: currentTl.nextAt.toDouble(),
maximum: currentTl.prevAt.toDouble(),
interval: currentTl.prevAt.toDouble() - currentTl.nextAt.toDouble(),
ranges: [LinearGaugeRange(startValue: currentTl.standing.toDouble() <= currentTl.prevAt.toDouble() ? currentTl.standing.toDouble() : currentTl.prevAt.toDouble(), endValue: currentTl.prevAt.toDouble(), color: Colors.cyanAccent,)],
markerPointers: [LinearShapePointer(value: currentTl.standing.toDouble() <= currentTl.prevAt.toDouble() ? currentTl.standing.toDouble() : currentTl.prevAt.toDouble(), position: LinearElementPosition.inside, shapeType: LinearShapePointerType.triangle, color: Colors.white, height: 20),
LinearWidgetPointer(offset: 4, position: LinearElementPosition.outside, value: currentTl.standing.toDouble() <= currentTl.prevAt.toDouble() ? currentTl.standing.toDouble() : currentTl.prevAt.toDouble(), child: Text(NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 0).format(currentTl.standing)))],
isAxisInversed: true,
isMirrored: true,
showTicks: true,
showLabels: true
),
),
if (currentTl.gamesPlayed < 10)
Text(t.gamesUntilRanked(left: 10 - currentTl.gamesPlayed),
softWrap: true,
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "Eurostile Round Extended",
fontSize: bigScreen ? 42 : 28,
overflow: TextOverflow.visible,
)),
Padding(
padding: const EdgeInsets.fromLTRB(0, 16, 0, 48),
child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.center,
spacing: 25,
crossAxisAlignment: WrapCrossAlignment.start,
clipBehavior: Clip.hardEdge,
children: [
if (currentTl.apm != null) StatCellNum(playerStat: currentTl.apm!, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.apm, higherIsBetter: true, oldPlayerStat: oldTl?.apm),
if (currentTl.pps != null) StatCellNum(playerStat: currentTl.pps!, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.pps, higherIsBetter: true, oldPlayerStat: oldTl?.pps),
if (currentTl.vs != null) StatCellNum(playerStat: currentTl.vs!, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.vs, higherIsBetter: true, oldPlayerStat: oldTl?.vs),
if (currentTl.standingLocal > 0) StatCellNum(playerStat: currentTl.standingLocal, isScreenBig: bigScreen, playerStatLabel: t.statCellNum.lbpc, higherIsBetter: false, oldPlayerStat: oldTl?.standingLocal),
StatCellNum(playerStat: currentTl.gamesPlayed, isScreenBig: bigScreen, playerStatLabel: t.statCellNum.gamesPlayed, higherIsBetter: true, oldPlayerStat: oldTl?.gamesPlayed),
StatCellNum(playerStat: currentTl.gamesWon, isScreenBig: bigScreen, playerStatLabel: t.statCellNum.gamesWonTL, higherIsBetter: true, oldPlayerStat: oldTl?.gamesWon),
StatCellNum(playerStat: currentTl.winrate * 100, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.winrate, higherIsBetter: true, oldPlayerStat: oldTl != null ? oldTl!.winrate*100 : null),
],
),
),
if (currentTl.nerdStats != null)
Column(
children: [
Text(t.nerdStats, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(0, 16, 0, 48), padding: const EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Wrap( child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.center,
spacing: 35,
crossAxisAlignment: WrapCrossAlignment.start,
clipBehavior: Clip.hardEdge,
children: [
SizedBox(
width: 200,
height: 120,
child: SfRadialGauge(
title: GaugeTitle(text: t.statCellNum.app),
axes: [RadialAxis(
startAngle: 180,
endAngle: 360,
showLabels: false,
showTicks: false,
radiusFactor: 2.1,
centerY: 0.5,
minimum: 0,
maximum: 1,
ranges: [
GaugeRange(startValue: 0, endValue: 0.2, color: Colors.red),
GaugeRange(startValue: 0.2, endValue: 0.4, color: Colors.yellow),
GaugeRange(startValue: 0.4, endValue: 0.6, color: Colors.green),
GaugeRange(startValue: 0.6, endValue: 0.8, color: Colors.blue),
GaugeRange(startValue: 0.8, endValue: 1, color: Colors.purple),
],
pointers: [
NeedlePointer(
value: currentTl.nerdStats!.app,
enableAnimation: true,
needleLength: 0.9,
needleStartWidth: 2,
needleEndWidth: 15,
knobStyle: const KnobStyle(color: Colors.transparent),
gradient: const LinearGradient(colors: [Colors.transparent, Colors.white], begin: Alignment.bottomCenter, end: Alignment.topCenter, stops: [0.5, 1]),)
],
annotations: [GaugeAnnotation(
widget: TextButton(child: Text(f3.format(currentTl.nerdStats!.app),
style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36, color: Colors.white)),
onPressed: (){
showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text(t.statCellNum.app,
style: const TextStyle(
fontFamily: "Eurostile Round Extended")),
content: SingleChildScrollView(
child: ListBody(children: [
Text(t.statCellNum.appDescription),
Text("${t.exactValue}: ${currentTl.nerdStats!.app}")
]),
),
actions: <Widget>[
TextButton(
child: Text(t.popupActions.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
));
},), verticalAlignment: GaugeAlignment.far, positionFactor: 0.05,),
if (oldTl != null && oldTl!.gamesPlayed > 0) GaugeAnnotation(widget: Text(fDiff.format(currentTl.nerdStats!.app - oldTl!.nerdStats!.app), style: TextStyle(
color: currentTl.nerdStats!.app - oldTl!.nerdStats!.app < 0 ?
Colors.red :
Colors.green
),), positionFactor: 0.05,)],
)],),
),
SizedBox(
width: 200,
height: 120,
child: SfRadialGauge(
title: const GaugeTitle(text: "VS / APM"),
axes: [RadialAxis(
startAngle: 180,
endAngle: 360,
showTicks: false,
showLabels: false,
radiusFactor: 2.1,
centerY: 0.5,
minimum: 1.8,
maximum: 2.4,
ranges: [
GaugeRange(startValue: 1.8, endValue: 2.0, color: Colors.green),
GaugeRange(startValue: 2.0, endValue: 2.2, color: Colors.blue),
GaugeRange(startValue: 2.2, endValue: 2.4, color: Colors.purple),
],
pointers: [
NeedlePointer(
value: currentTl.nerdStats!.vsapm,
enableAnimation: true,
needleLength: 0.9,
needleStartWidth: 2,
needleEndWidth: 15,
knobStyle: const KnobStyle(color: Colors.transparent),
gradient: const LinearGradient(colors: [Colors.transparent, Colors.white], begin: Alignment.bottomCenter, end: Alignment.topCenter, stops: [0.5, 1]),)
],
annotations: [GaugeAnnotation(
widget: TextButton(child: Text(f3.format(currentTl.nerdStats!.vsapm),
style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36, color: Colors.white)),
onPressed: (){
showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: const Text("VS / APM",
style: TextStyle(
fontFamily: "Eurostile Round Extended")),
content: SingleChildScrollView(
child: ListBody(children: [
Text(t.statCellNum.vsapmDescription),
Text("${t.exactValue}: ${currentTl.nerdStats!.vsapm}")
]),
),
actions: <Widget>[
TextButton(
child: Text(t.popupActions.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
));
},), verticalAlignment: GaugeAlignment.far, positionFactor: 0.05),
if (oldTl != null && oldTl!.gamesPlayed > 0) GaugeAnnotation(widget: Text(fDiff.format(currentTl.nerdStats!.vsapm - oldTl!.nerdStats!.vsapm), style: TextStyle(
color: currentTl.nerdStats!.vsapm - oldTl!.nerdStats!.vsapm < 0 ?
Colors.red :
Colors.green
),), positionFactor: 0.05,)],
)],),
),]),
),
Wrap(
direction: Axis.horizontal, direction: Axis.horizontal,
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
spacing: 25, spacing: 25,
crossAxisAlignment: WrapCrossAlignment.start, crossAxisAlignment: WrapCrossAlignment.start,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
children: [ children: [
if (currentTl.apm != null) StatCellNum(playerStat: currentTl.apm!, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.apm, higherIsBetter: true, oldPlayerStat: oldTl?.apm), StatCellNum(playerStat: currentTl.nerdStats!.dss, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.dss,
if (currentTl.pps != null) StatCellNum(playerStat: currentTl.pps!, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.pps, higherIsBetter: true, oldPlayerStat: oldTl?.pps), alertWidgets: [Text(t.statCellNum.dssDescription),
if (currentTl.vs != null) StatCellNum(playerStat: currentTl.vs!, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.vs, higherIsBetter: true, oldPlayerStat: oldTl?.vs), Text("${t.formula}: (VS / 100) - (APM / 60)"),
if (currentTl.standingLocal > 0) StatCellNum(playerStat: currentTl.standingLocal, isScreenBig: bigScreen, playerStatLabel: t.statCellNum.lbpc, higherIsBetter: false, oldPlayerStat: oldTl?.standingLocal), Text("${t.exactValue}: ${currentTl.nerdStats!.dss}"),],
StatCellNum(playerStat: currentTl.gamesPlayed, isScreenBig: bigScreen, playerStatLabel: t.statCellNum.gamesPlayed, higherIsBetter: true, oldPlayerStat: oldTl?.gamesPlayed), okText: t.popupActions.ok,
StatCellNum(playerStat: currentTl.gamesWon, isScreenBig: bigScreen, playerStatLabel: t.statCellNum.gamesWonTL, higherIsBetter: true, oldPlayerStat: oldTl?.gamesWon), higherIsBetter: true,
StatCellNum(playerStat: currentTl.winrate * 100, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.winrate, higherIsBetter: true, oldPlayerStat: oldTl != null ? oldTl!.winrate*100 : null), oldPlayerStat: oldTl?.nerdStats?.dss,),
], StatCellNum(playerStat: currentTl.nerdStats!.dsp, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.dsp,
), alertWidgets: [Text(t.statCellNum.dspDescription),
), Text("${t.formula}: DS/S / PPS"),
if (currentTl.nerdStats != null) Text("${t.exactValue}: ${currentTl.nerdStats!.dsp}"),],
Column( okText: t.popupActions.ok,
children: [ higherIsBetter: true,
Text(t.nerdStats, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)), oldPlayerStat: oldTl?.nerdStats?.dsp,),
Padding( StatCellNum(playerStat: currentTl.nerdStats!.appdsp, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.appdsp,
padding: const EdgeInsets.fromLTRB(0, 40, 0, 0), alertWidgets: [Text(t.statCellNum.appdspDescription),
child: Wrap( Text("${t.formula}: APP + DS/P"),
direction: Axis.horizontal, Text("${t.exactValue}: ${currentTl.nerdStats!.appdsp}"),],
alignment: WrapAlignment.center, okText: t.popupActions.ok,
spacing: 35, higherIsBetter: true,
crossAxisAlignment: WrapCrossAlignment.start, oldPlayerStat: oldTl?.nerdStats?.appdsp,),
clipBehavior: Clip.hardEdge, StatCellNum(playerStat: currentTl.nerdStats!.cheese, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.cheese,
children: [ alertWidgets: [Text(t.statCellNum.cheeseDescription),
SizedBox( Text("${t.formula}: (DS/P * 150) + ((VS/APM - 2) * 50) + (0.6 - APP) * 125"),
width: 200, Text("${t.exactValue}: ${currentTl.nerdStats!.cheese}"),],
height: 120, okText: t.popupActions.ok,
child: SfRadialGauge( higherIsBetter: true,
title: GaugeTitle(text: t.statCellNum.app), oldPlayerStat: oldTl?.nerdStats?.cheese,),
axes: [RadialAxis( StatCellNum(playerStat: currentTl.nerdStats!.gbe, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.gbe,
startAngle: 180, alertWidgets: [Text(t.statCellNum.gbeDescription),
endAngle: 360, Text("${t.formula}: APP * DS/P * 2"),
showLabels: false, Text("${t.exactValue}: ${currentTl.nerdStats!.gbe}"),],
showTicks: false, okText: t.popupActions.ok,
radiusFactor: 2.1, higherIsBetter: true,
centerY: 0.5, oldPlayerStat: oldTl?.nerdStats?.gbe,),
minimum: 0, StatCellNum(playerStat: currentTl.nerdStats!.nyaapp, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.nyaapp,
maximum: 1, alertWidgets: [Text(t.statCellNum.nyaappDescription),
ranges: [ Text("${t.formula}: APP - 5 * tan(radians((Cheese Index / -30) + 1))"),
GaugeRange(startValue: 0, endValue: 0.2, color: Colors.red), Text("${t.exactValue}: ${currentTl.nerdStats!.nyaapp}"),],
GaugeRange(startValue: 0.2, endValue: 0.4, color: Colors.yellow), okText: t.popupActions.ok,
GaugeRange(startValue: 0.4, endValue: 0.6, color: Colors.green), higherIsBetter: true,
GaugeRange(startValue: 0.6, endValue: 0.8, color: Colors.blue), oldPlayerStat: oldTl?.nerdStats?.nyaapp,),
GaugeRange(startValue: 0.8, endValue: 1, color: Colors.purple), StatCellNum(playerStat: currentTl.nerdStats!.area, isScreenBig: bigScreen, fractionDigits: 1, playerStatLabel: t.statCellNum.area,
], alertWidgets: [Text(t.statCellNum.areaDescription),
pointers: [ Text("${t.formula}: APM * 1 + PPS * 45 + VS * 0.444 + APP * 185 + DS/S * 175 + DS/P * 450 + Garbage Effi * 315"),
NeedlePointer( Text("${t.exactValue}: ${currentTl.nerdStats!.area}"),],
value: currentTl.nerdStats!.app, okText: t.popupActions.ok,
enableAnimation: true, higherIsBetter: true,
needleLength: 0.9, oldPlayerStat: oldTl?.nerdStats?.area,)
needleStartWidth: 2, ])
needleEndWidth: 15, ],
knobStyle: const KnobStyle(color: Colors.transparent), ),
gradient: const LinearGradient(colors: [Colors.transparent, Colors.white], begin: Alignment.bottomCenter, end: Alignment.topCenter, stops: [0.5, 1]),) if (currentTl.estTr != null)
], Padding(
annotations: [GaugeAnnotation( padding: const EdgeInsets.fromLTRB(0, 16, 0, 48),
widget: TextButton(child: Text(f3.format(currentTl.nerdStats!.app), child: SizedBox(
style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36, color: Colors.white)), width: bigScreen ? MediaQuery.of(context).size.width * 0.4 : MediaQuery.of(context).size.width * 0.85,
onPressed: (){ child: Column(
showDialog( crossAxisAlignment: CrossAxisAlignment.start,
context: context, children: [
builder: (BuildContext context) => AlertDialog( Row(
title: Text(t.statCellNum.app, mainAxisAlignment: MainAxisAlignment.spaceBetween,
style: const TextStyle( children: [
fontFamily: "Eurostile Round Extended")), Text(
content: SingleChildScrollView( "${bigScreen ? t.statCellNum.estOfTR : t.statCellNum.estOfTRShort}:",
child: ListBody(children: [ style: const TextStyle(fontSize: 24),
Text(t.statCellNum.appDescription), ),
Text("${t.exactValue}: ${currentTl.nerdStats!.app}") Text(
]), f2.format(currentTl.estTr!.esttr),
), style: const TextStyle(fontSize: 24),
actions: <Widget>[ ),
TextButton( ],
child: Text(t.popupActions.ok), ),
onPressed: () { if (currentTl.rating >= 0)
Navigator.of(context).pop(); Row(
}, mainAxisAlignment: MainAxisAlignment.spaceBetween,
)
],
));
},), verticalAlignment: GaugeAlignment.far, positionFactor: 0.05,),
if (oldTl != null && oldTl!.gamesPlayed > 0) GaugeAnnotation(widget: Text(fDiff.format(currentTl.nerdStats!.app - oldTl!.nerdStats!.app), style: TextStyle(
color: currentTl.nerdStats!.app - oldTl!.nerdStats!.app < 0 ?
Colors.red :
Colors.green
),), positionFactor: 0.05,)],
)],),
),
SizedBox(
width: 200,
height: 120,
child: SfRadialGauge(
title: const GaugeTitle(text: "VS / APM"),
axes: [RadialAxis(
startAngle: 180,
endAngle: 360,
showTicks: false,
showLabels: false,
radiusFactor: 2.1,
centerY: 0.5,
minimum: 1.8,
maximum: 2.4,
ranges: [
GaugeRange(startValue: 1.8, endValue: 2.0, color: Colors.green),
GaugeRange(startValue: 2.0, endValue: 2.2, color: Colors.blue),
GaugeRange(startValue: 2.2, endValue: 2.4, color: Colors.purple),
],
pointers: [
NeedlePointer(
value: currentTl.nerdStats!.vsapm,
enableAnimation: true,
needleLength: 0.9,
needleStartWidth: 2,
needleEndWidth: 15,
knobStyle: const KnobStyle(color: Colors.transparent),
gradient: const LinearGradient(colors: [Colors.transparent, Colors.white], begin: Alignment.bottomCenter, end: Alignment.topCenter, stops: [0.5, 1]),)
],
annotations: [GaugeAnnotation(
widget: TextButton(child: Text(f3.format(currentTl.nerdStats!.vsapm),
style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36, color: Colors.white)),
onPressed: (){
showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: const Text("VS / APM",
style: TextStyle(
fontFamily: "Eurostile Round Extended")),
content: SingleChildScrollView(
child: ListBody(children: [
Text(t.statCellNum.vsapmDescription),
Text("${t.exactValue}: ${currentTl.nerdStats!.vsapm}")
]),
),
actions: <Widget>[
TextButton(
child: Text(t.popupActions.ok),
onPressed: () {
Navigator.of(context).pop();
},
)
],
));
},), verticalAlignment: GaugeAlignment.far, positionFactor: 0.05),
if (oldTl != null && oldTl!.gamesPlayed > 0) GaugeAnnotation(widget: Text(fDiff.format(currentTl.nerdStats!.vsapm - oldTl!.nerdStats!.vsapm), style: TextStyle(
color: currentTl.nerdStats!.vsapm - oldTl!.nerdStats!.vsapm < 0 ?
Colors.red :
Colors.green
),), positionFactor: 0.05,)],
)],),
),]),
),
Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.center,
spacing: 25,
crossAxisAlignment: WrapCrossAlignment.start,
clipBehavior: Clip.hardEdge,
children: [
StatCellNum(playerStat: currentTl.nerdStats!.dss, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.dss,
alertWidgets: [Text(t.statCellNum.dssDescription),
Text("${t.formula}: (VS / 100) - (APM / 60)"),
Text("${t.exactValue}: ${currentTl.nerdStats!.dss}"),],
okText: t.popupActions.ok,
higherIsBetter: true,
oldPlayerStat: oldTl?.nerdStats?.dss,),
StatCellNum(playerStat: currentTl.nerdStats!.dsp, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.dsp,
alertWidgets: [Text(t.statCellNum.dspDescription),
Text("${t.formula}: DS/S / PPS"),
Text("${t.exactValue}: ${currentTl.nerdStats!.dsp}"),],
okText: t.popupActions.ok,
higherIsBetter: true,
oldPlayerStat: oldTl?.nerdStats?.dsp,),
StatCellNum(playerStat: currentTl.nerdStats!.appdsp, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.appdsp,
alertWidgets: [Text(t.statCellNum.appdspDescription),
Text("${t.formula}: APP + DS/P"),
Text("${t.exactValue}: ${currentTl.nerdStats!.appdsp}"),],
okText: t.popupActions.ok,
higherIsBetter: true,
oldPlayerStat: oldTl?.nerdStats?.appdsp,),
StatCellNum(playerStat: currentTl.nerdStats!.cheese, isScreenBig: bigScreen, fractionDigits: 2, playerStatLabel: t.statCellNum.cheese,
alertWidgets: [Text(t.statCellNum.cheeseDescription),
Text("${t.formula}: (DS/P * 150) + ((VS/APM - 2) * 50) + (0.6 - APP) * 125"),
Text("${t.exactValue}: ${currentTl.nerdStats!.cheese}"),],
okText: t.popupActions.ok,
higherIsBetter: true,
oldPlayerStat: oldTl?.nerdStats?.cheese,),
StatCellNum(playerStat: currentTl.nerdStats!.gbe, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.gbe,
alertWidgets: [Text(t.statCellNum.gbeDescription),
Text("${t.formula}: APP * DS/P * 2"),
Text("${t.exactValue}: ${currentTl.nerdStats!.gbe}"),],
okText: t.popupActions.ok,
higherIsBetter: true,
oldPlayerStat: oldTl?.nerdStats?.gbe,),
StatCellNum(playerStat: currentTl.nerdStats!.nyaapp, isScreenBig: bigScreen, fractionDigits: 3, playerStatLabel: t.statCellNum.nyaapp,
alertWidgets: [Text(t.statCellNum.nyaappDescription),
Text("${t.formula}: APP - 5 * tan(radians((Cheese Index / -30) + 1))"),
Text("${t.exactValue}: ${currentTl.nerdStats!.nyaapp}"),],
okText: t.popupActions.ok,
higherIsBetter: true,
oldPlayerStat: oldTl?.nerdStats?.nyaapp,),
StatCellNum(playerStat: currentTl.nerdStats!.area, isScreenBig: bigScreen, fractionDigits: 1, playerStatLabel: t.statCellNum.area,
alertWidgets: [Text(t.statCellNum.areaDescription),
Text("${t.formula}: APM * 1 + PPS * 45 + VS * 0.444 + APP * 185 + DS/S * 175 + DS/P * 450 + Garbage Effi * 315"),
Text("${t.exactValue}: ${currentTl.nerdStats!.area}"),],
okText: t.popupActions.ok,
higherIsBetter: true,
oldPlayerStat: oldTl?.nerdStats?.area,)
])
],
),
if (currentTl.estTr != null)
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: [ children: [
Row( Text(
mainAxisAlignment: MainAxisAlignment.spaceBetween, "${bigScreen ? t.statCellNum.accOfEst : t.statCellNum.accOfEstShort}:",
children: [ style: const TextStyle(fontSize: 24),
Text( ),
"${bigScreen ? t.statCellNum.estOfTR : t.statCellNum.estOfTRShort}:", Text(
style: const TextStyle(fontSize: 24), fDiff.format(currentTl.esttracc!),
), style: const TextStyle(fontSize: 24),
Text(
f2.format(currentTl.estTr!.esttr),
style: const TextStyle(fontSize: 24),
),
],
), ),
if (currentTl.rating >= 0)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"${bigScreen ? t.statCellNum.accOfEst : t.statCellNum.accOfEstShort}:",
style: const TextStyle(fontSize: 24),
),
Text(
fDiff.format(currentTl.esttracc!),
style: const TextStyle(fontSize: 24),
),
],
),
], ],
), ),
), ],
), ),
if (currentTl.nerdStats != null) Graphs(currentTl.apm!, currentTl.pps!, currentTl.vs!, currentTl.nerdStats!, currentTl.playstyle!) ),
] ),
: [ if (currentTl.nerdStats != null) Graphs(currentTl.apm!, currentTl.pps!, currentTl.vs!, currentTl.nerdStats!, currentTl.playstyle!)
Center(child: Text(widget.guest ? t.anonTL : widget.bot ? t.botTL : t.neverPlayedTL, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28), textAlign: TextAlign.center,)), ]
],
); );
}, },
); );

View File

@ -5,7 +5,7 @@ import 'package:tetra_stats/data_objects/tetrio.dart';
import 'package:tetra_stats/gen/strings.g.dart'; import 'package:tetra_stats/gen/strings.g.dart';
import 'package:tetra_stats/views/compare_view.dart'; import 'package:tetra_stats/views/compare_view.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/views/main_view.dart' show textShadow; import 'package:tetra_stats/utils/text_shadow.dart';
import 'dart:developer' as developer; import 'dart:developer' as developer;
import 'package:tetra_stats/widgets/stat_sell_num.dart'; import 'package:tetra_stats/widgets/stat_sell_num.dart';

View File

@ -2,7 +2,7 @@ name: tetra_stats
description: Track your and other player stats in TETR.IO description: Track your and other player stats in TETR.IO
publish_to: 'none' publish_to: 'none'
version: 1.4.0+14 version: 1.4.1+15
environment: environment:
sdk: '>=3.0.0' sdk: '>=3.0.0'

View File

@ -30,6 +30,7 @@
}, },
"openSearch": "Search player", "openSearch": "Search player",
"closeSearch": "Close search", "closeSearch": "Close search",
"searchHint": "Nickname, ID or Discord userID (with \"ds:\" prefix)",
"refresh": "Refresh", "refresh": "Refresh",
"fetchAndsaveTLHistory": "Get player history", "fetchAndsaveTLHistory": "Get player history",
"fetchAndSaveOldTLmatches": "Get Tetra League matches history", "fetchAndSaveOldTLmatches": "Get Tetra League matches history",
@ -130,7 +131,7 @@
"winChance": "Win Chance", "winChance": "Win Chance",
"byGlicko": "By Glicko", "byGlicko": "By Glicko",
"byEstTR": "By Est. TR", "byEstTR": "By Est. TR",
"compareViewNoValues": "Please, enter username, user ID, APM-PPS-VS values (divider doesn't matter, only order matter) or $avgR (where R is rank) to both of fields", "compareViewNoValues": "Please, enter username, user ID, APM-PPS-VS values (divider doesn't matter, only order matter) or $avgR (where R is rank) to both fields",
"compareViewWrongValue": "Falied to assign ${value}", "compareViewWrongValue": "Falied to assign ${value}",
"mostRecentOne": "Most recent one", "mostRecentOne": "Most recent one",
"yes": "Yes", "yes": "Yes",

View File

@ -30,6 +30,7 @@
}, },
"openSearch": "Искать игрока", "openSearch": "Искать игрока",
"closeSearch": "Закрыть поиск", "closeSearch": "Закрыть поиск",
"searchHint": "Ник, ID или ID в Discord (с префиксом \"ds:\")",
"refresh": "Обновить", "refresh": "Обновить",
"fetchAndsaveTLHistory": "Получить историю игрока", "fetchAndsaveTLHistory": "Получить историю игрока",
"fetchAndSaveOldTLmatches": "Получить старые матчи Тетра Лиги", "fetchAndSaveOldTLmatches": "Получить старые матчи Тетра Лиги",