Compare commits
37 Commits
c4f6749882
...
enhancemen
| Author | SHA1 | Date | |
|---|---|---|---|
| 679f4c94d9 | |||
| 8bf2b9e3dd | |||
| cde40ef293 | |||
| 0fb6208345 | |||
| ab20bd764b | |||
| 8ca4e3210e | |||
| a480530919 | |||
| 906c8d8450 | |||
| 000bdc8cbc | |||
| 497f30421d | |||
| adedb85eb2 | |||
| 2a72332bcd | |||
| 7aa41abe61 | |||
| e1263d51ad | |||
| 8791b5296e | |||
| f2a4327166 | |||
| d34990ed50 | |||
| 2ef671884d | |||
| 2ef8eb6534 | |||
| 6f0e5ba5c2 | |||
| 1c07346aaf | |||
| 830a64b5dd | |||
| 9221f64fa5 | |||
| 14a043785e | |||
| 9eb9c0eb7f | |||
| 54ec865f04 | |||
| d5e7a17127 | |||
| 275f64b296 | |||
| 97ca62b083 | |||
| 32fb1550ff | |||
| d67972624e | |||
| 6faafe9fab | |||
| 66b90aac25 | |||
| db3e8215fa | |||
| a4ef9705f9 | |||
| 799c849570 | |||
| 799b7d8403 |
19
lib/core/adaptive_page_route.dart
Normal file
19
lib/core/adaptive_page_route.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
Route<T> adaptivePageRoute<T>({
|
||||||
|
required Widget Function(BuildContext) builder,
|
||||||
|
bool fullscreenDialog = false,
|
||||||
|
}) {
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
return CupertinoPageRoute<T>(
|
||||||
|
builder: builder,
|
||||||
|
fullscreenDialog: fullscreenDialog,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return MaterialPageRoute<T>(
|
||||||
|
builder: builder,
|
||||||
|
fullscreenDialog: fullscreenDialog,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -11,6 +11,8 @@ class CustomTheme {
|
|||||||
static Color onBoxColor = const Color(0xFF181818);
|
static Color onBoxColor = const Color(0xFF181818);
|
||||||
static Color boxBorder = const Color(0xFF272727);
|
static Color boxBorder = const Color(0xFF272727);
|
||||||
static const Color textColor = Colors.white;
|
static const Color textColor = Colors.white;
|
||||||
|
static Color navBarItemSelectedColor = primaryColor.withGreen(100);
|
||||||
|
static Color navBarItemUnselectedColor = Colors.grey.shade400;
|
||||||
|
|
||||||
// ==================== Border Radius ====================
|
// ==================== Border Radius ====================
|
||||||
static const double standardBorderRadius = 12.0;
|
static const double standardBorderRadius = 12.0;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Match {
|
|||||||
final String name;
|
final String name;
|
||||||
final List<Player>? players;
|
final List<Player>? players;
|
||||||
final Group? group;
|
final Group? group;
|
||||||
final Player? winner;
|
Player? winner;
|
||||||
|
|
||||||
Match({
|
Match({
|
||||||
String? id,
|
String? id,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
"data_successfully_imported": "Daten erfolgreich importiert",
|
"data_successfully_imported": "Daten erfolgreich importiert",
|
||||||
"days_ago": "vor {count} Tagen",
|
"days_ago": "vor {count} Tagen",
|
||||||
"delete": "Löschen",
|
"delete": "Löschen",
|
||||||
"delete_all_data": "Alle Daten löschen?",
|
"delete_all_data": "Alle Daten löschen",
|
||||||
"error_creating_group": "Fehler beim Erstellen der Gruppe, bitte erneut versuchen",
|
"error_creating_group": "Fehler beim Erstellen der Gruppe, bitte erneut versuchen",
|
||||||
"error_reading_file": "Fehler beim Lesen der Datei",
|
"error_reading_file": "Fehler beim Lesen der Datei",
|
||||||
"export_canceled": "Export abgebrochen",
|
"export_canceled": "Export abgebrochen",
|
||||||
|
|||||||
@@ -277,7 +277,7 @@
|
|||||||
"data_successfully_imported": "Data successfully imported",
|
"data_successfully_imported": "Data successfully imported",
|
||||||
"days_ago": "{count} days ago",
|
"days_ago": "{count} days ago",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"delete_all_data": "Delete all data?",
|
"delete_all_data": "Delete all data",
|
||||||
"error_creating_group": "Error while creating group, please try again",
|
"error_creating_group": "Error while creating group, please try again",
|
||||||
"error_reading_file": "Error reading file",
|
"error_reading_file": "Error reading file",
|
||||||
"export_canceled": "Export canceled",
|
"export_canceled": "Export canceled",
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ abstract class AppLocalizations {
|
|||||||
/// Confirmation dialog for deleting all data
|
/// Confirmation dialog for deleting all data
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Delete all data?'**
|
/// **'Delete all data'**
|
||||||
String get delete_all_data;
|
String get delete_all_data;
|
||||||
|
|
||||||
/// Error message when group creation fails
|
/// Error message when group creation fails
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||||||
String get delete => 'Löschen';
|
String get delete => 'Löschen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get delete_all_data => 'Alle Daten löschen?';
|
String get delete_all_data => 'Alle Daten löschen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get error_creating_group =>
|
String get error_creating_group =>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
String get delete => 'Delete';
|
String get delete => 'Delete';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get delete_all_data => 'Delete all data?';
|
String get delete_all_data => 'Delete all data';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get error_creating_group =>
|
String get error_creating_group =>
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ class GameTracker extends StatelessWidget {
|
|||||||
seedColor: CustomTheme.primaryColor,
|
seedColor: CustomTheme.primaryColor,
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
).copyWith(surface: CustomTheme.backgroundColor),
|
).copyWith(surface: CustomTheme.backgroundColor),
|
||||||
|
pageTransitionsTheme: const PageTransitionsTheme(
|
||||||
|
builders: {
|
||||||
|
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||||
|
TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
home: const CustomNavigationBar(),
|
home: const CustomNavigationBar(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/group_view/groups_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/group_view/groups_view.dart';
|
||||||
@@ -56,7 +59,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (_) => const SettingsView()),
|
adaptivePageRoute(builder: (_) => const SettingsView()),
|
||||||
);
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
tabKeyCount++;
|
tabKeyCount++;
|
||||||
@@ -70,18 +73,61 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
body: tabs[currentIndex],
|
body: tabs[currentIndex],
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
bottomNavigationBar: SafeArea(
|
bottomNavigationBar: SizedBox(
|
||||||
minimum: const EdgeInsets.only(bottom: 30),
|
height: 70 + MediaQuery.of(context).padding.bottom,
|
||||||
child: Container(
|
child: Stack(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 10),
|
children: [
|
||||||
decoration: BoxDecoration(
|
// Dynamisch generierte Blur-Layer für ultra-smooth Übergang
|
||||||
borderRadius: BorderRadius.circular(24),
|
...List.generate(35, (index) {
|
||||||
color: CustomTheme.primaryColor,
|
// Verwende kubische Kurve für noch natürlicheren, weicheren Übergang
|
||||||
|
final progress = index / 34.0; // 0.0 bis 1.0
|
||||||
|
final cubic = progress * progress * progress; // Kubische Kurve
|
||||||
|
final blurStrength = 0.5 + (cubic * 50.0); // Sehr sanft von 0.5 bis 50.5
|
||||||
|
|
||||||
|
// Höhe geht jetzt komplett von 100% bis 0% (ganz nach unten)
|
||||||
|
// Mit extra Dichte am unteren Ende für weicheren Übergang
|
||||||
|
final heightFactor = index < 25
|
||||||
|
? 1.0 - (progress * 0.7) // Erste 25 Layer: 100% bis 30%
|
||||||
|
: 0.3 - ((index - 25) / 34.0); // Letzte 10 Layer: 30% bis 0% (dichter)
|
||||||
|
|
||||||
|
return Positioned(
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
height: (70 + MediaQuery.of(context).padding.bottom) * heightFactor.clamp(0.05, 1.0),
|
||||||
|
child: ClipRect(
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(
|
||||||
|
sigmaX: blurStrength,
|
||||||
|
sigmaY: blurStrength,
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: Container(
|
||||||
borderRadius: BorderRadius.circular(24),
|
color: Colors.transparent,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
// Gradient-Overlay
|
||||||
|
Positioned.fill(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.bottomCenter,
|
||||||
|
end: Alignment.topCenter,
|
||||||
|
colors: [
|
||||||
|
CustomTheme.boxColor.withValues(alpha: 1),
|
||||||
|
CustomTheme.boxColor.withValues(alpha: 0.0),
|
||||||
|
],
|
||||||
|
stops: const [0.4, 1],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Navbar-Inhalt
|
||||||
|
SafeArea(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 60,
|
height: 70,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -117,6 +163,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Scaffold(
|
return ScaffoldMessenger(
|
||||||
|
child: Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
appBar: AppBar(title: Text(loc.create_new_group)),
|
appBar: AppBar(title: Text(loc.create_new_group)),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
@@ -106,6 +107,7 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/constants.dart';
|
import 'package:game_tracker/core/constants.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
@@ -7,7 +8,7 @@ import 'package:game_tracker/data/dto/player.dart';
|
|||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/group_view/create_group_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/group_view/create_group_view.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/buttons/custom_width_button.dart';
|
import 'package:game_tracker/presentation/widgets/buttons/main_menu_button.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/group_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/group_tile.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -78,14 +79,14 @@ class _GroupsViewState extends State<GroupsView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: MediaQuery.paddingOf(context).bottom,
|
bottom: MediaQuery.paddingOf(context).bottom + 20,
|
||||||
child: CustomWidthButton(
|
child: MainMenuButton(
|
||||||
text: loc.create_group,
|
text: loc.create_group,
|
||||||
sizeRelativeToWidth: 0.90,
|
icon: Icons.group_add,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return const CreateGroupView();
|
return const CreateGroupView();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/constants.dart';
|
import 'package:game_tracker/core/constants.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
import 'package:game_tracker/data/dto/group.dart';
|
import 'package:game_tracker/data/dto/group.dart';
|
||||||
@@ -105,13 +106,13 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
match: match,
|
match: match,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Navigator.of(context).push(
|
await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
adaptivePageRoute(
|
||||||
fullscreenDialog: true,
|
fullscreenDialog: true,
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
MatchResultView(match: match),
|
MatchResultView(match: match),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
loadHomeViewData();
|
await updatedWinnerinRecentMatches(match.id);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -186,7 +187,7 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
|
|
||||||
/// Loads the data for the HomeView from the database.
|
/// Loads the data for the HomeView from the database.
|
||||||
/// This includes the match count, group count, and recent matches.
|
/// This includes the match count, group count, and recent matches.
|
||||||
void loadHomeViewData() {
|
Future<void> loadHomeViewData() async {
|
||||||
final db = Provider.of<AppDatabase>(context, listen: false);
|
final db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
Future.wait([
|
Future.wait([
|
||||||
db.matchDao.getMatchCount(),
|
db.matchDao.getMatchCount(),
|
||||||
@@ -209,4 +210,16 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Updates the winner information for a specific match in the recent matches list.
|
||||||
|
Future<void> updatedWinnerinRecentMatches(String matchId) async {
|
||||||
|
final db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
|
final winner = await db.matchDao.getWinner(matchId: matchId);
|
||||||
|
final matchIndex = recentMatches.indexWhere((match) => match.id == matchId);
|
||||||
|
if (matchIndex != -1) {
|
||||||
|
setState(() {
|
||||||
|
recentMatches[matchIndex].winner = winner;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,11 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
filteredGroups.clear();
|
filteredGroups.clear();
|
||||||
filteredGroups.addAll(
|
filteredGroups.addAll(
|
||||||
widget.groups.where(
|
widget.groups.where(
|
||||||
(group) => group.name.toLowerCase().contains(query.toLowerCase()),
|
(group) =>
|
||||||
|
group.name.toLowerCase().contains(query.toLowerCase()) ||
|
||||||
|
group.members.any(
|
||||||
|
(player) => player.name.toLowerCase().contains(query.toLowerCase()),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/core/enums.dart';
|
import 'package:game_tracker/core/enums.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
@@ -119,7 +119,8 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Scaffold(
|
return ScaffoldMessenger(
|
||||||
|
child: Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
appBar: AppBar(title: Text(loc.create_new_match)),
|
appBar: AppBar(title: Text(loc.create_new_match)),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
@@ -140,7 +141,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
: games[selectedGameIndex].$1,
|
: games[selectedGameIndex].$1,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
selectedGameIndex = await Navigator.of(context).push(
|
selectedGameIndex = await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) => ChooseGameView(
|
builder: (context) => ChooseGameView(
|
||||||
games: games,
|
games: games,
|
||||||
initialGameIndex: selectedGameIndex,
|
initialGameIndex: selectedGameIndex,
|
||||||
@@ -168,7 +169,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
: translateRulesetToString(selectedRuleset!, context),
|
: translateRulesetToString(selectedRuleset!, context),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
selectedRuleset = await Navigator.of(context).push(
|
selectedRuleset = await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) => ChooseRulesetView(
|
builder: (context) => ChooseRulesetView(
|
||||||
rulesets: _rulesets,
|
rulesets: _rulesets,
|
||||||
initialRulesetIndex: selectedRulesetIndex,
|
initialRulesetIndex: selectedRulesetIndex,
|
||||||
@@ -190,7 +191,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
: selectedGroup!.name,
|
: selectedGroup!.name,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
selectedGroup = await Navigator.of(context).push(
|
selectedGroup = await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) => ChooseGroupView(
|
builder: (context) => ChooseGroupView(
|
||||||
groups: groupsList,
|
groups: groupsList,
|
||||||
initialGroupId: selectedGroupId,
|
initialGroupId: selectedGroupId,
|
||||||
@@ -240,7 +241,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
adaptivePageRoute(
|
||||||
fullscreenDialog: true,
|
fullscreenDialog: true,
|
||||||
builder: (context) => MatchResultView(
|
builder: (context) => MatchResultView(
|
||||||
match: match,
|
match: match,
|
||||||
@@ -255,6 +256,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import 'dart:core' hide Match;
|
import 'dart:core' hide Match;
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fluttericon/rpg_awesome_icons.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/constants.dart';
|
import 'package:game_tracker/core/constants.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
@@ -12,7 +13,7 @@ import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
|||||||
import 'package:game_tracker/presentation/views/main_menu/match_view/create_match/create_match_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/match_view/create_match/create_match_view.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/match_view/match_result_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/match_view/match_result_view.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/buttons/custom_width_button.dart';
|
import 'package:game_tracker/presentation/widgets/buttons/main_menu_button.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/match_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/match_tile.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -86,7 +87,7 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
adaptivePageRoute(
|
||||||
fullscreenDialog: true,
|
fullscreenDialog: true,
|
||||||
builder: (context) => MatchResultView(
|
builder: (context) => MatchResultView(
|
||||||
match: matches[index],
|
match: matches[index],
|
||||||
@@ -104,14 +105,14 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: MediaQuery.paddingOf(context).bottom,
|
bottom: MediaQuery.paddingOf(context).bottom + 20,
|
||||||
child: CustomWidthButton(
|
child: MainMenuButton(
|
||||||
text: loc.create_match,
|
text: 'Spiel erstellen',
|
||||||
sizeRelativeToWidth: 0.90,
|
icon: RpgAwesome.clovers_card,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
CreateMatchView(onWinnerChanged: loadGames),
|
CreateMatchView(onWinnerChanged: loadGames),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:game_tracker/core/enums.dart';
|
|||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/settings_list_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/settings_list_tile.dart';
|
||||||
import 'package:game_tracker/services/data_transfer_service.dart';
|
import 'package:game_tracker/services/data_transfer_service.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
|
||||||
class SettingsView extends StatefulWidget {
|
class SettingsView extends StatefulWidget {
|
||||||
const SettingsView({super.key});
|
const SettingsView({super.key});
|
||||||
@@ -13,21 +14,26 @@ class SettingsView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SettingsViewState extends State<SettingsView> {
|
class _SettingsViewState extends State<SettingsView> {
|
||||||
|
PackageInfo _packageInfo = PackageInfo(
|
||||||
|
appName: 'n.A.',
|
||||||
|
packageName: 'n.A.',
|
||||||
|
version: 'n.A.',
|
||||||
|
buildNumber: 'n.A.',
|
||||||
|
);
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_initPackageInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Scaffold(
|
return ScaffoldMessenger(
|
||||||
|
child: Scaffold(
|
||||||
appBar: AppBar(backgroundColor: CustomTheme.backgroundColor),
|
appBar: AppBar(backgroundColor: CustomTheme.backgroundColor),
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
body: LayoutBuilder(
|
body: Column(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) =>
|
|
||||||
SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -43,10 +49,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
||||||
horizontal: 24,
|
|
||||||
vertical: 10,
|
|
||||||
),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
loc.settings,
|
loc.settings,
|
||||||
@@ -61,8 +64,9 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
icon: Icons.upload_rounded,
|
icon: Icons.upload_rounded,
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final String json =
|
final String json = await DataTransferService.getAppDataAsJson(
|
||||||
await DataTransferService.getAppDataAsJson(context);
|
context,
|
||||||
|
);
|
||||||
final result = await DataTransferService.exportData(
|
final result = await DataTransferService.exportData(
|
||||||
json,
|
json,
|
||||||
'game_tracker-data',
|
'game_tracker-data',
|
||||||
@@ -76,9 +80,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
icon: Icons.download_rounded,
|
icon: Icons.download_rounded,
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final result = await DataTransferService.importData(
|
final result = await DataTransferService.importData(context);
|
||||||
context,
|
|
||||||
);
|
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
showImportSnackBar(context: context, result: result);
|
showImportSnackBar(context: context, result: result);
|
||||||
},
|
},
|
||||||
@@ -91,7 +93,7 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
showDialog<bool>(
|
showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: Text(loc.delete_all_data),
|
title: Text('${loc.delete_all_data}?'),
|
||||||
content: Text(loc.this_cannot_be_undone),
|
content: Text(loc.this_cannot_be_undone),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -117,10 +119,23 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
const Spacer(),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Version ${_packageInfo.version} (${_packageInfo.buildNumber})',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,4 +209,11 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _initPackageInfo() async {
|
||||||
|
final info = await PackageInfo.fromPlatform();
|
||||||
|
setState(() {
|
||||||
|
_packageInfo = info;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
98
lib/presentation/widgets/buttons/main_menu_button.dart
Normal file
98
lib/presentation/widgets/buttons/main_menu_button.dart
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// A button for the main menu with an optional icon and a press animation.
|
||||||
|
/// - [text]: The text of the button.
|
||||||
|
/// - [icon]: The icon of the button.
|
||||||
|
/// - [onPressed]: The callback to be invoked when the button is pressed.
|
||||||
|
class MainMenuButton extends StatefulWidget {
|
||||||
|
const MainMenuButton({
|
||||||
|
super.key,
|
||||||
|
required this.text,
|
||||||
|
this.icon,
|
||||||
|
required this.onPressed,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// The text of the button.
|
||||||
|
final String text;
|
||||||
|
|
||||||
|
/// The icon of the button.
|
||||||
|
final IconData? icon;
|
||||||
|
|
||||||
|
/// The callback to be invoked when the button is pressed.
|
||||||
|
final void Function() onPressed;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MainMenuButton> createState() => _MainMenuButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MainMenuButtonState extends State<MainMenuButton>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late AnimationController _animationController;
|
||||||
|
late Animation<double> _scaleAnimation;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
_animationController = AnimationController(
|
||||||
|
duration: const Duration(milliseconds: 100),
|
||||||
|
vsync: this,
|
||||||
|
);
|
||||||
|
|
||||||
|
_scaleAnimation = Tween<double>(begin: 1.0, end: 0.95).animate(
|
||||||
|
CurvedAnimation(parent: _animationController, curve: Curves.easeInOut),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ScaleTransition(
|
||||||
|
scale: _scaleAnimation,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTapDown: (_) {
|
||||||
|
_animationController.forward();
|
||||||
|
},
|
||||||
|
onTapUp: (_) async {
|
||||||
|
await _animationController.reverse();
|
||||||
|
if (mounted) {
|
||||||
|
widget.onPressed();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onTapCancel: () {
|
||||||
|
_animationController.reverse();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
if (widget.icon != null) ...[
|
||||||
|
Icon(widget.icon, size: 26, color: Colors.black),
|
||||||
|
const SizedBox(width: 7),
|
||||||
|
],
|
||||||
|
Text(
|
||||||
|
widget.text,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_animationController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
/// A navigation bar item widget that represents a single tab in a navigation bar.
|
/// A navigation bar item widget that represents a single tab in a navigation bar.
|
||||||
/// - [index]: The index of the tab.
|
/// - [index]: The index of the tab.
|
||||||
@@ -35,7 +36,45 @@ class NavbarItem extends StatefulWidget {
|
|||||||
State<NavbarItem> createState() => _NavbarItemState();
|
State<NavbarItem> createState() => _NavbarItemState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NavbarItemState extends State<NavbarItem> {
|
class _NavbarItemState extends State<NavbarItem>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
/// Animation controller for the scale animation
|
||||||
|
late AnimationController _animationController;
|
||||||
|
|
||||||
|
/// Scale animation for the icon when selected
|
||||||
|
late Animation<double> _scaleAnimation;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_animationController = AnimationController(
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
vsync: this,
|
||||||
|
);
|
||||||
|
|
||||||
|
_scaleAnimation = Tween<double>(begin: 1.0, end: 1.2).animate(
|
||||||
|
CurvedAnimation(
|
||||||
|
parent: _animationController,
|
||||||
|
curve: Curves.easeInOutBack,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (widget.isSelected) {
|
||||||
|
_animationController.forward();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrigger animation on selection change
|
||||||
|
@override
|
||||||
|
void didUpdateWidget(NavbarItem oldWidget) {
|
||||||
|
super.didUpdateWidget(oldWidget);
|
||||||
|
if (widget.isSelected && !oldWidget.isSelected) {
|
||||||
|
_animationController.forward();
|
||||||
|
} else if (!widget.isSelected && oldWidget.isSelected) {
|
||||||
|
_animationController.reverse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
@@ -48,19 +87,29 @@ class _NavbarItemState extends State<NavbarItem> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
ScaleTransition(
|
||||||
|
scale: widget.isSelected
|
||||||
|
? _scaleAnimation
|
||||||
|
: const AlwaysStoppedAnimation(1.0),
|
||||||
|
child: Icon(
|
||||||
widget.icon,
|
widget.icon,
|
||||||
color: widget.isSelected ? Colors.white : Colors.black,
|
color: widget.isSelected
|
||||||
|
? CustomTheme.navBarItemSelectedColor
|
||||||
|
: CustomTheme.navBarItemUnselectedColor,
|
||||||
|
size: 32,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
widget.label,
|
widget.label,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.isSelected ? Colors.white : Colors.black,
|
color: widget.isSelected
|
||||||
fontSize: 12,
|
? CustomTheme.navBarItemSelectedColor
|
||||||
|
: CustomTheme.navBarItemUnselectedColor,
|
||||||
|
fontSize: widget.isSelected ? 12 : 11,
|
||||||
fontWeight: widget.isSelected
|
fontWeight: widget.isSelected
|
||||||
? FontWeight.bold
|
? FontWeight.bold
|
||||||
: FontWeight.normal,
|
: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -69,4 +118,10 @@ class _NavbarItemState extends State<NavbarItem> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_animationController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: game_tracker
|
name: game_tracker
|
||||||
description: "Game Tracking App for Card Games"
|
description: "Game Tracking App for Card Games"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.0.2+75
|
version: 0.0.1+160
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.8.1
|
sdk: ^3.8.1
|
||||||
@@ -22,6 +22,8 @@ dependencies:
|
|||||||
intl: any
|
intl: any
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
package_info_plus: ^9.0.0
|
||||||
|
fluttericon: ^2.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user