first commit
This commit is contained in:
commit
faf67cc6d8
148 changed files with 6580 additions and 0 deletions
48
lib/ui/core/ui/navigation_bar.dart
Normal file
48
lib/ui/core/ui/navigation_bar.dart
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
class AppNavigationBar extends StatefulWidget {
|
||||
const AppNavigationBar({super.key, required this.startIndex});
|
||||
|
||||
final int startIndex;
|
||||
|
||||
@override
|
||||
State<AppNavigationBar> createState() => _AppNavigationBarState();
|
||||
}
|
||||
|
||||
class _AppNavigationBarState extends State<AppNavigationBar> {
|
||||
final Logger _log = Logger("chose");
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var selectedIndex = widget.startIndex;
|
||||
_log.info("We at $selectedIndex");
|
||||
return NavigationBar(
|
||||
destinations: [
|
||||
NavigationDestination(icon: Icon(Icons.home), label: "Home"),
|
||||
NavigationDestination(icon: Icon(Icons.add), label: "Ajout"),
|
||||
NavigationDestination(icon: Icon(Icons.remove), label: "Vente"),
|
||||
],
|
||||
selectedIndex: selectedIndex,
|
||||
onDestinationSelected: (index) {
|
||||
setState(() {
|
||||
selectedIndex = index;
|
||||
});
|
||||
switch (index) {
|
||||
case 0:
|
||||
context.go('/');
|
||||
break;
|
||||
case 1:
|
||||
context.go('/add');
|
||||
break;
|
||||
case 2:
|
||||
context.go('/sell');
|
||||
break;
|
||||
default:
|
||||
context.go("/");
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in a new issue