@@ -10,9 +10,10 @@ import 'package:rate_master/screens/home/widgets/recommanded_list.dart';
1010import 'package:rate_master/shared/constants/constants.dart' ;
1111import 'package:rate_master/shared/theme/theme.dart' ;
1212import 'package:rate_master/shared/widgets/expanding_bottom_nav.dart' ;
13- import 'package:rate_master/shared/widgets/global_app_bar.dart' ;
1413import 'package:flutter_gen/gen_l10n/app_localizations.dart' ;
1514
15+ import 'widgets/home_app_bar.dart' ;
16+
1617class HomeScreen extends StatefulWidget {
1718 const HomeScreen ({super .key});
1819
@@ -41,11 +42,7 @@ class _HomeScreenState extends State<HomeScreen> {
4142
4243 return Scaffold (
4344 key: _scaffoldKey,
44- backgroundColor: Colors .white,
45- appBar: globalAppBar (context, () {
46- // Manual Pull-to-refresh
47- itemProvider.fetchItems ();
48- }),
45+ appBar: homeAppBar (context, null ),
4946 bottomNavigationBar: ExpandingBottomNav (items: Constants .navItems),
5047 body: SingleChildScrollView (
5148 padding: EdgeInsets .all (16 ),
@@ -62,14 +59,11 @@ class _HomeScreenState extends State<HomeScreen> {
6259 children: [
6360 TextSpan (
6461 text: "${locale .welcome } " ,
65- style: TextStyle (
66- fontSize: 16 ,
67- ),
62+ style: Theme .of (context).textTheme.bodyMedium,
6863 ),
6964 TextSpan (
7065 text: "${authProvider .user !.name }," ,
71- style: TextStyle (
72- fontSize: 18 ,
66+ style: Theme .of (context).textTheme.bodyLarge? .copyWith (
7367 fontWeight: FontWeight .bold,
7468 ),
7569 ),
@@ -83,7 +77,6 @@ class _HomeScreenState extends State<HomeScreen> {
8377 child: Container (
8478 padding: EdgeInsets .symmetric (horizontal: 16 , vertical: 12 ),
8579 decoration: BoxDecoration (
86- color: Colors .white,
8780 borderRadius: BorderRadius .circular (30 ),
8881 border: Border .all (color: AppColors .accent),
8982 ),
@@ -100,17 +93,20 @@ class _HomeScreenState extends State<HomeScreen> {
10093 ),
10194 ),
10295
103-
10496 const SizedBox (height: 16 ),
97+
10598 /// Recommanded section
10699 // Title
107100 _buildSectionTitle (context, locale.recommandedForYou),
108101 // Content
109102 SizedBox (height: 200 , child: buildRecommandedList (context)),
110103 const SizedBox (height: 16 ),
104+
111105 /// To rate section
112106 // Title
113- _buildSectionTitle (context, locale.recentlyRated),
107+ _buildSectionTitle (context, locale.recentlyRated,
108+ onViewAllPressed: () =>
109+ context.pushNamed (APP_PAGES .stats.toName)),
114110 // Content
115111 // Par exemple :
116112 SizedBox (
@@ -127,7 +123,7 @@ class _HomeScreenState extends State<HomeScreen> {
127123 Widget _buildSectionTitle (BuildContext context, String title,
128124 {VoidCallback ? onViewAllPressed}) {
129125 return Padding (
130- padding: EdgeInsets .only (left: 5 , top: 5 , right: 5 , bottom: 0 ),
126+ padding: EdgeInsets .only (left: 5 , top: 5 , right: 5 , bottom: 5 ),
131127 child: Row (
132128 mainAxisAlignment: MainAxisAlignment .spaceBetween,
133129 children: [
@@ -138,15 +134,26 @@ class _HomeScreenState extends State<HomeScreen> {
138134 fontSize: 18 ,
139135 fontWeight: FontWeight .bold),
140136 ),
141- TextButton (
142- onPressed: onViewAllPressed,
143- child: Row (children: [PhosphorIcon (PhosphorIconsRegular .caretLeft),PhosphorIcon (PhosphorIconsRegular .caretRight)],),
144- ),
137+ onViewAllPressed != null
138+ ? TextButton (
139+ onPressed: onViewAllPressed,
140+ child: Row (
141+ children: [
142+ Text (
143+ AppLocalizations .of (context)! .viewAll,
144+ style: TextStyle (color: Colors .blue),
145+ ),
146+ PhosphorIcon (
147+ PhosphorIconsRegular .arrowRight,
148+ size: 12 ,
149+ color: Colors .blue,
150+ )
151+ ],
152+ ),
153+ )
154+ : const SizedBox .shrink (),
145155 ],
146156 ),
147157 );
148158 }
149-
150-
151-
152159}
0 commit comments