From c12d4508844ba70dec85856b94c898e85ebd8d15 Mon Sep 17 00:00:00 2001 From: dan63047 Date: Tue, 22 Oct 2024 01:38:41 +0300 Subject: [PATCH] Some `TextStyle`s was moved into themes, button fully animated Also some bugfix and plans on animating Default Nickname setting --- lib/main.dart | 7 ++ lib/views/destination_calculator.dart | 6 +- lib/views/destination_cutoffs.dart | 2 +- lib/views/destination_home.dart | 38 ++++++---- lib/views/destination_leaderboards.dart | 6 +- lib/views/destination_saved_data.dart | 4 +- lib/views/main_view.dart | 12 +-- lib/views/main_view_tiles.dart | 98 ++++++++++++++++--------- lib/views/user_view.dart | 31 ++++++-- lib/widgets/recent_sp_games.dart | 2 +- lib/widgets/singleplayer_record.dart | 2 +- 11 files changed, 134 insertions(+), 74 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index c0b11f3..9ff7a57 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -32,6 +32,12 @@ ThemeData theme = ThemeData( surface: Color.fromARGB(255, 10, 10, 10), secondary: Color(0xFF00838F), ), + textTheme: TextTheme( + titleLarge: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42), + titleSmall: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9, fontWeight: FontWeight.w200), + headlineMedium: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36), + displayLarge: TextStyle(fontSize: 18), + ), cardTheme: const CardTheme(surfaceTintColor: Color.fromARGB(255, 10, 10, 10)), drawerTheme: const DrawerThemeData(surfaceTintColor: Color.fromARGB(255, 10, 10, 10)), searchBarTheme: const SearchBarThemeData( @@ -56,6 +62,7 @@ ThemeData theme = ThemeData( expansionAnimationStyle: AnimationStyle(curve: Easing.standard, reverseCurve: Easing.standard), expandedAlignment: Alignment.bottomCenter, ), + dropdownMenuTheme: DropdownMenuThemeData(textStyle: TextStyle(fontFamily: "Eurostile Round", fontSize: 18)), scaffoldBackgroundColor: Colors.black ); diff --git a/lib/views/destination_calculator.dart b/lib/views/destination_calculator.dart index b240c99..81b7c23 100644 --- a/lib/views/destination_calculator.dart +++ b/lib/views/destination_calculator.dart @@ -188,7 +188,7 @@ class _DestinationCalculatorState extends State { padding: const EdgeInsets.only(bottom: 8.0), child: Column( children: [ - Text("Stats Calucator", style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text("Stats Calucator", style: Theme.of(context).textTheme.titleLarge), ], ), )), @@ -281,7 +281,7 @@ class _DestinationCalculatorState extends State { decoration: InputDecoration(hintText: "5"), onChanged: (value) => customClearsChoice[key] = int.parse(value), )), - Text(" Lines", style: TextStyle(fontSize: 18)), + Text(" Lines", style: Theme.of(context).textTheme.displayLarge), Icon(Icons.arrow_forward_ios) ], ), @@ -353,7 +353,7 @@ class _DestinationCalculatorState extends State { padding: const EdgeInsets.only(bottom: 8.0), child: Column( children: [ - Text("Damage Calucator", style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text("Damage Calucator", style: Theme.of(context).textTheme.titleLarge), ], ), )), diff --git a/lib/views/destination_cutoffs.dart b/lib/views/destination_cutoffs.dart index f4c426a..3a8ea02 100644 --- a/lib/views/destination_cutoffs.dart +++ b/lib/views/destination_cutoffs.dart @@ -75,7 +75,7 @@ class _DestinationCutoffsState extends State { padding: const EdgeInsets.only(bottom: 8.0), child: Column( children: [ - Text("Tetra League State", style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text("Tetra League State", style: Theme.of(context).textTheme.titleLarge), Text("as of ${timestamp(snapshot.data!.timestamp)}"), ], ), diff --git a/lib/views/destination_home.dart b/lib/views/destination_home.dart index 5c0e183..59c0293 100644 --- a/lib/views/destination_home.dart +++ b/lib/views/destination_home.dart @@ -145,7 +145,7 @@ class LeagueCard extends StatelessWidget{ crossAxisAlignment: CrossAxisAlignment.baseline, textBaseline: TextBaseline.alphabetic, children: [ - Text("Season ${league.season}", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)), + Text("Season ${league.season}", style: Theme.of(context).textTheme.titleSmall), Spacer(), Text( "${seasonStarts.elementAtOrNull(league.season - 1) != null ? timestamp(seasonStarts[league.season - 1]) : "---"} — ${seasonEnds.elementAtOrNull(league.season - 1) != null ? timestamp(seasonEnds[league.season - 1]) : "---"}", @@ -153,7 +153,7 @@ class LeagueCard extends StatelessWidget{ style: TextStyle(color: Colors.grey)), ], ) - else Text("Tetra League", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)), + else Text("Tetra League", style: Theme.of(context).textTheme.titleSmall), const Divider(), TLRatingThingy(userID: "", tlData: league, showPositions: true), const Divider(), @@ -209,7 +209,7 @@ class _DestinationHomeState extends State with SingleTickerProv child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - const Text("40 Lines", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)), + Text("40 Lines", style: Theme.of(context).textTheme.titleSmall), const Divider(), RecordSummary(record: summaries.sprint, betterThanClosestAverage: sprintBetterThanClosestAverage, betterThanRankAverage: sprintBetterThanRankAverage, closestAverage: closestAverageSprint, rank: summaries.league.percentileRank), const Divider(), @@ -226,7 +226,7 @@ class _DestinationHomeState extends State with SingleTickerProv child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - const Text("Blitz", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)), + Text("Blitz", style: Theme.of(context).textTheme.titleSmall), const Divider(), RecordSummary(record: summaries.blitz, betterThanClosestAverage: blitzBetterThanClosestAverage, betterThanRankAverage: blitzBetterThanRankAverage, closestAverage: closestAverageBlitz, rank: summaries.league.percentileRank), const Divider(), @@ -248,7 +248,7 @@ class _DestinationHomeState extends State with SingleTickerProv child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - const Text("QP", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)), + Text("QP", style: Theme.of(context).textTheme.titleSmall), const Divider(), RecordSummary(record: summaries.zenith, hideRank: true), const Divider(), @@ -265,7 +265,7 @@ class _DestinationHomeState extends State with SingleTickerProv child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - const Text("QP Expert", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)), + Text("QP Expert", style: Theme.of(context).textTheme.titleSmall), const Divider(), RecordSummary(record: summaries.zenithEx, hideRank: true,), const Divider(), @@ -287,7 +287,7 @@ class _DestinationHomeState extends State with SingleTickerProv child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - const Text("Zen", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)), + Text("Zen", style: Theme.of(context).textTheme.titleSmall), Text("Level ${intf.format(summaries.zen.level)}", style: const TextStyle(fontFamily: "Eurostile Round", fontSize: 36, fontWeight: FontWeight.w500, color: Colors.white)), Text("Score ${intf.format(summaries.zen.score)}"), Text("Level up requirement: ${intf.format(summaries.zen.scoreRequirement)}", style: const TextStyle(color: Colors.grey)) @@ -386,7 +386,7 @@ class _DestinationHomeState extends State with SingleTickerProv mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text(t.tetraLeague, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text(t.tetraLeague, style: Theme.of(context).textTheme.titleLarge), //Text("${states.last.timestamp} ${states.last.tr}", textAlign: TextAlign.center) ], ), @@ -400,7 +400,7 @@ class _DestinationHomeState extends State with SingleTickerProv mainAxisSize: MainAxisSize.min, children: [ const Spacer(), - Text(t.nerdStats, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text(t.nerdStats, style: Theme.of(context).textTheme.titleLarge), const Spacer() ], ), @@ -422,7 +422,7 @@ class _DestinationHomeState extends State with SingleTickerProv mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text("Previous Seasons", style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text("Previous Seasons", style: Theme.of(context).textTheme.titleLarge), //Text("${t.seasonStarts} ${countdown(postSeasonLeft)}", textAlign: TextAlign.center) ], ), @@ -504,7 +504,7 @@ class _DestinationHomeState extends State with SingleTickerProv "zenithex" => "${f2.format(snapshot.data!.records[i].stats.zenith!.altitude)} m${(snapshot.data!.records[i].extras as ZenithExtras).mods.isNotEmpty ? " (${t.withModsPlural(n: (snapshot.data!.records[i].extras as ZenithExtras).mods.length)})" : ""}", String() => "huh", }, - style: const TextStyle(fontSize: 18)), + style: Theme.of(context).textTheme.displayLarge), subtitle: Text(timestamp(snapshot.data!.records[i].timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)), trailing: SpTrailingStats(snapshot.data!.records[i], snapshot.data!.records[i].gamemode) ) @@ -543,7 +543,7 @@ class _DestinationHomeState extends State with SingleTickerProv "zenithex" => "${f2.format(snapshot.data!.records[i].stats.zenith!.altitude)} m${(snapshot.data!.records[i].extras as ZenithExtras).mods.isNotEmpty ? " (${t.withModsPlural(n: (snapshot.data!.records[i].extras as ZenithExtras).mods.length)})" : ""}", String() => "huh", }, - style: const TextStyle(fontSize: 18)), + style: Theme.of(context).textTheme.displayLarge), subtitle: Text(timestamp(snapshot.data!.records[i].timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)), trailing: SpTrailingStats(snapshot.data!.records[i], snapshot.data!.records[i].gamemode) ) @@ -577,7 +577,7 @@ class _DestinationHomeState extends State with SingleTickerProv mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text(t.recent, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text(t.recent, style: Theme.of(context).textTheme.titleLarge), ], ), ), @@ -618,7 +618,7 @@ class _DestinationHomeState extends State with SingleTickerProv mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text(t.quickPlay, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text(t.quickPlay, style: Theme.of(context).textTheme.titleLarge), //Text("Leaderboard reset in ${countdown(postSeasonLeft)}", textAlign: TextAlign.center), ], ), @@ -704,7 +704,7 @@ class _DestinationHomeState extends State with SingleTickerProv mainAxisSize: MainAxisSize.min, children: [ const Spacer(), - Text(t.nerdStats, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text(t.nerdStats, style: Theme.of(context).textTheme.titleLarge), const Spacer() ], ), @@ -736,7 +736,7 @@ class _DestinationHomeState extends State with SingleTickerProv "blitz" => t.blitz, "5mblast" => "5,000,000 Blast", _ => record.gamemode - }, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)) + }, style: Theme.of(context).textTheme.titleLarge) ], ), ), @@ -986,10 +986,16 @@ class _DestinationHomeState extends State with SingleTickerProv if (snapshot.data!.summaries!.sprint != null) { closestAverageSprint = sprintAverages.entries.singleWhere((element) => element.value == sprintAverages.values.reduce((a, b) => (a-snapshot.data!.summaries!.sprint!.stats.finalTime).abs() < (b -snapshot.data!.summaries!.sprint!.stats.finalTime).abs() ? a : b)); sprintBetterThanClosestAverage = snapshot.data!.summaries!.sprint!.stats.finalTime < closestAverageSprint!.value; + } else { + closestAverageSprint = sprintAverages.entries.last; + sprintBetterThanClosestAverage = false; } if (snapshot.data!.summaries!.blitz != null){ closestAverageBlitz = blitzAverages.entries.singleWhere((element) => element.value == blitzAverages.values.reduce((a, b) => (a-snapshot.data!.summaries!.blitz!.stats.score).abs() < (b -snapshot.data!.summaries!.blitz!.stats.score).abs() ? a : b)); blitzBetterThanClosestAverage = snapshot.data!.summaries!.blitz!.stats.score > closestAverageBlitz!.value; + } else { + closestAverageBlitz = blitzAverages.entries.last; + blitzBetterThanClosestAverage = false; } return TweenAnimationBuilder( duration: Durations.long4, diff --git a/lib/views/destination_leaderboards.dart b/lib/views/destination_leaderboards.dart index 431f25e..4fad288 100644 --- a/lib/views/destination_leaderboards.dart +++ b/lib/views/destination_leaderboards.dart @@ -114,12 +114,12 @@ class _DestinationLeaderboardsState extends State { height: widget.constraints.maxHeight, child: Column( children: [ - const Card( + Card( child: Row( mainAxisSize: MainAxisSize.min, children: [ Spacer(), - Text("Leaderboards", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36)), + Text("Leaderboards", style: Theme.of(context).textTheme.headlineMedium), Spacer() ], ), @@ -162,7 +162,7 @@ class _DestinationLeaderboardsState extends State { if (snapshot.hasData){ return Column( children: [ - Text(leaderboards[_currentLb]!, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 28, height: 0.9)), + Text(leaderboards[_currentLb]!, style: Theme.of(context).textTheme.titleSmall), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/lib/views/destination_saved_data.dart b/lib/views/destination_saved_data.dart index 51936dc..04ba512 100644 --- a/lib/views/destination_saved_data.dart +++ b/lib/views/destination_saved_data.dart @@ -75,12 +75,12 @@ class _DestinationSavedData extends State { width: 450, child: Column( children: [ - const Card( + Card( child: Row( mainAxisSize: MainAxisSize.min, children: [ Spacer(), - Text("Saved Data", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36)), + Text("Saved Data", style: Theme.of(context).textTheme.headlineMedium), Spacer() ], ), diff --git a/lib/views/main_view.dart b/lib/views/main_view.dart index af9923b..4ef9c32 100644 --- a/lib/views/main_view.dart +++ b/lib/views/main_view.dart @@ -1220,7 +1220,7 @@ 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].stats.finalTime.inMicroseconds), - style: const TextStyle(fontSize: 18)), + style: Theme.of(context).textTheme.displayLarge), subtitle: Text(timestamp(sprintStream.records[i].timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)), trailing: SpTrailingStats(sprintStream.records[i], sprintStream.records[i].gamemode) ) @@ -1306,7 +1306,7 @@ 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].stats.score)} points", - style: const TextStyle(fontSize: 18)), + style: Theme.of(context).textTheme.displayLarge), subtitle: Text(timestamp(blitzStream.records[i].timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)), trailing: SpTrailingStats(blitzStream.records[i], blitzStream.records[i].gamemode) ) @@ -1558,7 +1558,7 @@ class _OtherThingy extends StatelessWidget { children: getDistinguishmentTitle(distinguishment?.header), ), ), - Text(getDistinguishmentSubtitle(distinguishment?.footer), style: const TextStyle(fontSize: 18), textAlign: TextAlign.center), + Text(getDistinguishmentSubtitle(distinguishment?.footer), style: Theme.of(context).textTheme.displayLarge, textAlign: TextAlign.center), ], ), ), @@ -1568,7 +1568,7 @@ class _OtherThingy extends StatelessWidget { child: Column( children: [ Text(t.bio, style: TextStyle(fontFamily: "Eurostile Round Extended",fontSize: bigScreen ? 42 : 28)), - MarkdownBody(data: bio!, styleSheet: MarkdownStyleSheet(textScaler: TextScaler.linear(1.5), textAlign: WrapAlignment.center)) // Text(bio!, style: const TextStyle(fontSize: 18)), + MarkdownBody(data: bio!, styleSheet: MarkdownStyleSheet(textScaler: TextScaler.linear(1.5), textAlign: WrapAlignment.center)) // Text(bio!, style: const Theme.of(context).textTheme.displayLarge), ], ), ), @@ -1579,7 +1579,7 @@ class _OtherThingy extends StatelessWidget { children: [ Text(t.zen, style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: bigScreen ? 42 : 28)), Text("${t.statCellNum.level} ${NumberFormat.decimalPattern().format(zen!.level)}", style: const TextStyle(fontSize: 28, fontWeight: FontWeight.bold)), - Text("${t.statCellNum.score} ${NumberFormat.decimalPattern().format(zen!.score)}", style: const TextStyle(fontSize: 18)), + Text("${t.statCellNum.score} ${NumberFormat.decimalPattern().format(zen!.score)}", style: Theme.of(context).textTheme.displayLarge), Container( constraints: const BoxConstraints(maxWidth: 300.0), child: Row(children: [ @@ -1609,7 +1609,7 @@ class _OtherThingy extends StatelessWidget { physics: const AlwaysScrollableScrollPhysics(), itemCount: newsletter!.news.length+1, itemBuilder: (BuildContext context, int index) { - return index == 0 ? Center(child: Text(t.news, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42))) : getNewsTile(newsletter!.news[index-1]); + return index == 0 ? Center(child: Text(t.news, style: Theme.of(context).textTheme.titleLarge)) : getNewsTile(newsletter!.news[index-1]); } )) ] diff --git a/lib/views/main_view_tiles.dart b/lib/views/main_view_tiles.dart index 2316ff5..5648170 100644 --- a/lib/views/main_view_tiles.dart +++ b/lib/views/main_view_tiles.dart @@ -236,10 +236,9 @@ enum SettingsCardMod{ final String title; } -const TextStyle settingsTitlesStyle = TextStyle(fontSize: 18); const EdgeInsets descriptionPadding = EdgeInsets.fromLTRB(12.0, 0.0, 12.0, 8.0); -class _DestinationSettings extends State { +class _DestinationSettings extends State with SingleTickerProviderStateMixin { SettingsCardMod mod = SettingsCardMod.general; List> locales = >[]; String defaultNickname = "Checking..."; @@ -251,6 +250,8 @@ class _DestinationSettings extends State { late bool showAverages; late bool updateInBG; final TextEditingController _playertext = TextEditingController(); + late AnimationController _defaultNicknameAnimController; + late Animation _defaultNicknameAnim; @override void initState() { @@ -258,6 +259,18 @@ class _DestinationSettings extends State { // windowManager.getTitle().then((value) => oldWindowTitle = value); // windowManager.setTitle("Tetra Stats: ${t.settings}"); // } + _defaultNicknameAnimController = AnimationController( + duration: Durations.extralong4, + vsync: this, + ); + _defaultNicknameAnim = new Tween( + begin: 0.0, + end: 1.0, + ).animate(new CurvedAnimation( + parent: _defaultNicknameAnimController, + curve: Cubic(.15,-0.40,.86,-0.39), + reverseCurve: Cubic(0,.99,.99,1.01) + )); _getPreferences(); super.initState(); } @@ -279,22 +292,26 @@ class _DestinationSettings extends State { _setDefaultNickname(prefs.getString("player")); } - Future _setDefaultNickname(String? n) async { + Future _setDefaultNickname(String? n) async { if (n != null) { try { defaultNickname = await teto.getNicknameByID(n); + return true; } on TetrioPlayerNotExist { defaultNickname = n; + return false; } } else { defaultNickname = "dan63047"; + return true; } - setState(() {}); + //setState(() {}); } - Future _setPlayer(String player) async { - await prefs.setString('player', player); - await _setDefaultNickname(player); + Future _setPlayer(String player) async { + bool success = await _setDefaultNickname(player); + if (success) await prefs.setString('player', player); + return success; } Future _removePlayer() async { @@ -310,7 +327,7 @@ class _DestinationSettings extends State { padding: const EdgeInsets.only(bottom: 8.0), child: Column( children: [ - Text(SettingsCardMod.general.title, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text(SettingsCardMod.general.title, style: Theme.of(context).textTheme.titleLarge), ], ), )), @@ -320,11 +337,21 @@ class _DestinationSettings extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text("Your account in TETR.IO", style: settingsTitlesStyle), - trailing: SizedBox(width: 150.0, child: TextField( - keyboardType: TextInputType.text, - decoration: InputDecoration(hintText: defaultNickname), - //onChanged: (value) => setState((){rules.surgeInitAtB2b = int.parse(value);}), + title: Text("Your account in TETR.IO", style: Theme.of(context).textTheme.displayLarge), + trailing: SizedBox(width: 150.0, child: AnimatedBuilder( + animation: _defaultNicknameAnim, + builder: (context, child) { + return TextField( + keyboardType: TextInputType.text, + decoration: InputDecoration( + hintText: defaultNickname, + helper: Text("Press Enter to submit", style: TextStyle(color: Colors.grey, height: 0.2)), + ), + onChanged: (value) { + _setPlayer(value).then((v) {}); + }, + ); + }, )), ), Divider(), @@ -340,7 +367,7 @@ class _DestinationSettings extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text("Language", style: settingsTitlesStyle), + title: Text("Language", style: Theme.of(context).textTheme.displayLarge), trailing: DropdownButton( items: locales, value: LocaleSettings.currentLocale, @@ -367,7 +394,7 @@ class _DestinationSettings extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text("Update data in the background", style: settingsTitlesStyle), + title: Text("Update data in the background", style: Theme.of(context).textTheme.displayLarge), trailing: Switch(value: updateInBG, onChanged: (bool value){ prefs.setBool("updateInBG", value); setState(() { @@ -388,7 +415,7 @@ class _DestinationSettings extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text("Show leaderboard based stats", style: settingsTitlesStyle), + title: Text("Show leaderboard based stats", style: Theme.of(context).textTheme.displayLarge), trailing: Switch(value: showAverages, onChanged: (bool value){ prefs.setBool("showAverages", value); setState(() { @@ -410,7 +437,7 @@ class _DestinationSettings extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text("Show position on leaderboard by stats", style: settingsTitlesStyle), + title: Text("Show position on leaderboard by stats", style: Theme.of(context).textTheme.displayLarge), trailing: Switch(value: showPositions, onChanged: (bool value){ prefs.setBool("showPositions", value); setState(() { @@ -438,7 +465,7 @@ class _DestinationSettings extends State { padding: const EdgeInsets.only(bottom: 8.0), child: Column( children: [ - Text(SettingsCardMod.customization.title, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text(SettingsCardMod.customization.title, style: Theme.of(context).textTheme.titleLarge), ], ), )), @@ -448,7 +475,7 @@ class _DestinationSettings extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text("Accent color", style: settingsTitlesStyle), + title: Text("Accent color", style: Theme.of(context).textTheme.displayLarge), trailing: ColorIndicator(HSVColor.fromColor(Theme.of(context).colorScheme.primary), width: 25, height: 25), ), Divider(), @@ -465,7 +492,7 @@ class _DestinationSettings extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ ListTile( - title: Text("Timestamps format", style: settingsTitlesStyle), + title: Text("Timestamps format", style: Theme.of(context).textTheme.displayLarge), trailing: DropdownButton( value: timestampMode, items: [ @@ -498,7 +525,7 @@ class _DestinationSettings extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text("Sheetbot-like behavior for radar graphs", style: settingsTitlesStyle), + title: Text("Sheetbot-like behavior for radar graphs", style: Theme.of(context).textTheme.displayLarge), trailing: Switch(value: sheetbotRadarGraphs, onChanged: (bool value){ prefs.setBool("sheetbotRadarGraphs", value); setState(() { @@ -519,7 +546,7 @@ class _DestinationSettings extends State { mainAxisSize: MainAxisSize.min, children: [ ListTile( - title: Text("Osk-Kagari gimmick", style: settingsTitlesStyle), + title: Text("Osk-Kagari gimmick", style: Theme.of(context).textTheme.displayLarge), trailing: Switch(value: oskKagariGimmick, onChanged: (bool value){ prefs.setBool("oskKagariGimmick", value); setState(() { @@ -545,7 +572,7 @@ class _DestinationSettings extends State { Card( child: Center(child: Column( children: [ - Text(SettingsCardMod.database.title, style: const TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 42)), + Text(SettingsCardMod.database.title, style: Theme.of(context).textTheme.titleLarge), Divider(), FutureBuilder<(int, int, int)>(future: teto.getDatabaseData(), builder: (context, snapshot) { @@ -602,12 +629,12 @@ class _DestinationSettings extends State { ), Card( child: ListTile( - title: Text("Export Database", style: settingsTitlesStyle), + title: Text("Export Database", style: Theme.of(context).textTheme.displayLarge), ), ), Card( child: ListTile( - title: Text("Import Database", style: settingsTitlesStyle), + title: Text("Import Database", style: Theme.of(context).textTheme.displayLarge), ), ) ], @@ -628,12 +655,12 @@ class _DestinationSettings extends State { width: 450, child: Column( children: [ - const Card( + Card( child: Row( mainAxisSize: MainAxisSize.min, children: [ Spacer(), - Text("Settings", style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36)), + Text("Settings", style: Theme.of(context).textTheme.headlineMedium), Spacer() ], ), @@ -939,7 +966,7 @@ class DistinguishmentThingy extends StatelessWidget{ children: getDistinguishmentTitle(distinguishment.header), ), ), - Text(getDistinguishmentSubtitle(distinguishment.footer), style: const TextStyle(fontSize: 18), textAlign: TextAlign.center), + Text(getDistinguishmentSubtitle(distinguishment.footer), style: Theme.of(context).textTheme.displayLarge, textAlign: TextAlign.center), ], ), ); @@ -1001,7 +1028,7 @@ class FakeDistinguishmentThingy extends StatelessWidget{ ), ), ), - Text(getDistinguishmentSubtitle(), style: const TextStyle(fontSize: 18), textAlign: TextAlign.center), + Text(getDistinguishmentSubtitle(), style: Theme.of(context).textTheme.displayLarge, textAlign: TextAlign.center), ], ), ), @@ -1376,10 +1403,13 @@ class _NewUserThingyState extends State with SingleTickerProvider ), ), ) : Container( - transform: Matrix4.translationValues(0, secondButtonPosition, 0), + transform: Matrix4.translationValues(secondButtonPosition*5, -secondButtonPosition*25, 0), child: Opacity( - opacity: max(0, secondButtonOpacity), - child: const Icon(Icons.person_remove) + opacity: max(0, min(1, secondButtonOpacity)), + child: Transform.rotate( + angle:_addToTrackAnim.status == AnimationStatus.reverse ? (1-_addToTrackAnim.value as double)*-20 : 0, + child: const Icon(Icons.person_remove) + ) ) ), label: _addToTrackAnim.value < 0.5 ? Container( @@ -1391,8 +1421,8 @@ class _NewUserThingyState extends State with SingleTickerProvider ) : Container( transform: Matrix4.translationValues(0, secondButtonPosition, 0), child: Opacity( - opacity: max(0, secondButtonOpacity), - child: Text("Stop tracking") + opacity: max(0, min(1, secondButtonOpacity)), + child: Text(_addToTrackAnimController.isAnimating && _addToTrackAnim.status == AnimationStatus.reverse ? "Done! " : "Stop tracking") ) ), style: const ButtonStyle(shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.only(bottomLeft: Radius.circular(12.0)))))); diff --git a/lib/views/user_view.dart b/lib/views/user_view.dart index 5040240..03cceac 100644 --- a/lib/views/user_view.dart +++ b/lib/views/user_view.dart @@ -43,15 +43,32 @@ class UserState extends State { Widget build(BuildContext context) { //final t = Translations.of(context); return Scaffold( - appBar: AppBar( - title: Text("Search For"), - ), backgroundColor: Colors.black, + floatingActionButtonLocation: FloatingActionButtonLocation.startTop, + floatingActionButton: Padding( + padding: const EdgeInsets.all(8.0), + child: FloatingActionButton( + onPressed: () => Navigator.pop(context), + tooltip: 'Fuck go back', + child: const Icon(Icons.arrow_back), + ), + ), body: SafeArea( - child: LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return DestinationHome(searchFor: widget.searchFor, dataFuture: getData(widget.searchFor), newsFuture: teto.fetchNews(widget.searchFor), constraints: constraints); - } + child: LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + return Row( + children: [ + Card( + child: Column( + children: [ + Text("Pornograph", style: TextStyle(),) + ] + ), + ), + DestinationHome(searchFor: widget.searchFor, dataFuture: getData(widget.searchFor), newsFuture: teto.fetchNews(widget.searchFor), constraints: constraints), + ], + ); + } ) ) ); diff --git a/lib/widgets/recent_sp_games.dart b/lib/widgets/recent_sp_games.dart index 92a2ff9..028815d 100644 --- a/lib/widgets/recent_sp_games.dart +++ b/lib/widgets/recent_sp_games.dart @@ -41,7 +41,7 @@ class RecentSingleplayerGames extends StatelessWidget{ "5mblast" => get40lTime(record.stats.finalTime.inMicroseconds), String() => "huh", }, - style: const TextStyle(fontSize: 18)), + style: Theme.of(context).textTheme.displayLarge), subtitle: Text(timestamp(record.timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)), trailing: SpTrailingStats(record, record.gamemode) ) diff --git a/lib/widgets/singleplayer_record.dart b/lib/widgets/singleplayer_record.dart index d2086b9..2276d8d 100644 --- a/lib/widgets/singleplayer_record.dart +++ b/lib/widgets/singleplayer_record.dart @@ -141,7 +141,7 @@ class SingleplayerRecord extends StatelessWidget { "5mblast" => get40lTime(stream!.records[i].stats.finalTime.inMicroseconds), String() => "huh", }, - style: const TextStyle(fontSize: 18)), + style: Theme.of(context).textTheme.displayLarge), subtitle: Text(timestamp(stream!.records[i].timestamp), style: const TextStyle(color: Colors.grey, height: 0.85)), trailing: SpTrailingStats(stream!.records[i], stream!.records[i].gamemode) )