59 lines
1.3 KiB
Dart
59 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'home_page.dart';
|
|
import 'rfid_manager_page.dart';
|
|
import 'account_page.dart'; // 🔥 halaman baru
|
|
|
|
class MainPage extends StatefulWidget {
|
|
const MainPage({super.key});
|
|
|
|
@override
|
|
State<MainPage> createState() => _MainPageState();
|
|
}
|
|
|
|
class _MainPageState extends State<MainPage> {
|
|
|
|
int currentIndex = 0;
|
|
final PageController controller = PageController();
|
|
|
|
final pages = const [
|
|
HomePage(),
|
|
RFIDManagerPage(),
|
|
AccountPage(), // 🔥 ganti riwayat
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: PageView(
|
|
controller: controller,
|
|
onPageChanged: (index) {
|
|
setState(() {
|
|
currentIndex = index;
|
|
});
|
|
},
|
|
children: pages,
|
|
),
|
|
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: currentIndex,
|
|
onTap: (index) {
|
|
controller.jumpToPage(index);
|
|
},
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.home),
|
|
label: "Home",
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.credit_card),
|
|
label: "Kartu",
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.person), // 🔥 icon akun
|
|
label: "Akun",
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |