Files
car_rental_app/lib/features/client/screens/client_shell.dart
T
2026-05-24 02:35:37 -04:00

46 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../../l10n/app_localizations.dart';
class ClientShell extends ConsumerWidget {
final Widget child;
const ClientShell({super.key, required this.child});
@override
Widget build(BuildContext context, WidgetRef ref) {
final location = GoRouterState.of(context).matchedLocation;
final l10n = AppLocalizations.of(context);
int currentIndex = 0;
if (location == '/client/bookings') currentIndex = 1;
return Scaffold(
body: child,
bottomNavigationBar: NavigationBar(
selectedIndex: currentIndex,
onDestinationSelected: (i) {
if (i == 0) {
context.go('/client');
} else {
context.go('/client/bookings');
}
},
destinations: [
NavigationDestination(
icon: const Icon(Icons.search_outlined),
selectedIcon: const Icon(Icons.search),
label: l10n.browse,
),
NavigationDestination(
icon: const Icon(Icons.bookmark_outline),
selectedIcon: const Icon(Icons.bookmark),
label: l10n.myBookings,
),
],
),
);
}
}