37 lines
953 B
Dart
37 lines
953 B
Dart
import 'package:blog_app/layout/menu.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class AppNavbar extends StatefulWidget {
|
|
final int currentPageIndex;
|
|
final Function(int) onTapNavbarItem;
|
|
|
|
const AppNavbar({
|
|
super.key,
|
|
required this.currentPageIndex,
|
|
required this.onTapNavbarItem,
|
|
});
|
|
|
|
@override
|
|
State<AppNavbar> createState() => AppNavbarState();
|
|
}
|
|
|
|
class AppNavbarState extends State<AppNavbar> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final colors = Theme.of(context).colorScheme;
|
|
|
|
return BottomNavigationBar(
|
|
currentIndex: widget.currentPageIndex,
|
|
onTap: widget.onTapNavbarItem,
|
|
items: bottomNavItems,
|
|
type: BottomNavigationBarType.fixed,
|
|
selectedItemColor: colors.primary,
|
|
unselectedItemColor: colors.onSurface.withAlpha(150),
|
|
showSelectedLabels: true,
|
|
showUnselectedLabels: true,
|
|
backgroundColor: colors.surface,
|
|
elevation: 8,
|
|
);
|
|
}
|
|
}
|