Files
MessagingApp/lib/pages/home_page.dart
T
onasanya.lanre 1ba9e981e1 Messaging
Implemented Chat Screens, Profile Pages, Search Pages
WIP: User profile, new chat button
Intended: Groups, Calls, Voice Messages
Properly deleting chats, offline storage of messages
2025-03-26 13:41:56 +00:00

111 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,
),
],
);
}
}