继续构建tabbar

This commit is contained in:
bluesea 2024-05-11 11:24:56 +08:00
parent 60232041df
commit d4b7e2446b
2 changed files with 21 additions and 5 deletions

View File

@ -6,4 +6,10 @@ class TabbarPageController extends GetxController {
void onInit(){ void onInit(){
super.onInit(); super.onInit();
} }
void onItemTapped(int index) {
}
} }

View File

@ -11,13 +11,21 @@ class TabbarPageView extends GetView {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Widget> childPageList = getPages();
final List<BottomNavigationBarItem> listBarItems = getTabarItem();
return Scaffold( return Scaffold(
appBar: AppBar( bottomNavigationBar: BottomNavigationBar(
title: const Text("Tab"), items: listBarItems,
), unselectedItemColor:Colors.grey,
body: const Center( selectedItemColor: Colors.orange,
child: Text("我是tab页面"), type: BottomNavigationBarType.fixed,
selectedFontSize: 14,
unselectedFontSize: 14,
currentIndex: 0,
), ),
body: childPageList[0],
); );
} }
@ -42,4 +50,6 @@ class TabbarPageView extends GetView {
List<Widget> getPages(){ List<Widget> getPages(){
return [HomePageView(),CollectionPageView(),DownloadPageView(),MyPageView(),]; return [HomePageView(),CollectionPageView(),DownloadPageView(),MyPageView(),];
} }
} }