96 lines
2.7 KiB
Dart
96 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'home_view.dart';
|
|
import 'riwayat_view.dart';
|
|
import 'ocr_view.dart';
|
|
import 'analisis_view.dart';
|
|
import 'akun_view.dart';
|
|
|
|
class MainNavbar extends StatefulWidget {
|
|
const MainNavbar({super.key});
|
|
|
|
@override
|
|
State<MainNavbar> createState() => _MainNavbarState();
|
|
}
|
|
|
|
class _MainNavbarState extends State<MainNavbar> {
|
|
int _currentIndex = 0;
|
|
|
|
final List<Widget> _pages = const [
|
|
HomeView(),
|
|
RiwayatView(),
|
|
OCRView(),
|
|
AnalisisView(),
|
|
AkunView(),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: _pages[_currentIndex],
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
backgroundColor: Colors.white,
|
|
currentIndex: _currentIndex,
|
|
type: BottomNavigationBarType.fixed,
|
|
selectedItemColor: const Color(0xFF1565C0), // biru tua elegan
|
|
unselectedItemColor: Colors.blueGrey, // abu kebiruan
|
|
onTap: (index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
items: [
|
|
const BottomNavigationBarItem(
|
|
icon: Icon(Icons.home),
|
|
label: 'Beranda',
|
|
),
|
|
const BottomNavigationBarItem(
|
|
icon: Icon(Icons.history),
|
|
label: 'Riwayat',
|
|
),
|
|
|
|
/// OCR Item di tengah — block warna biru
|
|
BottomNavigationBarItem(
|
|
icon: Container(
|
|
padding: const EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
// buat gradient biru supaya stand out
|
|
gradient: LinearGradient(
|
|
colors: _currentIndex == 2
|
|
? [Color(0xFF1565C0), Color(0xFF42A5F5)]
|
|
: [Color(0x332196F3), Color(0x332196F3)],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
),
|
|
shape: BoxShape.circle,
|
|
boxShadow: _currentIndex == 2
|
|
? [
|
|
BoxShadow(
|
|
color: Colors.blue.withOpacity(0.3),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 3),
|
|
)
|
|
]
|
|
: [],
|
|
),
|
|
child: Icon(
|
|
Icons.camera_alt,
|
|
size: 28,
|
|
color: _currentIndex == 2 ? Colors.white : Colors.blue,
|
|
),
|
|
),
|
|
label: '',
|
|
),
|
|
|
|
const BottomNavigationBarItem(
|
|
icon: Icon(Icons.analytics),
|
|
label: 'Analisis',
|
|
),
|
|
const BottomNavigationBarItem(
|
|
icon: Icon(Icons.person),
|
|
label: 'Akun',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |