82 lines
2.2 KiB
Dart
82 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'menu_utama.dart';
|
|
import 'riwayat.dart';
|
|
|
|
class Dashboard extends StatefulWidget {
|
|
@override
|
|
State<Dashboard> createState() => _DashboardState();
|
|
}
|
|
|
|
class _DashboardState extends State<Dashboard> {
|
|
int index = 0;
|
|
|
|
final List<Widget> pages = [
|
|
MenuUtama(),
|
|
RiwayatPage(),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFFF5F5F5),
|
|
|
|
body: Stack(
|
|
children: [
|
|
// 🔻 HALAMAN
|
|
pages[index],
|
|
|
|
// 🔥 NAVBAR FLOATING TRANSPARAN
|
|
Positioned(
|
|
bottom: 20,
|
|
left: 0,
|
|
right: 0,
|
|
child: Center(
|
|
child: Container(
|
|
margin: const EdgeInsets.symmetric(horizontal: 100),
|
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.7), // 🔥 transparan
|
|
borderRadius: BorderRadius.circular(40),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.1),
|
|
blurRadius: 10,
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
navItem(Icons.grid_view, 0),
|
|
navItem(Icons.people, 1),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
// 🔧 NAV ITEM FUNCTION
|
|
Widget navItem(IconData icon, int i) {
|
|
bool isActive = index == i;
|
|
|
|
return GestureDetector(
|
|
onTap: () => setState(() => index = i),
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
padding: const EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
color: isActive ? const Color(0xFFFFD54F) : Colors.grey.shade300,
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Icon(
|
|
icon,
|
|
color: isActive ? Colors.black : Colors.black54,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |