Compare commits
6 Commits
db51990695
...
2cadab004d
| Author | SHA1 | Date | |
|---|---|---|---|
| 2cadab004d | |||
| 6a3e184a95 | |||
| 5350113ee1 | |||
| e483fc38f3 | |||
| 7be0b96491 | |||
| efdb5e0361 |
@@ -39,194 +39,228 @@ 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(
|
||||||
appBar: AppBar(backgroundColor: CustomTheme.backgroundColor),
|
builder: (scaffoldMessengerContext) {
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
return Scaffold(
|
||||||
body: SingleChildScrollView(
|
appBar: AppBar(backgroundColor: CustomTheme.backgroundColor),
|
||||||
child: Column(
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
body: SingleChildScrollView(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
Padding(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
padding: const EdgeInsets.only(left: 16, bottom: 10),
|
children: [
|
||||||
child: Text(
|
Padding(
|
||||||
textAlign: TextAlign.start,
|
padding: const EdgeInsets.only(left: 16, bottom: 10),
|
||||||
loc.settings,
|
child: Text(
|
||||||
style: const TextStyle(
|
textAlign: TextAlign.start,
|
||||||
fontSize: 28,
|
loc.settings,
|
||||||
fontWeight: FontWeight.bold,
|
style: const TextStyle(
|
||||||
),
|
fontSize: 28,
|
||||||
),
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 16, top: 10, bottom: 10),
|
|
||||||
child: Text(
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
loc.data,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SettingsListTile(
|
|
||||||
title: loc.export_data,
|
|
||||||
icon: Icons.upload,
|
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
|
||||||
onPressed: () async {
|
|
||||||
final String json =
|
|
||||||
await DataTransferService.getAppDataAsJson(context);
|
|
||||||
final result = await DataTransferService.exportData(
|
|
||||||
json,
|
|
||||||
'game_tracker-data',
|
|
||||||
);
|
|
||||||
if (!context.mounted) return;
|
|
||||||
showExportSnackBar(context: context, result: result);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SettingsListTile(
|
|
||||||
title: loc.import_data,
|
|
||||||
icon: Icons.download,
|
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
|
||||||
onPressed: () async {
|
|
||||||
final result = await DataTransferService.importData(context);
|
|
||||||
if (!context.mounted) return;
|
|
||||||
showImportSnackBar(context: context, result: result);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SettingsListTile(
|
|
||||||
title: loc.delete_all_data,
|
|
||||||
icon: Icons.delete,
|
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
|
||||||
onPressed: () {
|
|
||||||
showDialog<bool>(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => CustomAlertDialog(
|
|
||||||
title: '${loc.delete_all_data}?',
|
|
||||||
content: loc.this_cannot_be_undone,
|
|
||||||
actions: [
|
|
||||||
AnimatedDialogButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
|
||||||
child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor)),
|
|
||||||
),
|
|
||||||
AnimatedDialogButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(true),
|
|
||||||
child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
).then((confirmed) {
|
),
|
||||||
if (confirmed == true && context.mounted) {
|
Padding(
|
||||||
DataTransferService.deleteAllData(context);
|
padding: const EdgeInsets.only(
|
||||||
showSnackbar(
|
left: 16,
|
||||||
context: context,
|
top: 10,
|
||||||
message: AppLocalizations.of(
|
bottom: 10,
|
||||||
context,
|
),
|
||||||
).data_successfully_deleted,
|
child: Text(
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
loc.data,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
title: loc.export_data,
|
||||||
|
icon: Icons.upload,
|
||||||
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
|
onPressed: () async {
|
||||||
|
final String json =
|
||||||
|
await DataTransferService.getAppDataAsJson(
|
||||||
|
scaffoldMessengerContext,
|
||||||
|
);
|
||||||
|
final result = await DataTransferService.exportData(
|
||||||
|
json,
|
||||||
|
'game_tracker-data',
|
||||||
);
|
);
|
||||||
}
|
if (!scaffoldMessengerContext.mounted) return;
|
||||||
});
|
showExportSnackBar(
|
||||||
},
|
context: scaffoldMessengerContext,
|
||||||
),
|
result: result,
|
||||||
Padding(
|
);
|
||||||
padding: const EdgeInsets.only(left: 16, top: 10, bottom: 10),
|
},
|
||||||
child: Text(
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
loc.legal,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
),
|
||||||
),
|
SettingsListTile(
|
||||||
),
|
title: loc.import_data,
|
||||||
SettingsListTile(
|
icon: Icons.download,
|
||||||
title: loc.licenses,
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
icon: Icons.insert_drive_file,
|
onPressed: () async {
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
final result = await DataTransferService.importData(
|
||||||
onPressed: () {
|
scaffoldMessengerContext,
|
||||||
Navigator.of(context).push(
|
);
|
||||||
MaterialPageRoute(
|
if (!scaffoldMessengerContext.mounted) return;
|
||||||
builder: (context) => const LicensesView(),
|
showImportSnackBar(
|
||||||
),
|
context: scaffoldMessengerContext,
|
||||||
);
|
result: result,
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
SettingsListTile(
|
),
|
||||||
title: loc.legal_notice,
|
SettingsListTile(
|
||||||
icon: Icons.account_balance_sharp,
|
title: loc.delete_all_data,
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
icon: Icons.delete,
|
||||||
onPressed: null,
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
),
|
onPressed: () {
|
||||||
SettingsListTile(
|
showDialog<bool>(
|
||||||
title: loc.privacy_policy,
|
context: context,
|
||||||
icon: Icons.gpp_good_rounded,
|
builder: (context) => CustomAlertDialog(
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
title: '${loc.delete_all_data}?',
|
||||||
onPressed: null,
|
content: loc.this_cannot_be_undone,
|
||||||
),
|
actions: [
|
||||||
Padding(
|
AnimatedDialogButton(
|
||||||
padding: const EdgeInsets.only(top: 30, bottom: 20),
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
child: Center(
|
child: Text(
|
||||||
child: Column(
|
loc.cancel,
|
||||||
spacing: 4,
|
style: const TextStyle(
|
||||||
children: [
|
color: CustomTheme.textColor,
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 12),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
spacing: 40,
|
|
||||||
children: [
|
|
||||||
GestureDetector(
|
|
||||||
child: const Icon(Icons.language),
|
|
||||||
onTap: () => {
|
|
||||||
launchUrl(Uri.parse('https://liquid-dev.de')),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
child: const FaIcon(FontAwesomeIcons.github),
|
|
||||||
onTap: () => {
|
|
||||||
launchUrl(
|
|
||||||
Uri.parse(
|
|
||||||
'https://github.com/liquiddevelopmentde',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
},
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
child: Icon(
|
|
||||||
Platform.isIOS
|
|
||||||
? CupertinoIcons.mail_solid
|
|
||||||
: Icons.email,
|
|
||||||
),
|
),
|
||||||
onTap: () => launchUrl(
|
),
|
||||||
Uri.parse('mailto:hi@liquid-dev.de'),
|
AnimatedDialogButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
|
child: Text(
|
||||||
|
loc.delete,
|
||||||
|
style: TextStyle(
|
||||||
|
color: CustomTheme.secondaryColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
).then((confirmed) {
|
||||||
Text(
|
if (confirmed == true && context.mounted) {
|
||||||
'© ${DateFormat('yyyy').format(DateTime.now())} Liquid Development',
|
DataTransferService.deleteAllData(context);
|
||||||
style: TextStyle(
|
showSnackbar(
|
||||||
color: Colors.grey.shade600,
|
context: scaffoldMessengerContext,
|
||||||
fontSize: 14,
|
message: AppLocalizations.of(
|
||||||
fontWeight: FontWeight.w600,
|
context,
|
||||||
),
|
).data_successfully_deleted,
|
||||||
),
|
);
|
||||||
Text(
|
}
|
||||||
'Version ${_packageInfo.version} (${_packageInfo.buildNumber})',
|
});
|
||||||
style: TextStyle(
|
},
|
||||||
color: Colors.grey.shade600,
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 16,
|
||||||
|
top: 10,
|
||||||
|
bottom: 10,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
loc.legal,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
title: loc.licenses,
|
||||||
|
icon: Icons.insert_drive_file,
|
||||||
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const LicensesView(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
title: loc.legal_notice,
|
||||||
|
icon: Icons.account_balance_sharp,
|
||||||
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
|
onPressed: null,
|
||||||
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
title: loc.privacy_policy,
|
||||||
|
icon: Icons.gpp_good_rounded,
|
||||||
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
|
onPressed: null,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 30, bottom: 20),
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
spacing: 4,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 12),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
spacing: 40,
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
child: const Icon(Icons.language),
|
||||||
|
onTap: () => {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse('https://liquid-dev.de'),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
child: const FaIcon(FontAwesomeIcons.github),
|
||||||
|
onTap: () => {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse(
|
||||||
|
'https://github.com/liquiddevelopmentde',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
child: Icon(
|
||||||
|
Platform.isIOS
|
||||||
|
? CupertinoIcons.mail_solid
|
||||||
|
: Icons.email,
|
||||||
|
),
|
||||||
|
onTap: () => launchUrl(
|
||||||
|
Uri.parse('mailto:hi@liquid-dev.de'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'© ${DateFormat('yyyy').format(DateTime.now())} Liquid Development',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Version ${_packageInfo.version} (${_packageInfo.buildNumber})',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -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,
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user