From 409073607182457edff969e8dbfed7da33944b5c Mon Sep 17 00:00:00 2001 From: Jeremiah Ekanem Date: Fri, 23 Aug 2024 03:44:57 +0100 Subject: [PATCH] Update --- lib/core/router/app_router.dart | 10 ++++++ .../books/containers/books_by_category.dart | 31 +++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/lib/core/router/app_router.dart b/lib/core/router/app_router.dart index f957c38..ac4d798 100644 --- a/lib/core/router/app_router.dart +++ b/lib/core/router/app_router.dart @@ -72,6 +72,16 @@ final GoRouter appRouter = GoRouter( name: RoutePath.homeScreen, path: "/home", builder: (context, state) => const HomeScreen(), + redirect: (context, state) async { + debugPrint('In redirect ====>'); + final isAuth = await isAuthenticated(); + debugPrint('Redirect Auth State ====> $isAuth'); + if (!isAuth) { + return '/'; + } else { + return '/home'; + } + }, ), GoRoute( diff --git a/lib/ui/screens/books/containers/books_by_category.dart b/lib/ui/screens/books/containers/books_by_category.dart index e46c9d3..0ace91b 100644 --- a/lib/ui/screens/books/containers/books_by_category.dart +++ b/lib/ui/screens/books/containers/books_by_category.dart @@ -14,6 +14,31 @@ class _BooksByCategoryState extends State { int _currentPage = 1; final int _totalPages = 5; + final List imgList = [ + AppImages.article, + AppImages.book2, + AppImages.book3, + AppImages.book4, + AppImages.book5, + ]; + + final List bookTitle = [ + 'Falling for my boyfriend\'s dad', + 'Tangled destinies', + 'Morgana', + 'Haunted Desire', + 'Princess Heaven', + ]; + + final List author = [ + 'Sarah John', + 'Xenia Litpad', + 'Dark Xenia', + 'DarkXenia', + 'Alexandra Dell', + ]; + + void _handlePageChanged(int newPage) { setState(() { _currentPage = newPage; @@ -44,11 +69,13 @@ class _BooksByCategoryState extends State { Wrap( spacing: (20), runSpacing: (40), - children: List.generate(6, (index) { + children: List.generate(imgList.length, (index) { return SizedBox( width: (420), child: BookCard( - imgWidth: 174, + image: imgList[index], + bookTitle: bookTitle[index], +authorName: author[index], imgWidth: 174, imgheight: 225, onImageTap: () { context