feat:增加底部标题栏
This commit is contained in:
@@ -20,3 +20,8 @@ final List<PageInfo> pages = [
|
||||
];
|
||||
|
||||
final List<Widget> pageWidgets = pages.map((item) => item.page).toList();
|
||||
|
||||
final List<BottomNavigationBarItem> bottomNavItems =
|
||||
pages.map((page) {
|
||||
return BottomNavigationBarItem(icon: Icon(page.icon), label: page.title);
|
||||
}).toList();
|
||||
|
||||
22
lib/layout/nav_bar.dart
Normal file
22
lib/layout/nav_bar.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'menu.dart';
|
||||
|
||||
Widget buildBottomNavigationBar({
|
||||
required BuildContext context,
|
||||
required int index,
|
||||
required Function(int) onTap,
|
||||
}) {
|
||||
return BottomNavigationBar(
|
||||
currentIndex: index,
|
||||
onTap: onTap,
|
||||
items: bottomNavItems,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
selectedItemColor: Theme.of(context).colorScheme.primary,
|
||||
unselectedItemColor: Colors.grey,
|
||||
showSelectedLabels: true,
|
||||
showUnselectedLabels: true,
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 8,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user