drifter_app/lib/pages/main_screen/main_screen_widget.dart

145 lines
3.8 KiB
Dart

// import 'package:drifter/pages/home_screen/home_screen_widget.dart';
import 'package:drifter/pages/home_screen/home_screen_widget.dart';
import 'package:drifter/pages/login_screen/login_screen.dart';
import 'package:drifter/pages/message_screen/message_screen_widget.dart';
import 'package:drifter/pages/notifications_screen/notifications_screen.dart';
import 'package:drifter/pages/profile_screen/profile_screen.dart';
import 'package:drifter/pages/search_screen/search_screen.dart';
import 'package:drifter/theme/app_colors.dart';
import 'package:drifter/main.dart';
import 'package:drifter/utilities/assets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class MainScreenWidget extends StatefulWidget {
const MainScreenWidget({super.key});
@override
State<MainScreenWidget> createState() => _MainScreenWidgetState();
}
class _MainScreenWidgetState extends State<MainScreenWidget> {
int _selectedTap = 2;
late String _title;
void onSelectedtap(int index) {
if (_selectedTap == index) return;
setState(() {
_selectedTap = index;
switch (index) {
case 0:
{
_title = 'Message';
}
break;
case 1:
{
_title = 'Search';
}
break;
case 2:
{
_title = 'Feed';
}
break;
case 3:
{
_title = 'Notifications';
}
break;
case 4:
{
_title = 'Profile';
}
break;
}
});
}
@override
initState() {
_title = 'Feed';
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackground,
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.settings),
color: AppColors.topNavIconPtimary,
onPressed: () {
Navigator.pushNamed(context, '/Settings');
},
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.rss_feed),
color: AppColors.topNavIconPtimary,
onPressed: () {},
),
],
title: Text(
_title,
style: TextStyle(
color: AppColors.topNavText,
),
// textAlign: TextAlign.center,
),
centerTitle: true,
backgroundColor: AppColors.mainBackground,
elevation: 0,
),
body: IndexedStack(
index: _selectedTap,
children: const [
MessageScreen(),
SearchScreen(),
HomeScreen(),
NotificationsScreen(),
ProfileScreen(),
// LoginScreen(),
],
),
bottomNavigationBar: BottomNavigationBar(
backgroundColor: AppColors.bottomNavBackground,
selectedItemColor: AppColors.bottomNavIconActive,
unselectedItemColor: AppColors.bottomNavIconDefault,
selectedFontSize: 0,
currentIndex: _selectedTap,
type: BottomNavigationBarType.fixed,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.mail_outline),
label: '',
),
BottomNavigationBarItem(
icon: Icon(Icons.search),
label: '',
),
BottomNavigationBarItem(
icon:
ImageIcon(AssetImage('assets/images/icons/drifter_vector.png')),
label: '',
),
BottomNavigationBarItem(
icon: Icon(Icons.notifications_outlined),
label: '',
),
BottomNavigationBarItem(
icon: Icon(Icons.person_2_outlined),
label: '',
),
// BottomNavigationBarItem(
// icon: Icon(Icons.login),
// label: 'Login',
// ),
],
onTap: onSelectedtap,
),
);
}
}