G-EIP-700-TLS-7-1-eip-steph.../lib/pages/myHomePage.dart
2024-09-16 18:07:04 +03:00

66 lines
2.0 KiB
Dart

import 'package:dialer/pages/contact.dart';
import 'package:dialer/pages/favorites.dart';
import 'package:dialer/pages/history.dart';
import 'package:flutter/material.dart';
class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin {
late TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, 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,
children: const [
FavoritePage(), // Page des favoris
HistoryPage(), // Page de l'historique
ContactPage(), // Page des contacts
],
),
bottomNavigationBar: Container(
color: Colors.black,
child: TabBar(
controller: _tabController,
tabs: [
Tab(icon: Icon(_tabController.index == 0 ? Icons.star : Icons.star_border)),
Tab(icon: Icon(_tabController.index == 1 ? Icons.access_time_filled : Icons.access_time_outlined)),
Tab(icon: Icon(_tabController.index == 2 ? Icons.contacts : Icons.contacts_outlined)),
],
labelColor: Colors.white,
unselectedLabelColor: Colors.grey,
indicatorSize: TabBarIndicatorSize.label,
indicatorPadding: const EdgeInsets.only(bottom: -0), // Ajustez le padding pour élever la ligne blanche au-dessus des icônes si nécessaire
indicatorColor: Colors.white, // Couleur de la barre horizontale blanche
),
),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
_MyHomePageState createState() => _MyHomePageState();
}