|
|
@@ -2,6 +2,11 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
|
|
+import 'HomePage/presentation/home_page.dart';
|
|
|
+import 'HospitalPage/presentation/hospital_page.dart';
|
|
|
+import 'MallPage/presentation/mall_page.dart';
|
|
|
+import 'MinePage/presentation/mine_page.dart';
|
|
|
+
|
|
|
class MainTabPage extends ConsumerStatefulWidget{
|
|
|
const MainTabPage({super.key});
|
|
|
|
|
|
@@ -12,10 +17,53 @@ class MainTabPage extends ConsumerStatefulWidget{
|
|
|
|
|
|
class _MainTabPageState extends ConsumerState<MainTabPage>
|
|
|
with SingleTickerProviderStateMixin {
|
|
|
+ int _currentIndex = 0;
|
|
|
+
|
|
|
+ final List<Widget> _pages = const [
|
|
|
+ HomePage(),
|
|
|
+ HospitalPage(),
|
|
|
+ MallPage(),
|
|
|
+ MinePage(),
|
|
|
+ ];
|
|
|
+
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- // TODO: implement build
|
|
|
- throw UnimplementedError();
|
|
|
+ return Scaffold(
|
|
|
+ body: IndexedStack(
|
|
|
+ index: _currentIndex,
|
|
|
+ children: _pages,
|
|
|
+ ),
|
|
|
+ bottomNavigationBar: BottomNavigationBar(
|
|
|
+ currentIndex: _currentIndex,
|
|
|
+ type: BottomNavigationBarType.fixed,
|
|
|
+ onTap: (index) {
|
|
|
+ setState(() {
|
|
|
+ _currentIndex = index;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ items: const [
|
|
|
+ BottomNavigationBarItem(
|
|
|
+ icon: Icon(Icons.home_outlined),
|
|
|
+ activeIcon: Icon(Icons.home),
|
|
|
+ label: '首页',
|
|
|
+ ),
|
|
|
+ BottomNavigationBarItem(
|
|
|
+ icon: Icon(Icons.local_hospital_outlined),
|
|
|
+ activeIcon: Icon(Icons.local_hospital),
|
|
|
+ label: '医院',
|
|
|
+ ),
|
|
|
+ BottomNavigationBarItem(
|
|
|
+ icon: Icon(Icons.shopping_cart_outlined),
|
|
|
+ activeIcon: Icon(Icons.shopping_cart),
|
|
|
+ label: '商城',
|
|
|
+ ),
|
|
|
+ BottomNavigationBarItem(
|
|
|
+ icon: Icon(Icons.person_outlined),
|
|
|
+ activeIcon: Icon(Icons.person),
|
|
|
+ label: '我的',
|
|
|
+ ),
|
|
|
+ ]
|
|
|
+ ),
|
|
|
+ );
|
|
|
}
|
|
|
-
|
|
|
}
|