Compare commits
1 Commits
799b7d8403
...
v.0.0.1-al
| Author | SHA1 | Date | |
|---|---|---|---|
| f0379e97c7 |
@@ -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;
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
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';
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
@@ -72,49 +70,50 @@ 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: SizedBox(
|
child: ClipRRect(
|
||||||
height: 70,
|
borderRadius: BorderRadius.circular(24),
|
||||||
child: Row(
|
child: SizedBox(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
height: 60,
|
||||||
children: <Widget>[
|
child: Row(
|
||||||
NavbarItem(
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
index: 0,
|
children: <Widget>[
|
||||||
isSelected: currentIndex == 0,
|
NavbarItem(
|
||||||
icon: Icons.home_rounded,
|
index: 0,
|
||||||
label: loc.home,
|
isSelected: currentIndex == 0,
|
||||||
onTabTapped: onTabTapped,
|
icon: Icons.home_rounded,
|
||||||
),
|
label: loc.home,
|
||||||
NavbarItem(
|
onTabTapped: onTabTapped,
|
||||||
index: 1,
|
),
|
||||||
isSelected: currentIndex == 1,
|
NavbarItem(
|
||||||
icon: Icons.gamepad_rounded,
|
index: 1,
|
||||||
label: loc.matches,
|
isSelected: currentIndex == 1,
|
||||||
onTabTapped: onTabTapped,
|
icon: Icons.gamepad_rounded,
|
||||||
),
|
label: loc.matches,
|
||||||
NavbarItem(
|
onTabTapped: onTabTapped,
|
||||||
index: 2,
|
),
|
||||||
isSelected: currentIndex == 2,
|
NavbarItem(
|
||||||
icon: Icons.group_rounded,
|
index: 2,
|
||||||
label: loc.groups,
|
isSelected: currentIndex == 2,
|
||||||
onTabTapped: onTabTapped,
|
icon: Icons.group_rounded,
|
||||||
),
|
label: loc.groups,
|
||||||
NavbarItem(
|
onTabTapped: onTabTapped,
|
||||||
index: 3,
|
),
|
||||||
isSelected: currentIndex == 3,
|
NavbarItem(
|
||||||
icon: Icons.bar_chart_rounded,
|
index: 3,
|
||||||
label: loc.statistics,
|
isSelected: currentIndex == 3,
|
||||||
onTabTapped: onTabTapped,
|
icon: Icons.bar_chart_rounded,
|
||||||
),
|
label: loc.statistics,
|
||||||
],
|
onTabTapped: onTabTapped,
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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
|
widget.icon,
|
||||||
? _scaleAnimation
|
color: widget.isSelected ? Colors.white : Colors.black,
|
||||||
: const AlwaysStoppedAnimation(1.0),
|
|
||||||
child: Icon(
|
|
||||||
widget.icon,
|
|
||||||
color: widget.isSelected
|
|
||||||
? 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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+69
|
version: 0.0.1+21
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.8.1
|
sdk: ^3.8.1
|
||||||
|
|||||||
Reference in New Issue
Block a user