drifter_app/lib/pages/main_screen/main_screen_widget.dart

91 lines
2.5 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/profile_screen/profile_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 = 0;
void onSelectedtap(int index) {
if (_selectedTap == index) return;
setState(() {
_selectedTap = index;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackground,
appBar: AppBar(
title: Row(
// mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
Assets.svg.drifterIcon,
height: 30,
width: 30,
alignment: Alignment.centerLeft,
),
const SizedBox(
width: 125,
),
const Text(
"Drifter",
style: TextStyle(
color: AppColors.mainAccent,
),
// textAlign: TextAlign.center,
),
],
),
centerTitle: true,
),
body: IndexedStack(
index: _selectedTap,
children: const [
HomeScreen(),
MessageScreen(),
ProfileScreen(),
// LoginScreen(),
],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _selectedTap,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.message),
label: 'Message',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
// BottomNavigationBarItem(
// icon: Icon(Icons.login),
// label: 'Login',
// ),
],
onTap: onSelectedtap,
),
);
}
}