drifter_app/lib/pages/main_screen/main_screen_widget.dart

82 lines
2.1 KiB
Dart

// import 'package:drifter/pages/home_screen/home_screen_widget.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/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(
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(),
],
),
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',
),
],
onTap: onSelectedtap,
),
);
}
}