import 'package:flutter/material.dart'; import 'package:dialer/pages/contact.dart'; // Import ContactPage import 'package:dialer/pages/favorites.dart'; // Import FavoritePage import 'package:dialer/pages/history.dart'; // Import HistoryPage class _MyHomePageState extends State with SingleTickerProviderStateMixin { late TabController _tabController; @override void initState() { super.initState(); // Update TabController to handle 3 tabs (Favorites, History, Contacts) _tabController = TabController(length: 3, vsync: this, initialIndex: 1); _tabController.addListener(_handleTabIndex); } @override void dispose() { _tabController.removeListener(_handleTabIndex); _tabController.dispose(); super.dispose(); } void _handleTabIndex() { setState(() {}); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: TabBarView( controller: _tabController, // Add the new ContactPage in the TabBarView children: [ FavoritePage(), // Favorites page HistoryPage(), // History page ContactPage(), // New Contacts page ], ), bottomNavigationBar: Container( color: Colors.black, child: TabBar( controller: _tabController, tabs: [ Tab(icon: Icon(_tabController.index == 0 ? Icons.star : Icons.star_border)), // Favorite tab Tab(icon: Icon(_tabController.index == 1 ? Icons.access_time_filled : Icons.access_time_outlined)), // History tab Tab(icon: Icon(_tabController.index == 2 ? Icons.contacts : Icons.contacts_outlined)), // Contact tab ], labelColor: Colors.white, unselectedLabelColor: Colors.grey, indicatorSize: TabBarIndicatorSize.label, indicatorPadding: const EdgeInsets.only(bottom: -0), // Adjust padding if needed indicatorColor: Colors.white, // White horizontal indicator line ), ), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key}); @override _MyHomePageState createState() => _MyHomePageState(); }