first app design
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user