MIF_E31231623/android/wisata_app/lib/screens/beranda_screen.dart

53 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'home_screen.dart';
class BerandaScreen extends StatefulWidget {
const BerandaScreen({super.key});
static const routeName = '/beranda';
@override
State<BerandaScreen> createState() => _BerandaScreenState();
}
class _BerandaScreenState extends State<BerandaScreen> {
int _selectedIndex = 0;
final List<Widget> _pages = [
const HomeScreen(),
const Center(
child: Text('Profil Page'),
),
];
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _pages[_selectedIndex],
bottomNavigationBar: NavigationBar(
selectedIndex: _selectedIndex,
onDestinationSelected: _onItemTapped,
destinations: const [
NavigationDestination(
icon: Icon(Icons.home_outlined),
selectedIcon: Icon(Icons.home),
label: 'Beranda',
),
NavigationDestination(
icon: Icon(Icons.person_outline),
selectedIcon: Icon(Icons.person),
label: 'Profil',
),
],
),
);
}
}