Window titles for views
I will check everything tomorrow (and tomorrow it will be released i guess)
This commit is contained in:
parent
c6d1e0787a
commit
51e8362859
|
@ -18,5 +18,8 @@ You can [download an app](https://github.com/dan63047/TetraStats/releases), or [
|
|||
|
||||
# Special thanks
|
||||
- **kerrmunism** — formulas
|
||||
- **p1nkl0bst3r** — providing players history
|
||||
- **osk** and his team — TETR.IO
|
||||
- **p1nkl0bst3r** — providing players history and peak TR
|
||||
- **osk** and his team — TETR.IO
|
||||
|
||||
## Legal note
|
||||
I do NOT own any assets located in `/res/*`, excluding app icon (`/res/icons/app.png`) and localization (`/res/i18n/*`), which is distributed under GNU license (as well, as this software)
|
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||
|
@ -13,6 +14,8 @@ import 'package:tetra_stats/views/settings_view.dart';
|
|||
import 'package:tetra_stats/views/tracked_players_view.dart';
|
||||
import 'package:tetra_stats/views/calc_view.dart';
|
||||
|
||||
late final PackageInfo packageInfo;
|
||||
|
||||
void main() async {
|
||||
if (kIsWeb) {
|
||||
sqfliteFfiInit();
|
||||
|
@ -22,10 +25,13 @@ void main() async {
|
|||
databaseFactory = databaseFactoryFfi;
|
||||
}
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await WindowManager.instance.ensureInitialized();
|
||||
windowManager.waitUntilReadyToShow().then((_) async {
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
await WindowManager.instance.ensureInitialized();
|
||||
windowManager.waitUntilReadyToShow().then((_) async {
|
||||
await windowManager.setTitle('Tetra Stats');
|
||||
});
|
||||
});
|
||||
}
|
||||
packageInfo = await PackageInfo.fromPlatform();
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
String? locale = prefs.getString("locale");
|
||||
if (locale == null){
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer' as developer;
|
||||
import 'package:tetra_stats/main.dart' show packageInfo;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:tetra_stats/services/custom_http_client.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
@ -56,7 +57,7 @@ class TetrioService extends DB {
|
|||
final Map<String, List<News>> _newsCache = {};
|
||||
final Map<String, Map<String, double?>> _topTRcache = {};
|
||||
final Map<String, TetraLeagueAlphaStream> _tlStreamsCache = {}; // i'm trying to respect oskware api It should look something like {"cached_until": TetrioPlayer}
|
||||
final client = UserAgentClient("ebany u rot yatogo kazino blyat' (Tetra Stats v1.2.4 dev build)", http.Client());
|
||||
final client = UserAgentClient("package info thingy: ${packageInfo.version} (Tetra Stats v1.2.4 dev build)", http.Client());
|
||||
static final TetrioService _shared = TetrioService._sharedInstance();
|
||||
factory TetrioService() => _shared;
|
||||
late final StreamController<Map<String, List<TetrioPlayer>>> _tetrioStreamController;
|
||||
|
@ -122,7 +123,7 @@ class TetrioService extends DB {
|
|||
|
||||
Uri url;
|
||||
if (kIsWeb) {
|
||||
url = Uri.https('ts.dan63.by', 'oskware_bridge.php', {"endpoint": "TLHistory", "user": id});
|
||||
url = Uri.https('ts.dan63.by', 'oskware_bridge.php', {"endpoint": "PeakTR", "user": id});
|
||||
} else {
|
||||
url = Uri.https('api.p1nkl0bst3r.xyz', 'toptr/$id');
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import 'dart:io';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tetra_stats/data_objects/tetrio.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
double? apm;
|
||||
double? pps;
|
||||
|
@ -11,6 +13,7 @@ NerdStats? nerdStats;
|
|||
EstTr? estTr;
|
||||
Playstyle? playstyle;
|
||||
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
||||
late String oldWindowTitle;
|
||||
|
||||
class CalcView extends StatefulWidget {
|
||||
const CalcView({Key? key}) : super(key: key);
|
||||
|
@ -28,11 +31,16 @@ class CalcState extends State<CalcView> {
|
|||
@override
|
||||
void initState() {
|
||||
_scrollController = ScrollController();
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${t.statsCalc}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
@ -6,6 +7,7 @@ import 'package:intl/intl.dart';
|
|||
import 'package:tetra_stats/data_objects/tetrio.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:tetra_stats/services/tetrio_crud.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
enum Mode{
|
||||
player,
|
||||
|
@ -18,8 +20,8 @@ Mode redSideMode = Mode.player;
|
|||
List<dynamic> theRedSide = [null, null, null];
|
||||
final TetrioService teto = TetrioService();
|
||||
final DateFormat dateFormat = DateFormat.yMd(LocaleSettings.currentLocale.languageCode).add_Hm();
|
||||
// ignore: unnecessary_string_escapes
|
||||
var numbersReg = RegExp(r'\d+(\.\d*)*');
|
||||
late String oldWindowTitle;
|
||||
|
||||
class CompareView extends StatefulWidget {
|
||||
final List<dynamic> greenSide;
|
||||
|
@ -42,6 +44,9 @@ class CompareState extends State<CompareView> {
|
|||
fetchGreenSide(widget.greenSide[0].userId);
|
||||
if (widget.redSide[0] != null) fetchRedSide(widget.redSide[0].userId);
|
||||
_scrollController = ScrollController();
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -51,6 +56,7 @@ class CompareState extends State<CompareView> {
|
|||
greenSideMode = Mode.player;
|
||||
theRedSide = [null, null, null];
|
||||
redSideMode = Mode.player;
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -253,6 +259,7 @@ class CompareState extends State<CompareView> {
|
|||
titleRedSide = t.averageXrank(rankLetter: theRedSide[2].rank.toUpperCase());
|
||||
break;
|
||||
}
|
||||
windowManager.setTitle("Tetra Stats: $titleGreenSide ${t.vs} $titleRedSide");
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text("$titleGreenSide ${t.vs} $titleRedSide")),
|
||||
backgroundColor: Colors.black,
|
||||
|
|
|
@ -29,9 +29,6 @@ late SharedPreferences prefs;
|
|||
var chartsData = <DropdownMenuItem<List<FlSpot>>>[];
|
||||
List historyShortTitles = ["TR", "Glicko", "RD", "APM", "PPS", "VS", "APP", "DS/S", "DS/P", "APP + DS/P", "VS/APM", "Cheese", "GbE", "wAPP", "Area", "eTR", "±eTR"];
|
||||
int chartsIndex = 0;
|
||||
const allowedHeightForPlayerIdInPixels = 40.0;
|
||||
const allowedHeightForPlayerBioInPixels = 30.0;
|
||||
const givenTextHeightByScreenPercentage = 0.3;
|
||||
final NumberFormat timeInSec = NumberFormat("#,###.###s.");
|
||||
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
||||
final NumberFormat secs = NumberFormat("00.###");
|
||||
|
@ -138,7 +135,7 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
|||
}
|
||||
_searchFor = me.userId;
|
||||
setState((){_titleNickname = me.username;});
|
||||
await windowManager.setTitle('Tetra Stats: $_titleNickname'); //TODO: Change window title on every view
|
||||
if (!Platform.isAndroid && !Platform.isIOS) await windowManager.setTitle(widget.title);
|
||||
late List<dynamic> requests;
|
||||
late TetraLeagueAlphaStream tlStream;
|
||||
late Map<String, dynamic> records;
|
||||
|
@ -400,19 +397,8 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
|||
return Center(child: Text(errText, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 42, fontWeight: FontWeight.bold), textAlign: TextAlign.center));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return const Center(
|
||||
child: Text('default case of FutureBuilder',
|
||||
style: TextStyle(
|
||||
fontFamily: "Eurostile Round Extended",
|
||||
fontSize: 42),
|
||||
textAlign: TextAlign.center));
|
||||
}
|
||||
return const Center(
|
||||
child: Text('end of FutureBuilder',
|
||||
style: TextStyle(
|
||||
fontFamily: "Eurostile Round Extended", fontSize: 42),
|
||||
textAlign: TextAlign.center));
|
||||
return const Center(child: Text('default case of FutureBuilder', style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42), textAlign: TextAlign.center));
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -1089,14 +1075,14 @@ class _OtherThingy extends StatelessWidget {
|
|||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 48),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(t.distinguishment, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)),
|
||||
Text(t.distinguishment, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28), textAlign: TextAlign.center),
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: DefaultTextStyle.of(context).style,
|
||||
children: getDistinguishmentSetOfWidgets(distinguishment!.header!),
|
||||
),
|
||||
),
|
||||
Text(distinguishment!.footer!, style: const TextStyle(fontSize: 18)),
|
||||
Text(distinguishment!.footer!, style: const TextStyle(fontSize: 18), textAlign: TextAlign.center),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tetra_stats/services/tetrio_crud.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:tetra_stats/views/tl_match_view.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
final TetrioService teto = TetrioService();
|
||||
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
||||
late String oldWindowTitle;
|
||||
|
||||
class MatchesView extends StatefulWidget {
|
||||
final String userID;
|
||||
|
@ -17,6 +20,22 @@ class MatchesView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class MatchesState extends State<MatchesView> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${t.matchesViewTitle(nickname: widget.username)}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose(){
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Translations.of(context);
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import 'dart:io';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.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/views/main_view.dart' show MainView, f4, f2;
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
var chartsShortTitlesDropdowns = <DropdownMenuItem>[for (MapEntry e in chartsShortTitles.entries) DropdownMenuItem(value: e.key, child: Text(e.value),)];
|
||||
Stats chartsX = Stats.tr;
|
||||
|
@ -14,6 +15,7 @@ Stats sortBy = Stats.tr;
|
|||
bool reversed = false;
|
||||
List<DropdownMenuItem> itemCountries = [for (MapEntry e in t.countries.entries) DropdownMenuItem(value: e.key, child: Text(e.value))];
|
||||
String country = "";
|
||||
late String oldWindowTitle;
|
||||
|
||||
class RankView extends StatefulWidget {
|
||||
final List rank;
|
||||
|
@ -31,6 +33,10 @@ class RankState extends State<RankView> with SingleTickerProviderStateMixin {
|
|||
void initState() {
|
||||
_scrollController = ScrollController();
|
||||
_tabController = TabController(length: 6, vsync: this);
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${widget.rank[1]["everyone"] ? t.everyoneAverages : t.rankAverages(rank: widget.rank[0].rank.toUpperCase())}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -38,6 +44,7 @@ class RankState extends State<RankView> with SingleTickerProviderStateMixin {
|
|||
void dispose() {
|
||||
_tabController.dispose();
|
||||
_scrollController.dispose();
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:tetra_stats/views/rank_averages_view.dart';
|
||||
import 'package:tetra_stats/views/tl_leaderboard_view.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
class RankAveragesView extends StatefulWidget {
|
||||
const RankAveragesView({Key? key}) : super(key: key);
|
||||
|
@ -11,18 +13,29 @@ class RankAveragesView extends StatefulWidget {
|
|||
State<StatefulWidget> createState() => RanksAverages();
|
||||
}
|
||||
|
||||
late String oldWindowTitle;
|
||||
|
||||
class RanksAverages extends State<RankAveragesView> {
|
||||
Map<String, List<dynamic>> averages = {};
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
teto.fetchTLLeaderboard().then((value) {averages = value.averages; setState(() {
|
||||
});});
|
||||
teto.fetchTLLeaderboard().then((value){
|
||||
averages = value.averages;
|
||||
setState(() {});
|
||||
});
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${t.rankAveragesViewTitle}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
import 'dart:io';
|
||||
import 'package:tetra_stats/main.dart' show packageInfo;
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:tetra_stats/services/crud_exceptions.dart';
|
||||
import 'package:tetra_stats/services/tetrio_crud.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
late String oldWindowTitle;
|
||||
|
||||
class SettingsView extends StatefulWidget {
|
||||
const SettingsView({Key? key}) : super(key: key);
|
||||
|
@ -19,11 +22,6 @@ class SettingsView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class SettingsState extends State<SettingsView> {
|
||||
PackageInfo _packageInfo = PackageInfo(
|
||||
appName: "TetraStats",
|
||||
packageName: "idk man",
|
||||
version: "some numbers",
|
||||
buildNumber: "anotherNumber");
|
||||
late SharedPreferences prefs;
|
||||
final TetrioService teto = TetrioService();
|
||||
String defaultNickname = "Checking...";
|
||||
|
@ -31,16 +29,18 @@ class SettingsState extends State<SettingsView> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
_initPackageInfo();
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${t.settings}");
|
||||
}
|
||||
_getPreferences();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> _initPackageInfo() async {
|
||||
final info = await PackageInfo.fromPlatform();
|
||||
setState(() {
|
||||
_packageInfo = info;
|
||||
});
|
||||
@override
|
||||
void dispose(){
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _launchInBrowser(Uri url) async {
|
||||
|
@ -251,7 +251,7 @@ class SettingsState extends State<SettingsView> {
|
|||
_launchInBrowser(Uri.https("github.com", "dan63047/TetraStats"));
|
||||
},
|
||||
title: Text(t.aboutApp),
|
||||
subtitle: Text(t.aboutAppText(appName: _packageInfo.appName, packageName: _packageInfo.packageName, version: _packageInfo.version, buildNumber: _packageInfo.buildNumber)),
|
||||
subtitle: Text(t.aboutAppText(appName: packageInfo.appName, packageName: packageInfo.packageName, version: packageInfo.version, buildNumber: packageInfo.buildNumber)),
|
||||
),
|
||||
],
|
||||
)),
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tetra_stats/data_objects/tetrio.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:tetra_stats/widgets/tl_thingy.dart';
|
||||
import 'package:tetra_stats/widgets/user_thingy.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
final DateFormat dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms();
|
||||
|
||||
|
@ -15,15 +17,28 @@ class StateView extends StatefulWidget {
|
|||
State<StatefulWidget> createState() => StateState();
|
||||
}
|
||||
|
||||
late String oldWindowTitle;
|
||||
|
||||
class StateState extends State<StateView> {
|
||||
late ScrollController _scrollController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_scrollController = ScrollController();
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${t.stateViewTitle(nickname: widget.state.username.toUpperCase(), date: dateFormat.format(widget.state.state))}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _justUpdate() {
|
||||
setState(() {});
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tetra_stats/data_objects/tetrio.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:tetra_stats/views/mathes_view.dart';
|
||||
import 'package:tetra_stats/views/state_view.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
class StatesView extends StatefulWidget {
|
||||
final List<TetrioPlayer> states;
|
||||
|
@ -13,7 +15,24 @@ class StatesView extends StatefulWidget {
|
|||
State<StatefulWidget> createState() => StatesState();
|
||||
}
|
||||
|
||||
late String oldWindowTitle;
|
||||
|
||||
class StatesState extends State<StatesView> {
|
||||
@override
|
||||
void initState() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${t.statesViewTitle(number: widget.states.length, nickname: widget.states.last.username.toUpperCase())}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Translations.of(context);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tetra_stats/data_objects/tetrio.dart';
|
||||
|
@ -6,6 +7,7 @@ import 'package:tetra_stats/services/tetrio_crud.dart';
|
|||
import 'package:tetra_stats/views/main_view.dart';
|
||||
import 'package:tetra_stats/views/rank_averages_view.dart';
|
||||
import 'package:tetra_stats/views/ranks_averages_view.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
final TetrioService teto = TetrioService();
|
||||
List<DropdownMenuItem> itemStats = [for (MapEntry e in chartsShortTitles.entries) DropdownMenuItem(value: e.key, child: Text(e.value))];
|
||||
|
@ -13,6 +15,7 @@ Stats sortBy = Stats.tr;
|
|||
bool reversed = false;
|
||||
List<DropdownMenuItem> itemCountries = [for (MapEntry e in t.countries.entries) DropdownMenuItem(value: e.key, child: Text(e.value))];
|
||||
String country = "";
|
||||
late String oldWindowTitle;
|
||||
|
||||
class TLLeaderboardView extends StatefulWidget {
|
||||
const TLLeaderboardView({Key? key}) : super(key: key);
|
||||
|
@ -21,8 +24,22 @@ class TLLeaderboardView extends StatefulWidget {
|
|||
State<StatefulWidget> createState() => TLLeaderboardState();
|
||||
}
|
||||
|
||||
|
||||
class TLLeaderboardState extends State<TLLeaderboardView> {
|
||||
@override
|
||||
void initState() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${t.tlLeaderboard}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Translations.of(context);
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
import 'dart:io';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tetra_stats/data_objects/tetrio.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
|
||||
final DateFormat dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms();
|
||||
int roundSelector = -1; // -1 = match averages, otherwise round number-1
|
||||
List<DropdownMenuItem> rounds = []; // index zero will be match stats
|
||||
late String oldWindowTitle;
|
||||
|
||||
class TlMatchResultView extends StatefulWidget {
|
||||
final TetraLeagueAlphaRecord record;
|
||||
|
@ -27,12 +30,17 @@ class TlMatchResultState extends State<TlMatchResultView> {
|
|||
_scrollController = ScrollController();
|
||||
rounds = [DropdownMenuItem(value: -1, child: Text(t.match))];
|
||||
rounds.addAll([for (int i = 0; i < widget.record.endContext.first.secondaryTracking.length; i++) DropdownMenuItem(value: i, child: Text(t.roundNumber(n: i+1)))]);
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${widget.record.endContext.firstWhere((element) => element.userId == widget.initPlayerId).username.toUpperCase()} ${t.vs} ${widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).username.toUpperCase()} ${t.inTLmatch} ${dateFormat.format(widget.record.timestamp)}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose(){
|
||||
roundSelector = -1;
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tetra_stats/data_objects/tetrio.dart';
|
||||
import 'package:tetra_stats/gen/strings.g.dart';
|
||||
import 'package:tetra_stats/services/tetrio_crud.dart';
|
||||
import 'package:tetra_stats/views/states_view.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
final TetrioService teto = TetrioService();
|
||||
late String oldWindowTitle;
|
||||
|
||||
class TrackedPlayersView extends StatefulWidget {
|
||||
const TrackedPlayersView({Key? key}) : super(key: key);
|
||||
|
@ -15,6 +18,21 @@ class TrackedPlayersView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class TrackedPlayersState extends State<TrackedPlayersView> {
|
||||
@override
|
||||
void initState() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS){
|
||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||
windowManager.setTitle("Tetra Stats: ${t.trackedPlayersViewTitle}");
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = Translations.of(context);
|
||||
|
|
Loading…
Reference in New Issue