69 lines
1.9 KiB
Dart
69 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:ta_running/screens/start_activity_screen.dart';
|
|
import 'home_screen.dart';
|
|
import 'profile_screen.dart';
|
|
|
|
class MainScreen extends StatefulWidget {
|
|
const MainScreen({super.key});
|
|
|
|
@override
|
|
State<MainScreen> createState() => _MainScreenState();
|
|
}
|
|
|
|
class _MainScreenState extends State<MainScreen> {
|
|
int _selectedIndex = 0;
|
|
|
|
final List<Widget> _screens = [
|
|
const HomeScreen(),
|
|
const StartActivityScreen(),
|
|
const ProfileScreen(),
|
|
];
|
|
|
|
void _onTabTapped(int index) {
|
|
setState(() => _selectedIndex = index);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: _screens[_selectedIndex],
|
|
bottomNavigationBar: Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.2), // Warna bayangan hitam dengan transparansi
|
|
blurRadius: 10, // Ukuran blur bayangan
|
|
offset: Offset(0, -4), // Posisi bayangan
|
|
),
|
|
],
|
|
),
|
|
child: BottomNavigationBar(
|
|
currentIndex: _selectedIndex,
|
|
onTap: _onTabTapped,
|
|
showSelectedLabels: true, // label tampil saat aktif
|
|
showUnselectedLabels: false, // label disembunyikan saat tidak aktif
|
|
selectedItemColor: Colors.blueAccent,
|
|
unselectedItemColor: Colors.grey,
|
|
backgroundColor: Colors.white,
|
|
type: BottomNavigationBarType.fixed,
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.home),
|
|
label: 'Home',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.play_arrow),
|
|
label: 'Start',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.person),
|
|
label: 'Profile',
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|