I'm stupid
This commit is contained in:
parent
751e7a7071
commit
9394b818cc
|
@ -2,7 +2,7 @@ import 'dart:io';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tetra_stats/views/settings_view.dart' show subtitleStyle;
|
import 'package:tetra_stats/views/settings_view.dart' show subtitleStyle;
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:tetra_stats/main.dart' show prefs;
|
||||||
import 'package:tetra_stats/gen/strings.g.dart';
|
import 'package:tetra_stats/gen/strings.g.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ class CustomizationView extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomizationState extends State<CustomizationView> {
|
class CustomizationState extends State<CustomizationView> {
|
||||||
late SharedPreferences prefs;
|
|
||||||
late bool oskKagariGimmick;
|
late bool oskKagariGimmick;
|
||||||
late bool sheetbotRadarGraphs;
|
late bool sheetbotRadarGraphs;
|
||||||
late int ratingMode;
|
late int ratingMode;
|
||||||
|
@ -34,7 +33,7 @@ class CustomizationState extends State<CustomizationView> {
|
||||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
||||||
windowManager.setTitle("Tetra Stats: ${t.settings}");
|
windowManager.setTitle("Tetra Stats: ${t.settings}");
|
||||||
}
|
}
|
||||||
_getPreferences().then((value) => setState((){}));
|
_getPreferences();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +43,7 @@ class CustomizationState extends State<CustomizationView> {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getPreferences() async {
|
void _getPreferences() {
|
||||||
prefs = await SharedPreferences.getInstance();
|
|
||||||
if (prefs.getBool("oskKagariGimmick") != null) {
|
if (prefs.getBool("oskKagariGimmick") != null) {
|
||||||
oskKagariGimmick = prefs.getBool("oskKagariGimmick")!;
|
oskKagariGimmick = prefs.getBool("oskKagariGimmick")!;
|
||||||
} else {
|
} else {
|
||||||
|
@ -62,7 +60,7 @@ class CustomizationState extends State<CustomizationView> {
|
||||||
ratingMode = 0;
|
ratingMode = 0;
|
||||||
}
|
}
|
||||||
if (prefs.getInt("timestampMode") != null) {
|
if (prefs.getInt("timestampMode") != null) {
|
||||||
timestampMode = prefs.getInt("ratingMode")!;
|
timestampMode = prefs.getInt("timestampMode")!;
|
||||||
} else {
|
} else {
|
||||||
timestampMode = 0;
|
timestampMode = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:tetra_stats/data_objects/tetrio.dart';
|
import 'package:tetra_stats/data_objects/tetrio.dart';
|
||||||
import 'package:tetra_stats/main.dart' show packageInfo, teto;
|
import 'package:tetra_stats/main.dart' show packageInfo, teto, prefs;
|
||||||
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:path_provider/path_provider.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/gen/strings.g.dart';
|
||||||
import 'package:tetra_stats/services/crud_exceptions.dart';
|
import 'package:tetra_stats/services/crud_exceptions.dart';
|
||||||
import 'package:tetra_stats/utils/open_in_browser.dart';
|
import 'package:tetra_stats/utils/open_in_browser.dart';
|
||||||
|
@ -24,7 +23,6 @@ class SettingsView extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SettingsState extends State<SettingsView> {
|
class SettingsState extends State<SettingsView> {
|
||||||
late SharedPreferences prefs;
|
|
||||||
String defaultNickname = "Checking...";
|
String defaultNickname = "Checking...";
|
||||||
late bool showPositions;
|
late bool showPositions;
|
||||||
late bool updateInBG;
|
late bool updateInBG;
|
||||||
|
@ -46,8 +44,7 @@ class SettingsState extends State<SettingsView> {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getPreferences() async {
|
void _getPreferences() {
|
||||||
prefs = await SharedPreferences.getInstance();
|
|
||||||
showPositions = prefs.getBool("showPositions") ?? false;
|
showPositions = prefs.getBool("showPositions") ?? false;
|
||||||
updateInBG = prefs.getBool("updateInBG") ?? false;
|
updateInBG = prefs.getBool("updateInBG") ?? false;
|
||||||
_setDefaultNickname(prefs.getString("player"));
|
_setDefaultNickname(prefs.getString("player"));
|
||||||
|
@ -267,7 +264,7 @@ class SettingsState extends State<SettingsView> {
|
||||||
context.go("/settings/customization");
|
context.go("/settings/customization");
|
||||||
},),
|
},),
|
||||||
ListTile(title: Text("Update stats in the background"),
|
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, as well, as tetra league stats of tracked players", style: const TextStyle(fontFamily: "Eurostile Round Condensed", color: Colors.grey)),
|
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)),
|
||||||
trailing: Switch(value: updateInBG, onChanged: (bool value){
|
trailing: Switch(value: updateInBG, onChanged: (bool value){
|
||||||
prefs.setBool("updateInBG", value);
|
prefs.setBool("updateInBG", value);
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
|
@ -174,8 +174,8 @@ class TLLeaderboardState extends State<TLLeaderboardView> {
|
||||||
prototypeItem: ListTile(
|
prototypeItem: ListTile(
|
||||||
leading: Text("0", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 28 : 24, height: 0.9)),
|
leading: Text("0", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 28 : 24, height: 0.9)),
|
||||||
title: Text("ehhh...", style: TextStyle(fontFamily: bigScreen ? "Eurostile Round Extended" : "Eurostile Round", height: 0.9)),
|
title: Text("ehhh...", style: TextStyle(fontFamily: bigScreen ? "Eurostile Round Extended" : "Eurostile Round", height: 0.9)),
|
||||||
trailing: Container(height: bigScreen ? 48 : 36, width: 1,),
|
trailing: SizedBox(height: bigScreen ? 48 : 36, width: 1,),
|
||||||
subtitle: Text("eh..."),
|
subtitle: const Text("eh..."),
|
||||||
),
|
),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:tetra_stats/data_objects/tetrio_multiplayer_replay.dart';
|
||||||
import 'package:tetra_stats/services/crud_exceptions.dart';
|
import 'package:tetra_stats/services/crud_exceptions.dart';
|
||||||
import 'package:tetra_stats/views/compare_view.dart' show CompareThingy, CompareBoolThingy;
|
import 'package:tetra_stats/views/compare_view.dart' show CompareThingy, CompareBoolThingy;
|
||||||
import 'package:tetra_stats/widgets/list_tile_trailing_stats.dart';
|
import 'package:tetra_stats/widgets/list_tile_trailing_stats.dart';
|
||||||
|
import 'package:tetra_stats/widgets/text_timestamp.dart';
|
||||||
import 'package:tetra_stats/widgets/vs_graphs.dart';
|
import 'package:tetra_stats/widgets/vs_graphs.dart';
|
||||||
import 'main_view.dart' show secs;
|
import 'main_view.dart' show secs;
|
||||||
import 'package:tetra_stats/main.dart' show teto;
|
import 'package:tetra_stats/main.dart' show teto;
|
||||||
|
@ -15,11 +16,8 @@ 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/utils/open_in_browser.dart';
|
import 'package:tetra_stats/utils/open_in_browser.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
// ignore: avoid_web_libraries_in_flutter
|
|
||||||
// import 'dart:html' show AnchorElement, document;
|
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
bool timeWeightedStatsAvaliable = true;
|
bool timeWeightedStatsAvaliable = true;
|
||||||
|
@ -50,7 +48,7 @@ class TlMatchResultState extends State<TlMatchResultView> {
|
||||||
replayData = teto.analyzeReplay(widget.record.replayId, widget.record.replayAvalable);
|
replayData = teto.analyzeReplay(widget.record.replayId, widget.record.replayAvalable);
|
||||||
if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
|
if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
|
||||||
windowManager.getTitle().then((value) => oldWindowTitle = value);
|
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)}");
|
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} ${timestamp(widget.record.timestamp)}");
|
||||||
}
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -709,7 +707,7 @@ class TlMatchResultState extends State<TlMatchResultView> {
|
||||||
final t = Translations.of(context);
|
final t = Translations.of(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("${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)}"),
|
title: Text("${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} ${timestamp(widget.record.timestamp)}"),
|
||||||
actions: [
|
actions: [
|
||||||
PopupMenuButton(
|
PopupMenuButton(
|
||||||
enabled: widget.record.replayAvalable,
|
enabled: widget.record.replayAvalable,
|
||||||
|
|
|
@ -37,7 +37,6 @@ class UserThingy extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final t = Translations.of(context);
|
final t = Translations.of(context);
|
||||||
final DateFormat dateFormat = DateFormat.yMMMd(LocaleSettings.currentLocale.languageCode).add_Hms();
|
|
||||||
return LayoutBuilder(builder: (context, constraints) {
|
return LayoutBuilder(builder: (context, constraints) {
|
||||||
bool bigScreen = constraints.maxWidth > 768;
|
bool bigScreen = constraints.maxWidth > 768;
|
||||||
double bannerHeight = bigScreen ? 240 : 120;
|
double bannerHeight = bigScreen ? 240 : 120;
|
||||||
|
@ -387,7 +386,7 @@ class UserThingy extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Image.asset("res/tetrio_badges/${badge.badgeId}.png"),
|
Image.asset("res/tetrio_badges/${badge.badgeId}.png"),
|
||||||
Text(badge.ts != null
|
Text(badge.ts != null
|
||||||
? t.obtainDate(date: dateFormat.format(badge.ts!))
|
? t.obtainDate(date: timestamp(badge.ts!))
|
||||||
: t.assignedManualy),
|
: t.assignedManualy),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue