112 lines
2.5 KiB
Dart
112 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:messaging_app/pages/profile_page.dart';
|
|
import 'package:messaging_app/pages/recent_converstations_page.dart';
|
|
import 'package:messaging_app/pages/search_page.dart';
|
|
|
|
class HomePage extends StatefulWidget {
|
|
const HomePage({super.key});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() {
|
|
//
|
|
return _HomePageState();
|
|
}
|
|
}
|
|
|
|
class _HomePageState extends State<HomePage>
|
|
with SingleTickerProviderStateMixin {
|
|
//TickerProviderStateMixin
|
|
// //
|
|
late double _deviceHeight;
|
|
late double _deviceWidth;
|
|
late final TabController _tabController;
|
|
|
|
final List<Tab> _iconTabs = [
|
|
Tab(
|
|
icon: Icon(
|
|
Icons.people_outline,
|
|
size: 30,
|
|
),
|
|
),
|
|
Tab(
|
|
icon: Icon(
|
|
Icons.chat_bubble_outline,
|
|
size: 30,
|
|
),
|
|
),
|
|
Tab(
|
|
icon: Icon(
|
|
Icons.person_outline,
|
|
size: 30,
|
|
),
|
|
),
|
|
];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_tabController = TabController(
|
|
length: _iconTabs.length,
|
|
vsync: this,
|
|
initialIndex: 1,
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_tabController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
//
|
|
_deviceHeight = MediaQuery.of(context).size.height;
|
|
_deviceWidth = MediaQuery.of(context).size.width;
|
|
|
|
return Scaffold(
|
|
// backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
appBar: AppBar(
|
|
automaticallyImplyLeading: false,
|
|
// backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
title: Text("the messenger"),
|
|
titleTextStyle: TextStyle(fontSize: 16),
|
|
bottom: TabBar(
|
|
unselectedLabelColor: Colors.grey,
|
|
indicatorColor: Colors.blue,
|
|
labelColor: Colors.blue,
|
|
controller: _tabController,
|
|
tabs: _iconTabs,
|
|
),
|
|
),
|
|
body: _tabBarPages(),
|
|
// floatingActionButton: _tabController.index == 1
|
|
// ? Container()
|
|
// : FloatingActionButton(
|
|
// child: Icon(Icons.add),
|
|
// onPressed: () {},
|
|
// ),
|
|
);
|
|
}
|
|
|
|
Widget _tabBarPages() {
|
|
return TabBarView(
|
|
controller: _tabController,
|
|
children: [
|
|
SearchPage(
|
|
deviceHeight: _deviceHeight,
|
|
deviceWidth: _deviceWidth,
|
|
),
|
|
RecentConverstationsPage(
|
|
_deviceHeight,
|
|
_deviceWidth,
|
|
),
|
|
ProfilePage(
|
|
_deviceHeight,
|
|
_deviceWidth,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|