Files
MessagingApp/lib/pages/home_page.dart
T

94 lines
2.3 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;
@override
void initState() {
super.initState();
_tabController = TabController(
length: 3,
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(
// 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: [
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,
),
),
],
),
),
body: _tabBarPages(),
);
}
Widget _tabBarPages() {
return TabBarView(
controller: _tabController,
children: [
SearchPage( deviceHeight: _deviceHeight , deviceWidth: _deviceWidth,),
RecentConverstationsPage(_deviceHeight, _deviceWidth),
ProfilePage(_deviceHeight, _deviceWidth),
],
);
}
}