Compare commits

...

2 Commits

Author SHA1 Message Date
dan63047 712a52ad7b I lied i forgor to fix things 2024-06-17 00:04:07 +03:00
dan63047 249c2c4a68 1.6.0 ready 2024-06-16 20:13:26 +03:00
22 changed files with 238 additions and 116 deletions

View File

@ -1222,7 +1222,7 @@ class News{
News(this.id, this.news);
News.fromJson(Map<String, dynamic> json, String? userID){
id = userID != null ? "user_${userID}" : json['news'].first['stream'];
id = userID != null ? "user_$userID" : json['news'].first['stream'];
news = [for (var entry in json['news']) NewsEntry.fromJson(entry)];
}
}

View File

@ -4,9 +4,9 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 2
/// Strings: 1144 (572 per locale)
/// Strings: 1182 (591 per locale)
///
/// Built on 2024-05-28 at 20:38 UTC
/// Built on 2024-06-16 at 21:03 UTC
// coverage:ignore-file
// ignore_for_file: type=lint
@ -157,6 +157,11 @@ class Translations implements BaseTranslations<AppLocale, Translations> {
String get history => 'History';
String get sprint => '40 Lines';
String get blitz => 'Blitz';
String get recent => 'Recent';
String get recentRuns => 'Recent runs';
String blitzScore({required Object p}) => '${p} points';
String get openSPreplay => 'Open replay in TETR.IO';
String get downloadSPreplay => 'Download replay';
String get other => 'Other';
String get distinguishment => 'Distinguishment';
String get zen => 'Zen';
@ -244,14 +249,28 @@ class Translations implements BaseTranslations<AppLocale, Translations> {
String get yourIDAlertTitle => 'Your nickname in TETR.IO';
String get yourIDText => 'When app loads, it will retrieve data for this account';
String get language => 'Language';
String get updateInBackground => 'Update stats in the background';
String get updateInBackgroundDescription => 'While Tetra Stats is running, it can update stats of the current player when cache expires';
String get customization => 'Customization';
String get customizationDescription => 'There is only one toggle, planned to add more settings';
String get customizationDescription => 'Change appearance of different things in Tetra Stats UI';
String get oskKagari => 'Osk Kagari gimmick';
String get oskKagariDescription => 'If on, osk\'s rank on main view will be rendered as :kagari:';
String get AccentColor => 'Accent color';
String get AccentColorDescription => 'Almost all interactive UI elements highlighted with this color';
String get timestamps => 'Timestamps';
String get timestampsDescription => 'You can choose, in which way timestamps shows time';
String get timestampsAbsoluteGMT => 'Absolute (GMT)';
String get timestampsAbsoluteLocalTime => 'Absolute (Your timezone)';
String get timestampsRelative => 'Relative';
String get rating => 'Main representation of rating';
String get ratingDescription => 'TR is not linear, while Glicko does not have boundaries and percentile is volatile';
String get ratingLBposition => 'LB position';
String get sheetbotGraphs => 'Sheetbot-like behavior for radar graphs';
String get sheetbotGraphsDescription => 'If on, points on the graphs can appear on the opposite half of the graph if value is negative';
String get lbStats => 'Show leaderboard based stats';
String get lbStatsDescription => 'That will impact on loading times, but will allow you to see position on LB by stats and comparison with average values';
String get aboutApp => 'About app';
String aboutAppText({required Object appName, required Object packageName, required Object version, required Object buildNumber}) => '${appName} (${packageName}) Version ${version} Build ${buildNumber}\n\nDeveloped by dan63047\nFormulas provided by kerrmunism\nHistory provided by p1nkl0bst3r\nTETR.IO replay grabber API by szy';
String get oskKagari => 'Osk Kagari gimmick';
String get oskKagariDescription => 'If on, osk\'s rank on main view will be rendered as :kagari:';
String stateViewTitle({required Object nickname, required Object date}) => '${nickname} account on ${date}';
String statesViewTitle({required Object number, required Object nickname}) => '${number} states of ${nickname} account';
String matchesViewTitle({required Object nickname}) => '${nickname} TL matches';
@ -833,6 +852,11 @@ class _StringsRu implements Translations {
@override String get history => 'История';
@override String get sprint => '40 линий';
@override String get blitz => 'Блиц';
@override String get recent => 'Недавно';
@override String get recentRuns => 'Недавние';
@override String blitzScore({required Object p}) => '${p} очков';
@override String get openSPreplay => 'Открыть повтор в TETR.IO';
@override String get downloadSPreplay => 'Скачать повтор';
@override String get other => 'Другое';
@override String get distinguishment => 'Заслуга';
@override String get zen => 'Дзен';
@ -920,14 +944,28 @@ class _StringsRu implements Translations {
@override String get yourIDAlertTitle => 'Ваш ник в TETR.IO';
@override String get yourIDText => 'При запуске приложения оно будет получать статистику этого игрока.';
@override String get language => 'Язык (Language)';
@override String get updateInBackground => 'Обновлять статистику в фоне';
@override String get updateInBackgroundDescription => 'Пока Tetra Stats работает, он может обновлять статистику самостоятельно когда кеш истекает';
@override String get customization => 'Кастомизация';
@override String get customizationDescription => 'Здесь только один переключатель, в планах добавить больше';
@override String get customizationDescription => 'Измените внешний вид пользовательского интерфейса Tetra Stats';
@override String get oskKagari => '"Оск Кагари" прикол';
@override String get oskKagariDescription => 'Если включено, вместо настоящего ранга оска будет рендерится :kagari:';
@override String get AccentColor => 'Цветовой акцент';
@override String get AccentColorDescription => 'Почти все интерактивные элементы пользовательского интерфейса окрашены в этот цвет';
@override String get timestamps => 'Метки времени';
@override String get timestampsDescription => 'Вы можете выбрать, каким образом метки времени показывают время';
@override String get timestampsAbsoluteGMT => 'Абсолютные (GMT)';
@override String get timestampsAbsoluteLocalTime => 'Абсолютные (Ваш часовой пояс)';
@override String get timestampsRelative => 'Относительные';
@override String get rating => 'Основное представление рейтинга';
@override String get ratingDescription => 'TR нелинеен, тогда как Glicko не имеет границ, а положение в таблице лидеров волатильно';
@override String get ratingLBposition => 'Позиция в рейтинге';
@override String get sheetbotGraphs => 'Графики-радары как у sheetBot';
@override String get sheetbotGraphsDescription => 'Если включено, точки на графике могут появляться на противоположной стороне графика если значение отрицательное';
@override String get lbStats => 'Показывать статистику, основанную на рейтинговой таблице';
@override String get lbStatsDescription => 'Это повлияет на время загрузки, но позволит видеть положение в рейтинге и сравнение со средними значениями по рангу по каждой стате';
@override String get aboutApp => 'О приложении';
@override String aboutAppText({required Object appName, required Object packageName, required Object version, required Object buildNumber}) => '${appName} (${packageName}) Версия ${version} Сборка ${buildNumber}\n\nРазработал dan63047\nФормулы предоставил kerrmunism\nИсторию предоставляет p1nkl0bst3r\nВозможность скачивать повторы из TETR.IO предоставляет szy';
@override String get oskKagari => '"Оск Кагари" прикол';
@override String get oskKagariDescription => 'Если включено, вместо настоящего ранга оска будет рендерится :kagari:';
@override String stateViewTitle({required Object nickname, required Object date}) => 'Аккаунт ${nickname} ${date}';
@override String statesViewTitle({required Object number, required Object nickname}) => '${number} состояний аккаунта ${nickname}';
@override String matchesViewTitle({required Object nickname}) => 'Матчи аккаунта ${nickname}';
@ -1489,6 +1527,11 @@ extension on Translations {
case 'history': return 'History';
case 'sprint': return '40 Lines';
case 'blitz': return 'Blitz';
case 'recent': return 'Recent';
case 'recentRuns': return 'Recent runs';
case 'blitzScore': return ({required Object p}) => '${p} points';
case 'openSPreplay': return 'Open replay in TETR.IO';
case 'downloadSPreplay': return 'Download replay';
case 'other': return 'Other';
case 'distinguishment': return 'Distinguishment';
case 'zen': return 'Zen';
@ -1588,14 +1631,28 @@ extension on Translations {
case 'yourIDAlertTitle': return 'Your nickname in TETR.IO';
case 'yourIDText': return 'When app loads, it will retrieve data for this account';
case 'language': return 'Language';
case 'updateInBackground': return 'Update stats in the background';
case 'updateInBackgroundDescription': return 'While Tetra Stats is running, it can update stats of the current player when cache expires';
case 'customization': return 'Customization';
case 'customizationDescription': return 'There is only one toggle, planned to add more settings';
case 'customizationDescription': return 'Change appearance of different things in Tetra Stats UI';
case 'oskKagari': return 'Osk Kagari gimmick';
case 'oskKagariDescription': return 'If on, osk\'s rank on main view will be rendered as :kagari:';
case 'AccentColor': return 'Accent color';
case 'AccentColorDescription': return 'Almost all interactive UI elements highlighted with this color';
case 'timestamps': return 'Timestamps';
case 'timestampsDescription': return 'You can choose, in which way timestamps shows time';
case 'timestampsAbsoluteGMT': return 'Absolute (GMT)';
case 'timestampsAbsoluteLocalTime': return 'Absolute (Your timezone)';
case 'timestampsRelative': return 'Relative';
case 'rating': return 'Main representation of rating';
case 'ratingDescription': return 'TR is not linear, while Glicko does not have boundaries and percentile is volatile';
case 'ratingLBposition': return 'LB position';
case 'sheetbotGraphs': return 'Sheetbot-like behavior for radar graphs';
case 'sheetbotGraphsDescription': return 'If on, points on the graphs can appear on the opposite half of the graph if value is negative';
case 'lbStats': return 'Show leaderboard based stats';
case 'lbStatsDescription': return 'That will impact on loading times, but will allow you to see position on LB by stats and comparison with average values';
case 'aboutApp': return 'About app';
case 'aboutAppText': return ({required Object appName, required Object packageName, required Object version, required Object buildNumber}) => '${appName} (${packageName}) Version ${version} Build ${buildNumber}\n\nDeveloped by dan63047\nFormulas provided by kerrmunism\nHistory provided by p1nkl0bst3r\nTETR.IO replay grabber API by szy';
case 'oskKagari': return 'Osk Kagari gimmick';
case 'oskKagariDescription': return 'If on, osk\'s rank on main view will be rendered as :kagari:';
case 'stateViewTitle': return ({required Object nickname, required Object date}) => '${nickname} account on ${date}';
case 'statesViewTitle': return ({required Object number, required Object nickname}) => '${number} states of ${nickname} account';
case 'matchesViewTitle': return ({required Object nickname}) => '${nickname} TL matches';
@ -2081,6 +2138,11 @@ extension on _StringsRu {
case 'history': return 'История';
case 'sprint': return '40 линий';
case 'blitz': return 'Блиц';
case 'recent': return 'Недавно';
case 'recentRuns': return 'Недавние';
case 'blitzScore': return ({required Object p}) => '${p} очков';
case 'openSPreplay': return 'Открыть повтор в TETR.IO';
case 'downloadSPreplay': return 'Скачать повтор';
case 'other': return 'Другое';
case 'distinguishment': return 'Заслуга';
case 'zen': return 'Дзен';
@ -2180,14 +2242,28 @@ extension on _StringsRu {
case 'yourIDAlertTitle': return 'Ваш ник в TETR.IO';
case 'yourIDText': return 'При запуске приложения оно будет получать статистику этого игрока.';
case 'language': return 'Язык (Language)';
case 'updateInBackground': return 'Обновлять статистику в фоне';
case 'updateInBackgroundDescription': return 'Пока Tetra Stats работает, он может обновлять статистику самостоятельно когда кеш истекает';
case 'customization': return 'Кастомизация';
case 'customizationDescription': return 'Здесь только один переключатель, в планах добавить больше';
case 'customizationDescription': return 'Измените внешний вид пользовательского интерфейса Tetra Stats';
case 'oskKagari': return '"Оск Кагари" прикол';
case 'oskKagariDescription': return 'Если включено, вместо настоящего ранга оска будет рендерится :kagari:';
case 'AccentColor': return 'Цветовой акцент';
case 'AccentColorDescription': return 'Почти все интерактивные элементы пользовательского интерфейса окрашены в этот цвет';
case 'timestamps': return 'Метки времени';
case 'timestampsDescription': return 'Вы можете выбрать, каким образом метки времени показывают время';
case 'timestampsAbsoluteGMT': return 'Абсолютные (GMT)';
case 'timestampsAbsoluteLocalTime': return 'Абсолютные (Ваш часовой пояс)';
case 'timestampsRelative': return 'Относительные';
case 'rating': return 'Основное представление рейтинга';
case 'ratingDescription': return 'TR нелинеен, тогда как Glicko не имеет границ, а положение в таблице лидеров волатильно';
case 'ratingLBposition': return 'Позиция в рейтинге';
case 'sheetbotGraphs': return 'Графики-радары как у sheetBot';
case 'sheetbotGraphsDescription': return 'Если включено, точки на графике могут появляться на противоположной стороне графика если значение отрицательное';
case 'lbStats': return 'Показывать статистику, основанную на рейтинговой таблице';
case 'lbStatsDescription': return 'Это повлияет на время загрузки, но позволит видеть положение в рейтинге и сравнение со средними значениями по рангу по каждой стате';
case 'aboutApp': return 'О приложении';
case 'aboutAppText': return ({required Object appName, required Object packageName, required Object version, required Object buildNumber}) => '${appName} (${packageName}) Версия ${version} Сборка ${buildNumber}\n\nРазработал dan63047\nФормулы предоставил kerrmunism\nИсторию предоставляет p1nkl0bst3r\nВозможность скачивать повторы из TETR.IO предоставляет szy';
case 'oskKagari': return '"Оск Кагари" прикол';
case 'oskKagariDescription': return 'Если включено, вместо настоящего ранга оска будет рендерится :kagari:';
case 'stateViewTitle': return ({required Object nickname, required Object date}) => 'Аккаунт ${nickname} ${date}';
case 'statesViewTitle': return ({required Object number, required Object nickname}) => '${number} состояний аккаунта ${nickname}';
case 'matchesViewTitle': return ({required Object nickname}) => 'Матчи аккаунта ${nickname}';

View File

@ -1,10 +1,8 @@
import 'dart:async';
import 'dart:io';
import 'dart:isolate';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:developer' as developer;
import 'package:package_info_plus/package_info_plus.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -29,37 +27,37 @@ late SharedPreferences prefs;
late TetrioService teto;
ThemeData theme = ThemeData(fontFamily: 'Eurostile Round', colorScheme: const ColorScheme.dark(primary: Colors.cyanAccent, secondary: Colors.white), scaffoldBackgroundColor: Colors.black);
Future<dynamic> computeIsolate(Future Function() function) async {
final receivePort = ReceivePort();
var rootToken = RootIsolateToken.instance!;
await Isolate.spawn<_IsolateData>(
_isolateEntry,
_IsolateData(
token: rootToken,
function: function,
answerPort: receivePort.sendPort,
),
);
return await receivePort.first;
}
// Future<dynamic> computeIsolate(Future Function() function) async {
// final receivePort = ReceivePort();
// var rootToken = RootIsolateToken.instance!;
// await Isolate.spawn<_IsolateData>(
// _isolateEntry,
// _IsolateData(
// token: rootToken,
// function: function,
// answerPort: receivePort.sendPort,
// ),
// );
// return await receivePort.first;
// }
void _isolateEntry(_IsolateData isolateData) async {
BackgroundIsolateBinaryMessenger.ensureInitialized(isolateData.token);
final answer = await isolateData.function();
isolateData.answerPort.send(answer);
}
// void _isolateEntry(_IsolateData isolateData) async {
// BackgroundIsolateBinaryMessenger.ensureInitialized(isolateData.token);
// final answer = await isolateData.function();
// isolateData.answerPort.send(answer);
// }
class _IsolateData {
final RootIsolateToken token;
final Function function;
final SendPort answerPort;
// class _IsolateData {
// final RootIsolateToken token;
// final Function function;
// final SendPort answerPort;
_IsolateData({
required this.token,
required this.function,
required this.answerPort,
});
}
// _IsolateData({
// required this.token,
// required this.function,
// required this.answerPort,
// });
// }
final router = GoRouter(
initialLocation: "/",
@ -145,9 +143,9 @@ void main() async {
}
// I dont want to store old cache
Timer.periodic(Duration(minutes: 5), (Timer timer) {
Timer.periodic(const Duration(minutes: 5), (Timer timer) {
teto.cacheRoutine();
developer.log("Cache routine complete, next one in ${DateTime.now().add(Duration(minutes: 5))}", name: "main");
developer.log("Cache routine complete, next one in ${DateTime.now().add(const Duration(minutes: 5))}", name: "main");
// if (prefs.getBool("updateInBG") == true) teto.fetchTracked(); // TODO: Somehow avoid doing that in main isolate
});
@ -164,6 +162,12 @@ class MyApp extends StatefulWidget {
}
class MyAppState extends State<MyApp> {
@override
void initState() {
setAccentColor(prefs.getInt("accentColor") != null ? Color(prefs.getInt("accentColor")!) : Colors.cyanAccent);
super.initState();
}
void setAccentColor(Color color){ // does this thing work??? yes??? no???
setState(() {

View File

@ -1,3 +1,5 @@
// ignore_for_file: type_literal_in_constant_pattern
import 'dart:async';
import 'dart:convert';
import 'dart:developer' as developer;
@ -87,7 +89,7 @@ class CacheController {
case Cutoffs:
return object.runtimeType.toString();
case TetrioPlayerFromLeaderboard: // i may be a little stupid
return object.runtimeType.toString()+"topone";
return "${object.runtimeType}topone";
case TetraLeagueAlphaStream:
return object.runtimeType.toString()+object.userId;
case SingleplayerStream:

View File

@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:io';
import 'dart:math';
import 'package:flutter/foundation.dart';

View File

@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'package:tetra_stats/views/settings_view.dart' show subtitleStyle;
import 'package:tetra_stats/main.dart' show MyApp, MyAppState, prefs, setAccentColor;
import 'package:tetra_stats/main.dart' show MyAppState, prefs;
import 'package:tetra_stats/gen/strings.g.dart';
import 'package:window_manager/window_manager.dart';
@ -89,7 +89,8 @@ class CustomizationState extends State<CustomizationView> {
child: ListView(
children: [
ListTile(
title: const Text("Accent color"),
title: Text(t.AccentColor),
subtitle: Text(t.AccentColorDescription, style: subtitleStyle),
trailing: ColorIndicator(HSVColor.fromColor(Theme.of(context).colorScheme.primary), width: 25, height: 25),
onTap: () {
showDialog(
@ -108,6 +109,7 @@ class CustomizationState extends State<CustomizationView> {
onPressed: () {
setState(() {
context.findAncestorStateOfType<MyAppState>()?.setAccentColor(pickerColor);
prefs.setInt("accentColor", pickerColor.value);
});
Navigator.of(context).pop();
},
@ -119,22 +121,14 @@ class CustomizationState extends State<CustomizationView> {
// title: Text("Stats Table in TL mathes list"),
// subtitle: Text("Not implemented"),
// ),
ListTile(title: Text(t.oskKagari),
subtitle: Text(t.oskKagariDescription, style: subtitleStyle),
trailing: Switch(value: oskKagariGimmick, onChanged: (bool value){
prefs.setBool("oskKagariGimmick", value);
setState(() {
oskKagariGimmick = value;
});
}),),
ListTile(title: Text("Timestamps"),
subtitle: Text(t.oskKagariDescription, style: subtitleStyle),
ListTile(title: Text(t.timestamps),
subtitle: Text(t.timestampsDescription, style: subtitleStyle),
trailing: DropdownButton(
value: timestampMode,
items: <DropdownMenuItem>[
DropdownMenuItem(value: 0, child: Text("Absolute (GMT)")),
DropdownMenuItem(value: 1, child: Text("Absolute (Local Time)")),
DropdownMenuItem(value: 2, child: Text("Relative"))
DropdownMenuItem(value: 0, child: Text(t.timestampsAbsoluteGMT)),
DropdownMenuItem(value: 1, child: Text(t.timestampsAbsoluteLocalTime)),
DropdownMenuItem(value: 2, child: Text(t.timestampsRelative))
],
onChanged: (dynamic value){
prefs.setInt("timestampMode", value);
@ -144,14 +138,14 @@ class CustomizationState extends State<CustomizationView> {
},
),
),
ListTile(title: Text("Main representation of rating"),
subtitle: Text(t.oskKagariDescription, style: subtitleStyle),
ListTile(title: Text(t.rating),
subtitle: Text(t.ratingDescription, style: subtitleStyle),
trailing: DropdownButton(
value: ratingMode,
items: <DropdownMenuItem>[
DropdownMenuItem(value: 0, child: Text("TR")),
DropdownMenuItem(value: 1, child: Text("Glicko")),
DropdownMenuItem(value: 2, child: Text("LB position"))
const DropdownMenuItem(value: 0, child: Text("TR")),
const DropdownMenuItem(value: 1, child: Text("Glicko")),
DropdownMenuItem(value: 2, child: Text(t.ratingLBposition))
],
onChanged: (dynamic value){
prefs.setInt("ratingMode", value);
@ -161,13 +155,21 @@ class CustomizationState extends State<CustomizationView> {
},
),
),
ListTile(title: Text("Sheetbot-like behavior for radar graphs"),
subtitle: Text(t.oskKagariDescription, style: subtitleStyle),
ListTile(title: Text(t.sheetbotGraphs),
subtitle: Text(t.sheetbotGraphsDescription, style: subtitleStyle),
trailing: Switch(value: sheetbotRadarGraphs, onChanged: (bool value){
prefs.setBool("sheetbotRadarGraphs", value);
setState(() {
sheetbotRadarGraphs = value;
});
}),),
ListTile(title: Text(t.oskKagari),
subtitle: Text(t.oskKagariDescription, style: subtitleStyle),
trailing: Switch(value: oskKagariGimmick, onChanged: (bool value){
prefs.setBool("oskKagariGimmick", value);
setState(() {
oskKagariGimmick = value;
});
}),)
],
)),

View File

@ -1,4 +1,4 @@
// ignore_for_file: type_literal_in_constant_pattern
// ignore_for_file: type_literal_in_constant_pattern, use_build_context_synchronously
import 'dart:async';
import 'dart:io';
@ -75,7 +75,7 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
//var tableData = <TableRow>[];
final bodyGlobalKey = GlobalKey();
bool _showSearchBar = false;
Timer backgroundUpdate = Timer(Duration(days: 365), (){});
Timer backgroundUpdate = Timer(const Duration(days: 365), (){});
bool _TLHistoryWasFetched = false;
late TabController _tabController;
late TabController _wideScreenTabController;
@ -438,7 +438,7 @@ class _MainState extends State<MainView> with TickerProviderStateMixin {
Tab(text: t.history),
Tab(text: t.sprint),
Tab(text: t.blitz),
Tab(text: "Recent runs"),
Tab(text: t.recentRuns),
Tab(text: t.other),
],
),
@ -743,7 +743,7 @@ class _TLRecords extends StatelessWidget {
leading: Text("${data[index].endContext.firstWhere((element) => element.userId == userID).points} : ${data[index].endContext.firstWhere((element) => element.userId != userID).points}",
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}"),
subtitle: Text(timestamp(data[index].timestamp), style: TextStyle(color: Colors.grey)),
subtitle: Text(timestamp(data[index].timestamp), style: const TextStyle(color: Colors.grey)),
trailing: TrailingStats(
data[index].endContext.firstWhere((element) => element.userId == userID).secondary,
data[index].endContext.firstWhere((element) => element.userId == userID).tertiary,
@ -1089,8 +1089,8 @@ class _TwoRecordsThingy extends StatelessWidget {
crossAxisAlignment: WrapCrossAlignment.start,
spacing: 20,
children: [
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://tetr.io/#r:${sprint!.replayId}"));}, child: Text("Open replay in TETR.IO")),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://inoue.szy.lol/api/replay/${sprint!.replayId}"));}, child: Text("Download replay")),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://tetr.io/#r:${sprint!.replayId}"));}, child: Text(t.openSPreplay)),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://inoue.szy.lol/api/replay/${sprint!.replayId}"));}, child: Text(t.downloadSPreplay)),
],
),
if (sprintStream.records.length > 1) SizedBox(
@ -1102,8 +1102,8 @@ class _TwoRecordsThingy extends StatelessWidget {
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => SingleplayerRecordView(record: sprintStream.records[i]))),
leading: Text("#${i+1}", style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28, shadows: textShadow, height: 0.9) ),
title: Text(get40lTime(sprintStream.records[i].endContext.finalTime.inMicroseconds),
style: TextStyle(fontSize: 18)),
subtitle: Text(timestamp(sprintStream.records[i].timestamp), style: TextStyle(color: Colors.grey, height: 0.85)),
style: const TextStyle(fontSize: 18)),
subtitle: Text(timestamp(sprintStream.records[i].timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)),
trailing: SpTrailingStats(sprintStream.records[i].endContext)
)
],
@ -1175,8 +1175,8 @@ class _TwoRecordsThingy extends StatelessWidget {
crossAxisAlignment: WrapCrossAlignment.start,
spacing: 20,
children: [
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://tetr.io/#r:${blitz!.replayId}"));}, child: Text("Open replay in TETR.IO")),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://inoue.szy.lol/api/replay/${blitz!.replayId}"));}, child: Text("Download replay")),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://tetr.io/#r:${blitz!.replayId}"));}, child: Text(t.openSPreplay)),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://inoue.szy.lol/api/replay/${blitz!.replayId}"));}, child: Text(t.downloadSPreplay)),
],
),
if (blitzStream.records.length > 1) SizedBox(
@ -1188,8 +1188,8 @@ class _TwoRecordsThingy extends StatelessWidget {
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => SingleplayerRecordView(record: blitzStream.records[i]))),
leading: Text("#${i+1}", style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 28, shadows: textShadow, height: 0.9) ),
title: Text("${NumberFormat.decimalPattern().format(blitzStream.records[i].endContext.score)} points",
style: TextStyle(fontSize: 18)),
subtitle: Text(timestamp(blitzStream.records[i].timestamp), style: TextStyle(color: Colors.grey, height: 0.85)),
style: const TextStyle(fontSize: 18)),
subtitle: Text(timestamp(blitzStream.records[i].timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)),
trailing: SpTrailingStats(blitzStream.records[i].endContext)
)
],

View File

@ -263,8 +263,8 @@ class SettingsState extends State<SettingsView> {
onTap: () {
context.go("/settings/customization");
},),
ListTile(title: Text("Update stats in the background"),
subtitle: Text("While tetra stats is running, it can update stats of the current player when cache expires", style: const TextStyle(fontFamily: "Eurostile Round Condensed", color: Colors.grey)),
ListTile(title: Text(t.updateInBackground),
subtitle: Text(t.updateInBackgroundDescription, style: const TextStyle(fontFamily: "Eurostile Round Condensed", color: Colors.grey)),
trailing: Switch(value: updateInBG, onChanged: (bool value){
prefs.setBool("updateInBG", value);
setState(() {

View File

@ -60,7 +60,7 @@ class SprintAndBlitzState extends State<SprintAndBlitzView> {
Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
border: TableBorder.all(color: Colors.grey.shade900),
columnWidths: {0: const FixedColumnWidth(48)},
columnWidths: const {0: FixedColumnWidth(48)},
children: [
TableRow(
children: [

View File

@ -1,4 +1,4 @@
// ignore_for_file: use_build_context_synchronously
// ignore_for_file: use_build_context_synchronously, type_literal_in_constant_pattern
import 'dart:io';
import 'package:tetra_stats/data_objects/tetrio_multiplayer_replay.dart';

View File

@ -1,3 +1,5 @@
// ignore_for_file: curly_braces_in_flow_control_structures
import 'package:flutter/material.dart';
import 'package:tetra_stats/data_objects/tetrio.dart';
import 'package:tetra_stats/utils/numers_formats.dart';

View File

@ -1,3 +1,5 @@
// ignore_for_file: curly_braces_in_flow_control_structures
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_gauges/gauges.dart';
import 'package:tetra_stats/data_objects/tetrio.dart';

View File

@ -5,7 +5,6 @@ import 'package:tetra_stats/gen/strings.g.dart';
import 'package:tetra_stats/utils/relative_timestamps.dart';
import 'package:tetra_stats/utils/text_shadow.dart';
import 'package:tetra_stats/views/singleplayer_record_view.dart';
import 'package:tetra_stats/widgets/singleplayer_record.dart';
import 'package:tetra_stats/widgets/sp_trailing_stats.dart';
import 'package:tetra_stats/widgets/text_timestamp.dart';
@ -19,9 +18,9 @@ class RecentSingleplayerGames extends StatelessWidget{
Widget build(BuildContext context) {
return Column(
children: [
if (!hideTitle) const Padding(
padding: EdgeInsets.only(bottom: 8.0),
child: Text("Recent", style: TextStyle(height: 0.1, fontFamily: "Eurostile Round Extended", fontSize: 18)),
if (!hideTitle) Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(t.recent, style: const TextStyle(height: 0.1, fontFamily: "Eurostile Round Extended", fontSize: 18)),
),
for(RecordSingle record in recent.records) ListTile(
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => SingleplayerRecordView(record: record))),
@ -37,12 +36,12 @@ class RecentSingleplayerGames extends StatelessWidget{
title: Text(
switch (record.endContext.gameType){
"40l" => get40lTime(record.endContext.finalTime.inMicroseconds),
"blitz" => "${NumberFormat.decimalPattern().format(record.endContext.score)} points",
"blitz" => t.blitzScore(p: NumberFormat.decimalPattern().format(record.endContext.score)),
"5mblast" => get40lTime(record.endContext.finalTime.inMicroseconds),
String() => "huh",
},
style: const TextStyle(fontSize: 18)),
subtitle: Text(timestamp(record.timestamp), style: TextStyle(color: Colors.grey, height: 0.85)),
subtitle: Text(timestamp(record.timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)),
trailing: SpTrailingStats(record.endContext)
)
],

View File

@ -131,8 +131,8 @@ class SingleplayerRecord extends StatelessWidget {
crossAxisAlignment: WrapCrossAlignment.start,
spacing: 20,
children: [
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://tetr.io/#r:${record!.replayId}"));}, child: Text("Open replay in TETR.IO")),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://inoue.szy.lol/api/replay/${record!.replayId}"));}, child: Text("Download replay")),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://tetr.io/#r:${record!.replayId}"));}, child: Text(t.openSPreplay)),
TextButton(onPressed: (){launchInBrowser(Uri.parse("https://inoue.szy.lol/api/replay/${record!.replayId}"));}, child: Text(t.downloadSPreplay)),
],
),
if (stream != null && stream!.records.length > 1) for(int i = 1; i < stream!.records.length; i++) ListTile(
@ -143,12 +143,12 @@ class SingleplayerRecord extends StatelessWidget {
title: Text(
switch (stream!.records[i].endContext.gameType){
"40l" => get40lTime(stream!.records[i].endContext.finalTime.inMicroseconds),
"blitz" => "${NumberFormat.decimalPattern().format(stream!.records[i].endContext.score)} points",
"blitz" => t.blitzScore(p: NumberFormat.decimalPattern().format(stream!.records[i].endContext.score)),
"5mblast" => get40lTime(stream!.records[i].endContext.finalTime.inMicroseconds),
String() => "huh",
},
style: TextStyle(fontSize: 18)),
subtitle: Text(timestamp(stream!.records[i].timestamp), style: TextStyle(color: Colors.grey, height: 0.85)),
style: const TextStyle(fontSize: 18)),
subtitle: Text(timestamp(stream!.records[i].timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)),
trailing: SpTrailingStats(stream!.records[i].endContext)
)
]

View File

@ -5,7 +5,7 @@ import 'package:tetra_stats/utils/numers_formats.dart';
class SpTrailingStats extends StatelessWidget{
final EndContextSingle endContext;
const SpTrailingStats(this.endContext);
const SpTrailingStats(this.endContext, {super.key});
@override
Widget build(BuildContext context) {

View File

@ -1,5 +1,3 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart';

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:tetra_stats/gen/strings.g.dart';
import 'package:tetra_stats/main.dart';

View File

@ -13,7 +13,7 @@ class TLRatingThingy extends StatelessWidget{
final TetraLeagueAlpha? oldTl;
final double? topTR;
const TLRatingThingy({required this.userID, required this.tlData, this.oldTl, this.topTR});
const TLRatingThingy({super.key, required this.userID, required this.tlData, this.oldTl, this.topTR});
@override
Widget build(BuildContext context) {
@ -44,7 +44,7 @@ class TLRatingThingy extends StatelessWidget{
TextSpan(text: " Glicko", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28))
],
2 => [
TextSpan(text: "Top ${formatedPercentile[0]}", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
TextSpan(text: "${t.top} ${formatedPercentile[0]}", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
if (formatedPercentile.elementAtOrNull(1) != null) TextSpan(text: decimalSeparator + formatedPercentile[1]),
TextSpan(text: " %", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28))
],
@ -77,7 +77,7 @@ class TLRatingThingy extends StatelessWidget{
text: TextSpan(
style: DefaultTextStyle.of(context).style,
children: [
TextSpan(text: prefs.getInt("ratingMode") == 2 ? "${f2.format(tlData.rating)} TR • % rank: ${tlData.percentileRank.toUpperCase()}" : "${t.top} ${f2.format(tlData.percentile * 100)}% (${tlData.percentileRank.toUpperCase()})"),
TextSpan(text: prefs.getInt("ratingMode") == 2 ? "${f2.format(tlData.rating)} TR • % ${t.rank}: ${tlData.percentileRank.toUpperCase()}" : "${t.top} ${f2.format(tlData.percentile * 100)}% (${tlData.percentileRank.toUpperCase()})"),
if (tlData.bestRank != "z") const TextSpan(text: ""),
if (tlData.bestRank != "z") TextSpan(text: "${t.topRank}: ${tlData.bestRank.toUpperCase()}"),
if (topTR != null) TextSpan(text: " (${f2.format(topTR)} TR)"),

View File

@ -58,7 +58,7 @@ class _TLThingyState extends State<TLThingy> {
final t = Translations.of(context);
String decimalSeparator = f2.symbols.DECIMAL_SEP;
List<String> estTRformated = f2.format(currentTl.estTr!.esttr).split(decimalSeparator);
List<String> estTRaccFormated = intFDiff.format(currentTl.esttracc!).split(decimalSeparator);
List<String> estTRaccFormated = intFDiff.format(currentTl.esttracc!).split(".");
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) {
bool bigScreen = constraints.maxWidth >= 768;
@ -245,12 +245,10 @@ class _TLThingyState extends State<TLThingy> {
),
if (currentTl.estTr != null)
Padding(
padding: const EdgeInsets.fromLTRB(0, 20, 0, 20),
padding: const EdgeInsets.fromLTRB(8, 20, 8, 20),
child: Container(
//alignment: Alignment.center,
width: bigScreen ? MediaQuery.of(context).size.width * 0.4 : MediaQuery.of(context).size.width * 0.85,
height: 70,
constraints: const BoxConstraints(maxWidth: 768),
constraints: const BoxConstraints(maxWidth: 500),
child: Stack(
children: [
Positioned(

View File

@ -2,7 +2,7 @@ name: tetra_stats
description: Track your and other player stats in TETR.IO
publish_to: 'none'
version: 1.5.3+19
version: 1.6.0+20
environment:
sdk: '>=3.0.0'

View File

@ -8,6 +8,11 @@
"history": "History",
"sprint": "40 Lines",
"blitz": "Blitz",
"recent": "Recent",
"recentRuns": "Recent runs",
"blitzScore": "$p points",
"openSPreplay": "Open replay in TETR.IO",
"downloadSPreplay": "Download replay",
"other": "Other",
"distinguishment": "Distinguishment",
"zen": "Zen",
@ -109,14 +114,28 @@
"yourIDAlertTitle": "Your nickname in TETR.IO",
"yourIDText": "When app loads, it will retrieve data for this account",
"language": "Language",
"updateInBackground": "Update stats in the background",
"updateInBackgroundDescription": "While Tetra Stats is running, it can update stats of the current player when cache expires",
"customization": "Customization",
"customizationDescription": "There is only one toggle, planned to add more settings",
"customizationDescription": "Change appearance of different things in Tetra Stats UI",
"oskKagari": "Osk Kagari gimmick",
"oskKagariDescription": "If on, osk's rank on main view will be rendered as :kagari:",
"AccentColor": "Accent color",
"AccentColorDescription": "Almost all interactive UI elements highlighted with this color",
"timestamps": "Timestamps",
"timestampsDescription": "You can choose, in which way timestamps shows time",
"timestampsAbsoluteGMT": "Absolute (GMT)",
"timestampsAbsoluteLocalTime": "Absolute (Your timezone)",
"timestampsRelative": "Relative",
"rating": "Main representation of rating",
"ratingDescription": "TR is not linear, while Glicko does not have boundaries and percentile is volatile",
"ratingLBposition": "LB position",
"sheetbotGraphs": "Sheetbot-like behavior for radar graphs",
"sheetbotGraphsDescription": "If on, points on the graphs can appear on the opposite half of the graph if value is negative",
"lbStats": "Show leaderboard based stats",
"lbStatsDescription": "That will impact on loading times, but will allow you to see position on LB by stats and comparison with average values",
"aboutApp": "About app",
"aboutAppText": "${appName} (${packageName}) Version ${version} Build ${buildNumber}\n\nDeveloped by dan63047\nFormulas provided by kerrmunism\nHistory provided by p1nkl0bst3r\nTETR.IO replay grabber API by szy",
"oskKagari": "Osk Kagari gimmick",
"oskKagariDescription": "If on, osk's rank on main view will be rendered as :kagari:",
"stateViewTitle": "${nickname} account on ${date}",
"statesViewTitle": "${number} states of ${nickname} account",
"matchesViewTitle": "${nickname} TL matches",

View File

@ -8,6 +8,11 @@
"history": "История",
"sprint": "40 линий",
"blitz": "Блиц",
"recent": "Недавно",
"recentRuns": "Недавние",
"blitzScore": "$p очков",
"openSPreplay": "Открыть повтор в TETR.IO",
"downloadSPreplay": "Скачать повтор",
"other": "Другое",
"distinguishment": "Заслуга",
"zen": "Дзен",
@ -109,14 +114,28 @@
"yourIDAlertTitle": "Ваш ник в TETR.IO",
"yourIDText": "При запуске приложения оно будет получать статистику этого игрока.",
"language": "Язык (Language)",
"updateInBackground": "Обновлять статистику в фоне",
"updateInBackgroundDescription": "Пока Tetra Stats работает, он может обновлять статистику самостоятельно когда кеш истекает",
"customization": "Кастомизация",
"customizationDescription": "Здесь только один переключатель, в планах добавить больше",
"customizationDescription": "Измените внешний вид пользовательского интерфейса Tetra Stats",
"oskKagari": "\"Оск Кагари\" прикол",
"oskKagariDescription": "Если включено, вместо настоящего ранга оска будет рендерится :kagari:",
"AccentColor": "Цветовой акцент",
"AccentColorDescription": "Почти все интерактивные элементы пользовательского интерфейса окрашены в этот цвет",
"timestamps": "Метки времени",
"timestampsDescription": "Вы можете выбрать, каким образом метки времени показывают время",
"timestampsAbsoluteGMT": "Абсолютные (GMT)",
"timestampsAbsoluteLocalTime": "Абсолютные (Ваш часовой пояс)",
"timestampsRelative": "Относительные",
"rating": "Основное представление рейтинга",
"ratingDescription": "TR нелинеен, тогда как Glicko не имеет границ, а положение в таблице лидеров волатильно",
"ratingLBposition": "Позиция в рейтинге",
"sheetbotGraphs": "Графики-радары как у sheetBot",
"sheetbotGraphsDescription": "Если включено, точки на графике могут появляться на противоположной стороне графика если значение отрицательное",
"lbStats": "Показывать статистику, основанную на рейтинговой таблице",
"lbStatsDescription": "Это повлияет на время загрузки, но позволит видеть положение в рейтинге и сравнение со средними значениями по рангу по каждой стате",
"aboutApp": "О приложении",
"aboutAppText": "${appName} (${packageName}) Версия ${version} Сборка ${buildNumber}\n\nРазработал dan63047\nФормулы предоставил kerrmunism\nИсторию предоставляет p1nkl0bst3r\nВозможность скачивать повторы из TETR.IO предоставляет szy",
"oskKagari": "\"Оск Кагари\" прикол",
"oskKagariDescription": "Если включено, вместо настоящего ранга оска будет рендерится :kagari:",
"stateViewTitle": "Аккаунт ${nickname} ${date}",
"statesViewTitle": "${number} состояний аккаунта ${nickname}",
"matchesViewTitle": "Матчи аккаунта ${nickname}",