6 Commits

Author SHA1 Message Date
2cadab004d Merge cleaning
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m2s
Pull Request Pipeline / lint (pull_request) Successful in 2m7s
2026-01-13 22:58:35 +01:00
6a3e184a95 Merge branch 'development' into feature/129-neues-popup-design
# Conflicts:
#	lib/presentation/views/main_menu/settings_view/settings_view.dart
2026-01-13 22:57:19 +01:00
5350113ee1 Updated doc strings 2026-01-13 22:54:19 +01:00
e483fc38f3 Merge pull request 'Anzeigefehler mit Snackbar' (#166) from bug/155-anzeigefehler-mit-snackbar into development
Reviewed-on: #166
Reviewed-by: gelbeinhalb <spam@yannick-weigert.de>
2026-01-13 21:09:21 +00:00
7be0b96491 Added hiding to prevent stacking snackbars
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m19s
Pull Request Pipeline / lint (pull_request) Successful in 2m23s
2026-01-13 21:45:22 +01:00
efdb5e0361 Fixed snackbar 2026-01-13 21:44:38 +01:00
5 changed files with 238 additions and 201 deletions

View File

@@ -39,7 +39,9 @@ class _SettingsViewState extends State<SettingsView> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final loc = AppLocalizations.of(context); final loc = AppLocalizations.of(context);
return ScaffoldMessenger( return ScaffoldMessenger(
child: Scaffold( child: Builder(
builder: (scaffoldMessengerContext) {
return Scaffold(
appBar: AppBar(backgroundColor: CustomTheme.backgroundColor), appBar: AppBar(backgroundColor: CustomTheme.backgroundColor),
backgroundColor: CustomTheme.backgroundColor, backgroundColor: CustomTheme.backgroundColor,
body: SingleChildScrollView( body: SingleChildScrollView(
@@ -59,7 +61,11 @@ class _SettingsViewState extends State<SettingsView> {
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.only(left: 16, top: 10, bottom: 10), padding: const EdgeInsets.only(
left: 16,
top: 10,
bottom: 10,
),
child: Text( child: Text(
textAlign: TextAlign.start, textAlign: TextAlign.start,
loc.data, loc.data,
@@ -75,13 +81,18 @@ class _SettingsViewState extends State<SettingsView> {
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(context); await DataTransferService.getAppDataAsJson(
scaffoldMessengerContext,
);
final result = await DataTransferService.exportData( final result = await DataTransferService.exportData(
json, json,
'game_tracker-data', 'game_tracker-data',
); );
if (!context.mounted) return; if (!scaffoldMessengerContext.mounted) return;
showExportSnackBar(context: context, result: result); showExportSnackBar(
context: scaffoldMessengerContext,
result: result,
);
}, },
), ),
SettingsListTile( SettingsListTile(
@@ -89,9 +100,14 @@ class _SettingsViewState extends State<SettingsView> {
icon: Icons.download, icon: Icons.download,
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(context); final result = await DataTransferService.importData(
if (!context.mounted) return; scaffoldMessengerContext,
showImportSnackBar(context: context, result: result); );
if (!scaffoldMessengerContext.mounted) return;
showImportSnackBar(
context: scaffoldMessengerContext,
result: result,
);
}, },
), ),
SettingsListTile( SettingsListTile(
@@ -107,11 +123,21 @@ class _SettingsViewState extends State<SettingsView> {
actions: [ actions: [
AnimatedDialogButton( AnimatedDialogButton(
onPressed: () => Navigator.of(context).pop(false), onPressed: () => Navigator.of(context).pop(false),
child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor)), child: Text(
loc.cancel,
style: const TextStyle(
color: CustomTheme.textColor,
),
),
), ),
AnimatedDialogButton( AnimatedDialogButton(
onPressed: () => Navigator.of(context).pop(true), onPressed: () => Navigator.of(context).pop(true),
child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor)), child: Text(
loc.delete,
style: TextStyle(
color: CustomTheme.secondaryColor,
),
),
), ),
], ],
), ),
@@ -119,7 +145,7 @@ class _SettingsViewState extends State<SettingsView> {
if (confirmed == true && context.mounted) { if (confirmed == true && context.mounted) {
DataTransferService.deleteAllData(context); DataTransferService.deleteAllData(context);
showSnackbar( showSnackbar(
context: context, context: scaffoldMessengerContext,
message: AppLocalizations.of( message: AppLocalizations.of(
context, context,
).data_successfully_deleted, ).data_successfully_deleted,
@@ -129,7 +155,11 @@ class _SettingsViewState extends State<SettingsView> {
}, },
), ),
Padding( Padding(
padding: const EdgeInsets.only(left: 16, top: 10, bottom: 10), padding: const EdgeInsets.only(
left: 16,
top: 10,
bottom: 10,
),
child: Text( child: Text(
textAlign: TextAlign.start, textAlign: TextAlign.start,
loc.legal, loc.legal,
@@ -178,7 +208,9 @@ class _SettingsViewState extends State<SettingsView> {
GestureDetector( GestureDetector(
child: const Icon(Icons.language), child: const Icon(Icons.language),
onTap: () => { onTap: () => {
launchUrl(Uri.parse('https://liquid-dev.de')), launchUrl(
Uri.parse('https://liquid-dev.de'),
),
}, },
), ),
GestureDetector( GestureDetector(
@@ -227,6 +259,8 @@ class _SettingsViewState extends State<SettingsView> {
], ],
), ),
), ),
);
},
), ),
); );
} }
@@ -287,10 +321,11 @@ class _SettingsViewState extends State<SettingsView> {
Duration duration = const Duration(seconds: 3), Duration duration = const Duration(seconds: 3),
VoidCallback? action, VoidCallback? action,
}) { }) {
if (!context.mounted) return;
final loc = AppLocalizations.of(context); final loc = AppLocalizations.of(context);
final messenger = ScaffoldMessenger.of(context); ScaffoldMessenger.of(context).hideCurrentSnackBar();
messenger.hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar(
messenger.showSnackBar(
SnackBar( SnackBar(
content: Text(message, style: const TextStyle(color: Colors.white)), content: Text(message, style: const TextStyle(color: Colors.white)),
backgroundColor: CustomTheme.onBoxColor, backgroundColor: CustomTheme.onBoxColor,

View File

@@ -1,18 +1,20 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart'; import 'package:game_tracker/core/custom_theme.dart';
/// A custom animated button widget that provides a scaling and opacity effect
/// when pressed. This widget is designed to be used in dialogs or other UI
/// components where a visually appealing button is required.
///
/// Parameters:
/// - [onPressed]: Callback function that is triggered when the button is pressed.
/// - [child]: The child widget to be displayed inside the button, typically a text or icon.
class AnimatedDialogButton extends StatefulWidget { class AnimatedDialogButton extends StatefulWidget {
const AnimatedDialogButton({super.key, required this.onPressed, required this.child}); /// A custom animated button widget that provides a scaling and opacity effect
/// when pressed.
/// - [onPressed]: Callback function that is triggered when the button is pressed.
/// - [child]: The child widget to be displayed inside the button, typically a text or icon.
const AnimatedDialogButton({
super.key,
required this.onPressed,
required this.child,
});
/// Callback function that is triggered when the button is pressed. /// Callback function that is triggered when the button is pressed.
final VoidCallback onPressed; final VoidCallback onPressed;
/// The child widget to be displayed inside the button, typically a text or icon. /// The child widget to be displayed inside the button, typically a text or icon.
final Widget child; final Widget child;

View File

@@ -1,17 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart'; import 'package:game_tracker/core/custom_theme.dart';
/// A custom alert dialog widget that follows the application's design theme.
///
/// This widget provides a styled alternative to the default Flutter AlertDialog,
/// with consistent colors, borders, and layout that match the app's custom theme.
///
/// Parameters:
/// - [title]: The title text displayed at the top of the dialog.
/// - [content]: The main content text displayed in the body of the dialog.
/// - [actions]: A list of action widgets (typically buttons) displayed at the bottom
/// of the dialog. These actions are horizontally spaced around the dialog's width.
class CustomAlertDialog extends StatelessWidget { class CustomAlertDialog extends StatelessWidget {
/// A custom alert dialog widget that provides a os unspecific AlertDialog,
/// with consistent colors, borders, and layout that match the app's custom theme.
/// - [title]: The title text displayed at the top of the dialog.
/// - [content]: The main content text displayed in the body of the dialog.
/// - [actions]: A list of action widgets (typically buttons) displayed at the bottom
/// of the dialog. These actions are horizontally spaced around the dialog's width.
const CustomAlertDialog({ const CustomAlertDialog({
super.key, super.key,
required this.title, required this.title,
@@ -26,8 +22,11 @@ class CustomAlertDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text(title, style: const TextStyle(color: CustomTheme.textColor,),), title: Text(title, style: const TextStyle(color: CustomTheme.textColor)),
content: Text(content, style: const TextStyle(color: CustomTheme.textColor),), content: Text(
content,
style: const TextStyle(color: CustomTheme.textColor),
),
actions: actions, actions: actions,
backgroundColor: CustomTheme.boxColor, backgroundColor: CustomTheme.boxColor,
actionsAlignment: MainAxisAlignment.spaceAround, actionsAlignment: MainAxisAlignment.spaceAround,

View File

@@ -295,6 +295,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
/// [message] - The message to display in the snackbar. /// [message] - The message to display in the snackbar.
void showSnackBarMessage(String message) { void showSnackBarMessage(String message) {
if (!context.mounted) return; if (!context.mounted) return;
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
backgroundColor: CustomTheme.boxColor, backgroundColor: CustomTheme.boxColor,

View File

@@ -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.6+209 version: 0.0.7+212
environment: environment:
sdk: ^3.8.1 sdk: ^3.8.1