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
|
# Special thanks
|
||||||
- **kerrmunism** — formulas
|
- **kerrmunism** — formulas
|
||||||
- **p1nkl0bst3r** — providing players history
|
- **p1nkl0bst3r** — providing players history and peak TR
|
||||||
- **osk** and his team — TETR.IO
|
- **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/foundation.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
import 'package:sqflite_common_ffi/sqflite_ffi.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/tracked_players_view.dart';
|
||||||
import 'package:tetra_stats/views/calc_view.dart';
|
import 'package:tetra_stats/views/calc_view.dart';
|
||||||
|
|
||||||
|
late final PackageInfo packageInfo;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
sqfliteFfiInit();
|
sqfliteFfiInit();
|
||||||
|
@ -22,10 +25,13 @@ void main() async {
|
||||||
databaseFactory = databaseFactoryFfi;
|
databaseFactory = databaseFactoryFfi;
|
||||||
}
|
}
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await WindowManager.instance.ensureInitialized();
|
if (!Platform.isAndroid && !Platform.isIOS){
|
||||||
windowManager.waitUntilReadyToShow().then((_) async {
|
await WindowManager.instance.ensureInitialized();
|
||||||
|
windowManager.waitUntilReadyToShow().then((_) async {
|
||||||
await windowManager.setTitle('Tetra Stats');
|
await windowManager.setTitle('Tetra Stats');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
packageInfo = await PackageInfo.fromPlatform();
|
||||||
prefs = await SharedPreferences.getInstance();
|
prefs = await SharedPreferences.getInstance();
|
||||||
String? locale = prefs.getString("locale");
|
String? locale = prefs.getString("locale");
|
||||||
if (locale == null){
|
if (locale == null){
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer' as developer;
|
import 'dart:developer' as developer;
|
||||||
|
import 'package:tetra_stats/main.dart' show packageInfo;
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:tetra_stats/services/custom_http_client.dart';
|
import 'package:tetra_stats/services/custom_http_client.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
@ -56,7 +57,7 @@ class TetrioService extends DB {
|
||||||
final Map<String, List<News>> _newsCache = {};
|
final Map<String, List<News>> _newsCache = {};
|
||||||
final Map<String, Map<String, double?>> _topTRcache = {};
|
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 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();
|
static final TetrioService _shared = TetrioService._sharedInstance();
|
||||||
factory TetrioService() => _shared;
|
factory TetrioService() => _shared;
|
||||||
late final StreamController<Map<String, List<TetrioPlayer>>> _tetrioStreamController;
|
late final StreamController<Map<String, List<TetrioPlayer>>> _tetrioStreamController;
|
||||||
|
@ -122,7 +123,7 @@ class TetrioService extends DB {
|
||||||
|
|
||||||
Uri url;
|
Uri url;
|
||||||
if (kIsWeb) {
|
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 {
|
} else {
|
||||||
url = Uri.https('api.p1nkl0bst3r.xyz', 'toptr/$id');
|
url = Uri.https('api.p1nkl0bst3r.xyz', 'toptr/$id');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'package:fl_chart/fl_chart.dart';
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
import 'package:flutter/material.dart';
|
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:window_manager/window_manager.dart';
|
||||||
|
|
||||||
double? apm;
|
double? apm;
|
||||||
double? pps;
|
double? pps;
|
||||||
|
@ -11,6 +13,7 @@ NerdStats? nerdStats;
|
||||||
EstTr? estTr;
|
EstTr? estTr;
|
||||||
Playstyle? playstyle;
|
Playstyle? playstyle;
|
||||||
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class CalcView extends StatefulWidget {
|
class CalcView extends StatefulWidget {
|
||||||
const CalcView({Key? key}) : super(key: key);
|
const CalcView({Key? key}) : super(key: key);
|
||||||
|
@ -28,11 +31,16 @@ class CalcState extends State<CalcView> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_scrollController = ScrollController();
|
_scrollController = ScrollController();
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS){
|
||||||
|
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||||
|
windowManager.setTitle("Tetra Stats: ${t.statsCalc}");
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'package:fl_chart/fl_chart.dart';
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
import 'package:flutter/foundation.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/data_objects/tetrio.dart';
|
||||||
import 'package:tetra_stats/gen/strings.g.dart';
|
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:window_manager/window_manager.dart';
|
||||||
|
|
||||||
enum Mode{
|
enum Mode{
|
||||||
player,
|
player,
|
||||||
|
@ -18,8 +20,8 @@ Mode redSideMode = Mode.player;
|
||||||
List<dynamic> theRedSide = [null, null, null];
|
List<dynamic> theRedSide = [null, null, null];
|
||||||
final TetrioService teto = TetrioService();
|
final TetrioService teto = TetrioService();
|
||||||
final DateFormat dateFormat = DateFormat.yMd(LocaleSettings.currentLocale.languageCode).add_Hm();
|
final DateFormat dateFormat = DateFormat.yMd(LocaleSettings.currentLocale.languageCode).add_Hm();
|
||||||
// ignore: unnecessary_string_escapes
|
|
||||||
var numbersReg = RegExp(r'\d+(\.\d*)*');
|
var numbersReg = RegExp(r'\d+(\.\d*)*');
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class CompareView extends StatefulWidget {
|
class CompareView extends StatefulWidget {
|
||||||
final List<dynamic> greenSide;
|
final List<dynamic> greenSide;
|
||||||
|
@ -42,6 +44,9 @@ class CompareState extends State<CompareView> {
|
||||||
fetchGreenSide(widget.greenSide[0].userId);
|
fetchGreenSide(widget.greenSide[0].userId);
|
||||||
if (widget.redSide[0] != null) fetchRedSide(widget.redSide[0].userId);
|
if (widget.redSide[0] != null) fetchRedSide(widget.redSide[0].userId);
|
||||||
_scrollController = ScrollController();
|
_scrollController = ScrollController();
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS){
|
||||||
|
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +56,7 @@ class CompareState extends State<CompareView> {
|
||||||
greenSideMode = Mode.player;
|
greenSideMode = Mode.player;
|
||||||
theRedSide = [null, null, null];
|
theRedSide = [null, null, null];
|
||||||
redSideMode = Mode.player;
|
redSideMode = Mode.player;
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +259,7 @@ class CompareState extends State<CompareView> {
|
||||||
titleRedSide = t.averageXrank(rankLetter: theRedSide[2].rank.toUpperCase());
|
titleRedSide = t.averageXrank(rankLetter: theRedSide[2].rank.toUpperCase());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
windowManager.setTitle("Tetra Stats: $titleGreenSide ${t.vs} $titleRedSide");
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text("$titleGreenSide ${t.vs} $titleRedSide")),
|
appBar: AppBar(title: Text("$titleGreenSide ${t.vs} $titleRedSide")),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
|
|
|
@ -29,9 +29,6 @@ late SharedPreferences prefs;
|
||||||
var chartsData = <DropdownMenuItem<List<FlSpot>>>[];
|
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"];
|
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;
|
int chartsIndex = 0;
|
||||||
const allowedHeightForPlayerIdInPixels = 40.0;
|
|
||||||
const allowedHeightForPlayerBioInPixels = 30.0;
|
|
||||||
const givenTextHeightByScreenPercentage = 0.3;
|
|
||||||
final NumberFormat timeInSec = NumberFormat("#,###.###s.");
|
final NumberFormat timeInSec = NumberFormat("#,###.###s.");
|
||||||
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
||||||
final NumberFormat secs = NumberFormat("00.###");
|
final NumberFormat secs = NumberFormat("00.###");
|
||||||
|
@ -138,7 +135,7 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
||||||
}
|
}
|
||||||
_searchFor = me.userId;
|
_searchFor = me.userId;
|
||||||
setState((){_titleNickname = me.username;});
|
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 List<dynamic> requests;
|
||||||
late TetraLeagueAlphaStream tlStream;
|
late TetraLeagueAlphaStream tlStream;
|
||||||
late Map<String, dynamic> records;
|
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));
|
return Center(child: Text(errText, style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 42, fontWeight: FontWeight.bold), textAlign: TextAlign.center));
|
||||||
}
|
}
|
||||||
break;
|
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(
|
return const Center(child: Text('default case of FutureBuilder', style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42), textAlign: TextAlign.center));
|
||||||
child: Text('end 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),
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 48),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
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(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: DefaultTextStyle.of(context).style,
|
style: DefaultTextStyle.of(context).style,
|
||||||
children: getDistinguishmentSetOfWidgets(distinguishment!.header!),
|
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:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:tetra_stats/services/tetrio_crud.dart';
|
import 'package:tetra_stats/services/tetrio_crud.dart';
|
||||||
import 'package:tetra_stats/gen/strings.g.dart';
|
import 'package:tetra_stats/gen/strings.g.dart';
|
||||||
import 'package:tetra_stats/views/tl_match_view.dart';
|
import 'package:tetra_stats/views/tl_match_view.dart';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
final TetrioService teto = TetrioService();
|
final TetrioService teto = TetrioService();
|
||||||
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
final NumberFormat f2 = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: 2);
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class MatchesView extends StatefulWidget {
|
class MatchesView extends StatefulWidget {
|
||||||
final String userID;
|
final String userID;
|
||||||
|
@ -17,6 +20,22 @@ class MatchesView extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MatchesState extends State<MatchesView> {
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final t = Translations.of(context);
|
final t = Translations.of(context);
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'package:fl_chart/fl_chart.dart';
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
import 'package:flutter/material.dart';
|
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/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, f4, f2;
|
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),)];
|
var chartsShortTitlesDropdowns = <DropdownMenuItem>[for (MapEntry e in chartsShortTitles.entries) DropdownMenuItem(value: e.key, child: Text(e.value),)];
|
||||||
Stats chartsX = Stats.tr;
|
Stats chartsX = Stats.tr;
|
||||||
|
@ -14,6 +15,7 @@ Stats sortBy = Stats.tr;
|
||||||
bool reversed = false;
|
bool reversed = false;
|
||||||
List<DropdownMenuItem> itemCountries = [for (MapEntry e in t.countries.entries) DropdownMenuItem(value: e.key, child: Text(e.value))];
|
List<DropdownMenuItem> itemCountries = [for (MapEntry e in t.countries.entries) DropdownMenuItem(value: e.key, child: Text(e.value))];
|
||||||
String country = "";
|
String country = "";
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class RankView extends StatefulWidget {
|
class RankView extends StatefulWidget {
|
||||||
final List rank;
|
final List rank;
|
||||||
|
@ -31,6 +33,10 @@ class RankState extends State<RankView> with SingleTickerProviderStateMixin {
|
||||||
void initState() {
|
void initState() {
|
||||||
_scrollController = ScrollController();
|
_scrollController = ScrollController();
|
||||||
_tabController = TabController(length: 6, vsync: this);
|
_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();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +44,7 @@ class RankState extends State<RankView> with SingleTickerProviderStateMixin {
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_tabController.dispose();
|
_tabController.dispose();
|
||||||
_scrollController.dispose();
|
_scrollController.dispose();
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:tetra_stats/gen/strings.g.dart';
|
import 'package:tetra_stats/gen/strings.g.dart';
|
||||||
import 'package:tetra_stats/views/rank_averages_view.dart';
|
import 'package:tetra_stats/views/rank_averages_view.dart';
|
||||||
import 'package:tetra_stats/views/tl_leaderboard_view.dart';
|
import 'package:tetra_stats/views/tl_leaderboard_view.dart';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
class RankAveragesView extends StatefulWidget {
|
class RankAveragesView extends StatefulWidget {
|
||||||
const RankAveragesView({Key? key}) : super(key: key);
|
const RankAveragesView({Key? key}) : super(key: key);
|
||||||
|
@ -11,18 +13,29 @@ class RankAveragesView extends StatefulWidget {
|
||||||
State<StatefulWidget> createState() => RanksAverages();
|
State<StatefulWidget> createState() => RanksAverages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class RanksAverages extends State<RankAveragesView> {
|
class RanksAverages extends State<RankAveragesView> {
|
||||||
Map<String, List<dynamic>> averages = {};
|
Map<String, List<dynamic>> averages = {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
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();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'package:tetra_stats/main.dart' show packageInfo;
|
||||||
import 'package:file_selector/file_selector.dart';
|
import 'package:file_selector/file_selector.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:tetra_stats/gen/strings.g.dart';
|
import 'package:tetra_stats/gen/strings.g.dart';
|
||||||
import 'package:tetra_stats/services/crud_exceptions.dart';
|
import 'package:tetra_stats/services/crud_exceptions.dart';
|
||||||
import 'package:tetra_stats/services/tetrio_crud.dart';
|
import 'package:tetra_stats/services/tetrio_crud.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class SettingsView extends StatefulWidget {
|
class SettingsView extends StatefulWidget {
|
||||||
const SettingsView({Key? key}) : super(key: key);
|
const SettingsView({Key? key}) : super(key: key);
|
||||||
|
@ -19,11 +22,6 @@ class SettingsView extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SettingsState extends State<SettingsView> {
|
class SettingsState extends State<SettingsView> {
|
||||||
PackageInfo _packageInfo = PackageInfo(
|
|
||||||
appName: "TetraStats",
|
|
||||||
packageName: "idk man",
|
|
||||||
version: "some numbers",
|
|
||||||
buildNumber: "anotherNumber");
|
|
||||||
late SharedPreferences prefs;
|
late SharedPreferences prefs;
|
||||||
final TetrioService teto = TetrioService();
|
final TetrioService teto = TetrioService();
|
||||||
String defaultNickname = "Checking...";
|
String defaultNickname = "Checking...";
|
||||||
|
@ -31,16 +29,18 @@ class SettingsState extends State<SettingsView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_initPackageInfo();
|
if (!Platform.isAndroid && !Platform.isIOS){
|
||||||
|
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||||
|
windowManager.setTitle("Tetra Stats: ${t.settings}");
|
||||||
|
}
|
||||||
_getPreferences();
|
_getPreferences();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initPackageInfo() async {
|
@override
|
||||||
final info = await PackageInfo.fromPlatform();
|
void dispose(){
|
||||||
setState(() {
|
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||||
_packageInfo = info;
|
super.dispose();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _launchInBrowser(Uri url) async {
|
Future<void> _launchInBrowser(Uri url) async {
|
||||||
|
@ -251,7 +251,7 @@ class SettingsState extends State<SettingsView> {
|
||||||
_launchInBrowser(Uri.https("github.com", "dan63047/TetraStats"));
|
_launchInBrowser(Uri.https("github.com", "dan63047/TetraStats"));
|
||||||
},
|
},
|
||||||
title: Text(t.aboutApp),
|
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: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/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';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
final DateFormat dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms();
|
final DateFormat dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms();
|
||||||
|
|
||||||
|
@ -15,15 +17,28 @@ class StateView extends StatefulWidget {
|
||||||
State<StatefulWidget> createState() => StateState();
|
State<StatefulWidget> createState() => StateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class StateState extends State<StateView> {
|
class StateState extends State<StateView> {
|
||||||
late ScrollController _scrollController;
|
late ScrollController _scrollController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_scrollController = ScrollController();
|
_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();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_scrollController.dispose();
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
void _justUpdate() {
|
void _justUpdate() {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
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/mathes_view.dart';
|
import 'package:tetra_stats/views/mathes_view.dart';
|
||||||
import 'package:tetra_stats/views/state_view.dart';
|
import 'package:tetra_stats/views/state_view.dart';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
class StatesView extends StatefulWidget {
|
class StatesView extends StatefulWidget {
|
||||||
final List<TetrioPlayer> states;
|
final List<TetrioPlayer> states;
|
||||||
|
@ -13,7 +15,24 @@ class StatesView extends StatefulWidget {
|
||||||
State<StatefulWidget> createState() => StatesState();
|
State<StatefulWidget> createState() => StatesState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class StatesState extends State<StatesView> {
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final t = Translations.of(context);
|
final t = Translations.of(context);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
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';
|
||||||
|
@ -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/main_view.dart';
|
||||||
import 'package:tetra_stats/views/rank_averages_view.dart';
|
import 'package:tetra_stats/views/rank_averages_view.dart';
|
||||||
import 'package:tetra_stats/views/ranks_averages_view.dart';
|
import 'package:tetra_stats/views/ranks_averages_view.dart';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
final TetrioService teto = TetrioService();
|
final TetrioService teto = TetrioService();
|
||||||
List<DropdownMenuItem> itemStats = [for (MapEntry e in chartsShortTitles.entries) DropdownMenuItem(value: e.key, child: Text(e.value))];
|
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;
|
bool reversed = false;
|
||||||
List<DropdownMenuItem> itemCountries = [for (MapEntry e in t.countries.entries) DropdownMenuItem(value: e.key, child: Text(e.value))];
|
List<DropdownMenuItem> itemCountries = [for (MapEntry e in t.countries.entries) DropdownMenuItem(value: e.key, child: Text(e.value))];
|
||||||
String country = "";
|
String country = "";
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class TLLeaderboardView extends StatefulWidget {
|
class TLLeaderboardView extends StatefulWidget {
|
||||||
const TLLeaderboardView({Key? key}) : super(key: key);
|
const TLLeaderboardView({Key? key}) : super(key: key);
|
||||||
|
@ -21,8 +24,22 @@ class TLLeaderboardView extends StatefulWidget {
|
||||||
State<StatefulWidget> createState() => TLLeaderboardState();
|
State<StatefulWidget> createState() => TLLeaderboardState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TLLeaderboardState extends State<TLLeaderboardView> {
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final t = Translations.of(context);
|
final t = Translations.of(context);
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'package:fl_chart/fl_chart.dart';
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
import 'package:flutter/material.dart';
|
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:window_manager/window_manager.dart';
|
||||||
|
|
||||||
|
|
||||||
final DateFormat dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms();
|
final DateFormat dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms();
|
||||||
int roundSelector = -1; // -1 = match averages, otherwise round number-1
|
int roundSelector = -1; // -1 = match averages, otherwise round number-1
|
||||||
List<DropdownMenuItem> rounds = []; // index zero will be match stats
|
List<DropdownMenuItem> rounds = []; // index zero will be match stats
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class TlMatchResultView extends StatefulWidget {
|
class TlMatchResultView extends StatefulWidget {
|
||||||
final TetraLeagueAlphaRecord record;
|
final TetraLeagueAlphaRecord record;
|
||||||
|
@ -27,12 +30,17 @@ class TlMatchResultState extends State<TlMatchResultView> {
|
||||||
_scrollController = ScrollController();
|
_scrollController = ScrollController();
|
||||||
rounds = [DropdownMenuItem(value: -1, child: Text(t.match))];
|
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)))]);
|
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();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose(){
|
void dispose(){
|
||||||
roundSelector = -1;
|
roundSelector = -1;
|
||||||
|
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
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/services/tetrio_crud.dart';
|
import 'package:tetra_stats/services/tetrio_crud.dart';
|
||||||
import 'package:tetra_stats/views/states_view.dart';
|
import 'package:tetra_stats/views/states_view.dart';
|
||||||
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
final TetrioService teto = TetrioService();
|
final TetrioService teto = TetrioService();
|
||||||
|
late String oldWindowTitle;
|
||||||
|
|
||||||
class TrackedPlayersView extends StatefulWidget {
|
class TrackedPlayersView extends StatefulWidget {
|
||||||
const TrackedPlayersView({Key? key}) : super(key: key);
|
const TrackedPlayersView({Key? key}) : super(key: key);
|
||||||
|
@ -15,6 +18,21 @@ class TrackedPlayersView extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TrackedPlayersState extends State<TrackedPlayersView> {
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final t = Translations.of(context);
|
final t = Translations.of(context);
|
||||||
|
|
Loading…
Reference in New Issue