4 Commits

Author SHA1 Message Date
1ebcfc9e57 implement animation
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m4s
Pull Request Pipeline / lint (pull_request) Successful in 2m8s
2026-01-11 17:21:05 +01:00
22ce742d43 change button alignment & remove InkWell Animation
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m8s
Pull Request Pipeline / lint (pull_request) Successful in 2m10s
2026-01-11 17:14:28 +01:00
3ceae8341b add const
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m30s
Pull Request Pipeline / lint (pull_request) Successful in 2m31s
2026-01-11 15:26:50 +01:00
76ce3af643 implement custom alert dialog
Some checks failed
Pull Request Pipeline / lint (pull_request) Failing after 2m34s
Pull Request Pipeline / test (pull_request) Successful in 2m33s
2026-01-11 15:26:10 +01:00
6 changed files with 146 additions and 117 deletions

View File

@@ -11,8 +11,6 @@ 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.withValues(green: 0.4);
static Color navBarItemUnselectedColor = Colors.white.withValues(alpha: 0.6);
// ==================== Border Radius ==================== // ==================== Border Radius ====================
static const double standardBorderRadius = 12.0; static const double standardBorderRadius = 12.0;

View File

@@ -1,5 +1,3 @@
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/adaptive_page_route.dart';
import 'package:game_tracker/core/custom_theme.dart'; import 'package:game_tracker/core/custom_theme.dart';
@@ -73,16 +71,18 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
backgroundColor: CustomTheme.backgroundColor, backgroundColor: CustomTheme.backgroundColor,
body: tabs[currentIndex], body: tabs[currentIndex],
extendBody: true, extendBody: true,
bottomNavigationBar: ClipRRect( bottomNavigationBar: SafeArea(
child: BackdropFilter( minimum: const EdgeInsets.only(bottom: 30),
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container( child: Container(
margin: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: CustomTheme.boxColor.withValues(alpha: 0.8), borderRadius: BorderRadius.circular(24),
color: CustomTheme.primaryColor,
), ),
child: SafeArea( child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: SizedBox( child: SizedBox(
height: 70, height: 60,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
@@ -120,7 +120,6 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
), ),
), ),
), ),
),
); );
} }

View File

@@ -5,6 +5,7 @@ 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'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:game_tracker/presentation/widgets/custom_alert_dialog.dart';
class SettingsView extends StatefulWidget { class SettingsView extends StatefulWidget {
const SettingsView({super.key}); const SettingsView({super.key});
@@ -92,17 +93,17 @@ class _SettingsViewState extends State<SettingsView> {
onPressed: () { onPressed: () {
showDialog<bool>( showDialog<bool>(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => CustomAlertDialog(
title: Text('${loc.delete_all_data}?'), title: '${loc.delete_all_data}?',
content: Text(loc.this_cannot_be_undone), content: loc.this_cannot_be_undone,
actions: [ actions: [
TextButton( _PressableButton(
onPressed: () => Navigator.of(context).pop(false), onPressed: () => Navigator.of(context).pop(false),
child: Text(loc.cancel), child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor)),
), ),
TextButton( _PressableButton(
onPressed: () => Navigator.of(context).pop(true), onPressed: () => Navigator.of(context).pop(true),
child: Text(loc.delete), child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor)),
), ),
], ],
), ),
@@ -217,3 +218,59 @@ class _SettingsViewState extends State<SettingsView> {
}); });
} }
} }
class _PressableButton extends StatefulWidget {
final VoidCallback onPressed;
final Widget child;
const _PressableButton({required this.onPressed, required this.child});
@override
State<_PressableButton> createState() => _PressableButtonState();
}
class _PressableButtonState extends State<_PressableButton> {
bool _isPressed = false;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTapDown: (_) => setState(() => _isPressed = true),
onTapUp: (_) => setState(() => _isPressed = false),
onTapCancel: () => setState(() => _isPressed = false),
onTap: widget.onPressed,
child: AnimatedScale(
scale: _isPressed ? 0.95 : 1.0,
duration: const Duration(milliseconds: 100),
child: AnimatedOpacity(
opacity: _isPressed ? 0.6 : 1.0,
duration: const Duration(milliseconds: 100),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: widget.child,
),
),
),
);
}
}
/*
TextButton(
style: TextButton.styleFrom(
splashFactory: NoSplash.splashFactory,
overlayColor: Colors.transparent,
),
onPressed: () => Navigator.of(context).pop(false),
child: Text(loc.cancel, style: const TextStyle(color: CustomTheme.textColor),),
),
TextButton(
style: TextButton.styleFrom(
splashFactory: NoSplash.splashFactory,
overlayColor: Colors.transparent,
),
onPressed: () => Navigator.of(context).pop(true),
child: Text(loc.delete, style: TextStyle(color: CustomTheme.secondaryColor),),
),
*/

View File

@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
class CustomAlertDialog extends StatelessWidget {
final String title;
final String content;
final List<Widget> actions;
const CustomAlertDialog({
super.key,
required this.title,
required this.content,
required this.actions,
});
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text(title, style: const TextStyle(color: CustomTheme.textColor,),),
content: Text(content, style: const TextStyle(color: CustomTheme.textColor),),
actions: actions,
backgroundColor: CustomTheme.boxColor,
actionsAlignment: MainAxisAlignment.spaceAround,
shape: RoundedRectangleBorder(
borderRadius: CustomTheme.standardBorderRadiusAll,
side: BorderSide(color: CustomTheme.boxBorder),
),
);
}
}

View File

@@ -1,5 +1,4 @@
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.
@@ -36,45 +35,7 @@ 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(
@@ -87,29 +48,19 @@ class _NavbarItemState extends State<NavbarItem>
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
ScaleTransition( Icon(
scale: widget.isSelected
? _scaleAnimation
: const AlwaysStoppedAnimation(1.0),
child: Icon(
widget.icon, widget.icon,
color: widget.isSelected color: widget.isSelected ? Colors.white : Colors.black,
? CustomTheme.navBarItemSelectedColor
: CustomTheme.navBarItemUnselectedColor,
size: 26,
),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
widget.label, widget.label,
style: TextStyle( style: TextStyle(
color: widget.isSelected color: widget.isSelected ? Colors.white : Colors.black,
? CustomTheme.navBarItemSelectedColor fontSize: 12,
: CustomTheme.navBarItemUnselectedColor,
fontSize: widget.isSelected ? 12 : 11,
fontWeight: widget.isSelected fontWeight: widget.isSelected
? FontWeight.bold ? FontWeight.bold
: FontWeight.w500, : FontWeight.normal,
), ),
), ),
], ],
@@ -118,10 +69,4 @@ class _NavbarItemState extends State<NavbarItem>
), ),
); );
} }
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
} }

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.1+149 version: 0.0.4+101
environment: environment:
sdk: ^3.8.1 sdk: ^3.8.1