Feature: Introduce GlassBottomBar for enhanced navigation with a glass effect and integrate it into AppShell for improved UI aesthetics.

This commit is contained in:
2025-09-27 15:39:32 +02:00
parent ff357d4a4a
commit 2bdb094819
2 changed files with 143 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
import 'package:app/core/app/router.dart';
import 'package:app/core/features/feature_controller.dart';
import 'package:app/core/i18n/translations.g.dart';
import 'package:app/core/ui/glas_bottom_bar.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
@@ -160,23 +161,23 @@ class _AppShellState extends State<AppShell> {
return Scaffold(
appBar: appBar,
// Let content flow under the floating bar for the glass effect
extendBody: true,
body: SafeArea(child: widget.child),
bottomNavigationBar: AnimatedBuilder(
animation: fc,
builder: (context, _) {
final baseTabs = _getMobileTabs(context);
// Erlaubte Tabs filtern
// Filter allowed tabs (your existing guard)
var tabs = <({IconData icon, String label, String route})>[
for (final it in baseTabs)
if (_routeEnabled(it.route, fc)) it,
];
// Fallback: min. 2 Ziele sicherstellen
// Fallback to ensure min. 2 items
if (tabs.length < 2) {
// Home ist immer erlaubt; „Einstellungen“ als zweites Ziel ergänzen
tabs = [
// Stelle sicher, dass Home als erstes drin ist
(
icon: Icons.dashboard,
label: Translations.of(context).app.navigationDashboard,
@@ -190,22 +191,18 @@ class _AppShellState extends State<AppShell> {
];
}
// aktuellen Index robust bestimmen
final currentPath = GoRouterState.of(context).matchedLocation;
int selected = 0;
for (var i = 0; i < tabs.length; i++) {
if (currentPath.startsWith(tabs[i].route)) {
selected = i;
break;
}
}
return NavigationBar(
selectedIndex: selected,
onDestinationSelected: (i) => context.go(tabs[i].route),
destinations: [
return GlassBottomBar(
currentPath: currentPath,
onSelect: (route) => context.go(route),
items: [
for (final it in tabs)
NavigationDestination(icon: Icon(it.icon), label: it.label),
GlassBottomBarItem(
icon: it.icon,
label: it.label,
route: it.route,
),
],
);
},