49 lines
1.2 KiB
Dart
49 lines
1.2 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'entry_page.dart';
|
||
|
import 'message_page.dart';
|
||
|
import 'personal_page.dart';
|
||
|
import 'home_content_page.dart';
|
||
|
|
||
|
class HomePage extends StatefulWidget {
|
||
|
const HomePage({super.key});
|
||
|
|
||
|
@override
|
||
|
State<HomePage> createState() => _HomePageState();
|
||
|
}
|
||
|
|
||
|
class _HomePageState extends State<HomePage> {
|
||
|
int _currentIndex = 0;
|
||
|
|
||
|
final List<Widget> _pages = const [
|
||
|
HomeContentPage(),
|
||
|
EntryPage(),
|
||
|
MessagePage(),
|
||
|
PersonalPage(),
|
||
|
];
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
body: _pages[_currentIndex],
|
||
|
bottomNavigationBar: BottomNavigationBar(
|
||
|
type: BottomNavigationBarType.fixed,
|
||
|
currentIndex: _currentIndex,
|
||
|
onTap: (index) {
|
||
|
setState(() {
|
||
|
_currentIndex = index;
|
||
|
});
|
||
|
},
|
||
|
items: const [
|
||
|
BottomNavigationBarItem(icon: Icon(Icons.home), label: '首頁'),
|
||
|
BottomNavigationBarItem(
|
||
|
icon: Icon(Icons.door_front_door),
|
||
|
label: '出入',
|
||
|
),
|
||
|
BottomNavigationBarItem(icon: Icon(Icons.message), label: '訊息'),
|
||
|
BottomNavigationBarItem(icon: Icon(Icons.person), label: '住戶'),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|