59 lines
1.5 KiB
Dart
59 lines
1.5 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:drifter/widgets/home_screen/home_screen_widget.dart';
|
||
|
import 'package:drifter/widgets/message_screen/message_screen_widget.dart';
|
||
|
import 'package:drifter/widgets/profile_screen/profile_screen.dart';
|
||
|
|
||
|
class MainScreenWidget extends StatefulWidget {
|
||
|
const MainScreenWidget({super.key});
|
||
|
|
||
|
@override
|
||
|
State<MainScreenWidget> createState() => _MainScreenWidgetState();
|
||
|
}
|
||
|
|
||
|
class _MainScreenWidgetState extends State<MainScreenWidget> {
|
||
|
int _selectedTap = 0;
|
||
|
|
||
|
void onSelectedtap(int index) {
|
||
|
if (_selectedTap == index) return;
|
||
|
setState(() {
|
||
|
_selectedTap = index;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
|
title: Text('Drifter'),
|
||
|
centerTitle: true,
|
||
|
),
|
||
|
body: IndexedStack(
|
||
|
index: _selectedTap,
|
||
|
children: [
|
||
|
HomeScreen(),
|
||
|
// MessageScreen(),
|
||
|
ProfileScreen(),
|
||
|
],
|
||
|
),
|
||
|
bottomNavigationBar: BottomNavigationBar(
|
||
|
currentIndex: _selectedTap,
|
||
|
items: [
|
||
|
BottomNavigationBarItem(
|
||
|
icon: Icon(Icons.home),
|
||
|
label: 'Home',
|
||
|
),
|
||
|
// BottomNavigationBarItem(
|
||
|
// icon: Icon(Icons.message),
|
||
|
// label: 'Message',
|
||
|
// ),
|
||
|
BottomNavigationBarItem(
|
||
|
icon: Icon(Icons.person),
|
||
|
label: 'Profile',
|
||
|
),
|
||
|
],
|
||
|
onTap: onSelectedtap,
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|