feat:增加主题色模块
This commit is contained in:
37
lib/layout/app_navbar.dart
Normal file
37
lib/layout/app_navbar.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'menu.dart';
|
||||
|
||||
class AppNavbar extends StatefulWidget {
|
||||
final int currentPageIndex;
|
||||
final Function(int) onTapNavbarItem;
|
||||
|
||||
const AppNavbar({
|
||||
super.key,
|
||||
required this.currentPageIndex,
|
||||
required this.onTapNavbarItem,
|
||||
});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> 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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user