Add initial project structure and configuration files
This commit is contained in:
53
lib/widgets/navbar.dart
Normal file
53
lib/widgets/navbar.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
|
||||
class ProjNavBar extends StatelessWidget {
|
||||
|
||||
|
||||
static final Map<String, int> _pageIndex = {
|
||||
"home": 0,
|
||||
"settings": 1
|
||||
};
|
||||
|
||||
late final int selectedIndex;
|
||||
|
||||
ProjNavBar({super.key, String currentPage = "home"}) {;
|
||||
selectedIndex = _pageIndex[currentPage] ?? 0;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
return NavigationBar(
|
||||
index: selectedIndex,
|
||||
onSelected: (index) {
|
||||
if (index == 0) {
|
||||
GoRouter.of(context).go("/");
|
||||
} else if (index == 1) {
|
||||
GoRouter.of(context).go("/settings");
|
||||
}
|
||||
},
|
||||
children: [
|
||||
NavigationItem(
|
||||
label: Text(
|
||||
"Home"
|
||||
),
|
||||
child: Icon(
|
||||
LucideIcons.house
|
||||
),
|
||||
),
|
||||
NavigationItem(
|
||||
label: Text(
|
||||
"Settings"
|
||||
),
|
||||
child: Icon(
|
||||
LucideIcons.settings
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user