117 lines
2.8 KiB
Dart
117 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'admin_home_screen.dart';
|
|
import 'akun_screen.dart';
|
|
|
|
class AdminDashboardScreen extends StatefulWidget {
|
|
const AdminDashboardScreen({super.key});
|
|
|
|
@override
|
|
State<AdminDashboardScreen> createState() =>
|
|
_AdminDashboardScreenState();
|
|
}
|
|
|
|
class _AdminDashboardScreenState
|
|
extends State<AdminDashboardScreen> {
|
|
int _selectedIndex = 0;
|
|
|
|
final List<Widget> _screens = const [
|
|
AdminHomeScreen(),
|
|
AkunScreen(),
|
|
];
|
|
|
|
void _onItemTapped(int index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
}
|
|
|
|
Widget _buildNavItem({
|
|
required IconData icon,
|
|
required String label,
|
|
required int index,
|
|
}) {
|
|
final bool isActive =
|
|
_selectedIndex == index;
|
|
|
|
return InkWell(
|
|
onTap: () => _onItemTapped(index),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(
|
|
icon,
|
|
size: 22,
|
|
color: isActive
|
|
? const Color(0xFF0F2D13)
|
|
: Colors.black54,
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
label,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: isActive
|
|
? FontWeight.w600
|
|
: FontWeight.w400,
|
|
color: isActive
|
|
? const Color(0xFF0F2D13)
|
|
: Colors.black54,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Color.fromARGB(255, 11, 22, 0),
|
|
body: _screens[_selectedIndex],
|
|
|
|
// ❌ TIDAK ADA FLOATING BUTTON
|
|
|
|
bottomNavigationBar: Container(
|
|
decoration: const BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black26,
|
|
blurRadius: 10,
|
|
offset: Offset(0, -3),
|
|
),
|
|
],
|
|
),
|
|
child: ClipRRect(
|
|
borderRadius:
|
|
const BorderRadius.only(
|
|
topLeft: Radius.circular(30),
|
|
topRight: Radius.circular(30),
|
|
),
|
|
child: BottomAppBar(
|
|
color:
|
|
const Color.fromARGB(255, 223, 242, 112),
|
|
child: SizedBox(
|
|
height: 70,
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceAround,
|
|
children: [
|
|
_buildNavItem(
|
|
icon: Icons.home_outlined,
|
|
label: "Home",
|
|
index: 0,
|
|
),
|
|
_buildNavItem(
|
|
icon: Icons.person_outline,
|
|
label: "Akun",
|
|
index: 1,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |