Siopas Inventory PETI for ISTW Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

112 lines
3.4 KiB

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../providers/auth_provider.dart';
import 'home_page.dart';
import 'peminjaman_stock_page.dart';
import 'setting_page.dart';
class MainPage extends StatefulWidget {
@override
State<MainPage> createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
int currentIndex = 0;
@override
Widget build(BuildContext context) {
AuthProvider authProvider = Provider.of<AuthProvider>(context);
Widget customBottomNav() {
return ClipRRect(
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(20.0),
// topRight: Radius.circular(20.0),
// ),
child: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: currentIndex,
selectedItemColor: Colors.indigoAccent, // Warna saat dipilih
onTap: (index) {
setState(() {
currentIndex = index;
});
},
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Beranda',
),
// BottomNavigationBarItem(
// icon: Icon(Icons.assignment_return),
// label: 'Return',
// ),
// BottomNavigationBarItem(
// icon: GestureDetector(
// onTap: () {
// setState(() {
// currentIndex = 2;
// });
// },
// child: Container(
// width: 60.0,
// height: 60.0,
// decoration: BoxDecoration(
// color: Colors.indigoAccent,
// shape: BoxShape.circle,
// ),
// child: Center(
// child: Icon(Icons.qr_code, size: 30.0, color: Colors.white),
// ),
// ),
// ),
// label: '', // Menghilangkan teks label
// ),
// BottomNavigationBarItem(
// icon: Icon(Icons.markunread_mailbox),
// label: 'Receive',
// ),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Pengaturan',
),
],
),
);
}
Widget body() {
switch (currentIndex) {
case 0:
return HomePage();
case 1:
// Return your MapsPage here
return SettingPage(); // Ganti dengan MapsPage
// case 2:
// // Add your QR Code page here
// return Placeholder(); // Ganti dengan halaman QR Code
// case 3:
// // Return your HistoryPage here
// return Placeholder(); // Ganti dengan HistoryPage
// case 4:
// // Return your ProfilePage here
// return SettingPage(); // Ganti dengan ProfilePage
default:
return Container(); // Add more cases if needed
}
}
return Scaffold(
backgroundColor: currentIndex == 0
? Color.fromRGBO(255, 255, 255, 0.973)
: Colors.grey,
bottomNavigationBar: customBottomNav(),
body: Stack(
children: [
body(),
],
),
// extendBody: true, // Membuat latar belakang menembus hingga ke bawah
);
}
}