drifter_app/lib/pages/main_screen/main_screen_widget.dart

94 lines
2.7 KiB
Dart
Raw Normal View History

// import 'package:drifter/pages/home_screen/home_screen_widget.dart';
import 'package:drifter/pages/home_screen/home_screen_widget.dart';
2023-05-18 02:16:20 +03:00
import 'package:drifter/pages/login_screen/login_screen.dart';
import 'package:drifter/pages/message_screen/message_screen_widget.dart';
import 'package:drifter/pages/profile_screen/profile_screen.dart';
import 'package:drifter/theme/app_colors.dart';
import 'package:drifter/main.dart';
import 'package:drifter/utilities/assets.dart';
2023-05-11 16:48:05 +03:00
import 'package:flutter/material.dart';
2023-05-11 19:04:30 +03:00
import 'package:flutter_svg/svg.dart';
2023-05-11 16:48:05 +03:00
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(
backgroundColor: AppColors.mainBackground,
2023-05-11 16:48:05 +03:00
appBar: AppBar(
2023-05-30 04:09:23 +03:00
leading: IconButton(
icon: Icon(Icons.settings),
color: AppColors.topNavIconPtimary,
onPressed: () {},
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.rss_feed),
color: AppColors.topNavIconPtimary,
onPressed: () {},
),
],
title: const Text(
"Drifter",
style: TextStyle(
color: AppColors.topNavText,
),
// textAlign: TextAlign.center,
2023-05-11 19:04:30 +03:00
),
2023-05-11 16:48:05 +03:00
centerTitle: true,
2023-05-30 04:09:23 +03:00
backgroundColor: AppColors.mainBackground,
elevation: 0,
2023-05-11 16:48:05 +03:00
),
body: IndexedStack(
index: _selectedTap,
children: const [
HomeScreen(),
2023-05-11 16:48:05 +03:00
MessageScreen(),
ProfileScreen(),
// LoginScreen(),
2023-05-11 16:48:05 +03:00
],
),
bottomNavigationBar: BottomNavigationBar(
2023-05-30 04:09:23 +03:00
backgroundColor: AppColors.bottomNavBackground,
selectedItemColor: AppColors.bottomNavIconActive,
unselectedItemColor: AppColors.bottomNavIconDefault,
2023-05-11 16:48:05 +03:00
currentIndex: _selectedTap,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
2023-05-11 16:48:05 +03:00
BottomNavigationBarItem(
icon: Icon(Icons.message),
label: 'Message',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
// BottomNavigationBarItem(
// icon: Icon(Icons.login),
// label: 'Login',
// ),
2023-05-11 16:48:05 +03:00
],
onTap: onSelectedtap,
),
);
}
}