From e2a1ee7f5887d1ebdcf65e57803af9e1ac439b72 Mon Sep 17 00:00:00 2001 From: Faiz Hashmi Date: Sun, 3 Nov 2024 14:21:00 +0300 Subject: [PATCH] Issues Fixed --- lib/views/branches/favourite_list_view.dart | 77 +++++++++++---------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/lib/views/branches/favourite_list_view.dart b/lib/views/branches/favourite_list_view.dart index 3329ef9..7425eb0 100644 --- a/lib/views/branches/favourite_list_view.dart +++ b/lib/views/branches/favourite_list_view.dart @@ -41,43 +41,48 @@ class _FavoriteListViewState extends State { title: LocaleKeys.favoriteList.tr(), isRemoveBackButton: false, ), - body: SizedBox( - width: double.infinity, - height: double.infinity, - child: Column( - children: [ - Expanded( - child: Container( - width: double.infinity, - child: appointmentsVM.state == ViewState.busy - ? const Center(child: CircularProgressIndicator()) - : appointmentsVM.myFavProvidersList.isEmpty - ? Center( - child: (LocaleKeys.noProvidersInFav.tr()).toText( - fontSize: 16, - color: MyColors.lightTextColor, + body: RefreshIndicator( + onRefresh: () async { + await context.read().getMyFavoriteProviders(); + }, + child: SizedBox( + width: double.infinity, + height: double.infinity, + child: Column( + children: [ + Expanded( + child: Container( + width: double.infinity, + child: appointmentsVM.state == ViewState.busy + ? const Center(child: CircularProgressIndicator()) + : appointmentsVM.myFavProvidersList.isEmpty + ? Center( + child: (LocaleKeys.noProvidersInFav.tr()).toText( + fontSize: 16, + color: MyColors.lightTextColor, + ), + ) + : ListView.separated( + itemCount: appointmentsVM.myFavProvidersList.length, + itemBuilder: (context, index) { + ProviderProfileModel providerProfileModel = appointmentsVM.myFavProvidersList[index]; + return ProviderDetailCard( + onCardTapped: () => navigateWithName(context, AppRoutes.providerProfileView, arguments: providerProfileModel.providerID), + providerImageUrl: MyAssets.bnCar, + title: providerProfileModel.name ?? "", + description: providerProfileModel.companyDescription ?? "", + startedSince: DateHelper.formatAsMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(providerProfileModel.memberSince ?? ""))), + branches: providerProfileModel.serviceProviderBranch ?? [], + totalBranches: (providerProfileModel.noOfBranches ?? 0).toString(), + ); + }, + separatorBuilder: (context, index) => 12.height, + padding: const EdgeInsets.all(12), ), - ) - : ListView.separated( - itemCount: appointmentsVM.myFavProvidersList.length, - itemBuilder: (context, index) { - ProviderProfileModel providerProfileModel = appointmentsVM.myFavProvidersList[index]; - return ProviderDetailCard( - onCardTapped: () => navigateWithName(context, AppRoutes.providerProfileView, arguments: providerProfileModel.providerID), - providerImageUrl: MyAssets.bnCar, - title: providerProfileModel.name ?? "", - description: providerProfileModel.companyDescription ?? "", - startedSince: DateHelper.formatAsMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(providerProfileModel.memberSince ?? ""))), - branches: providerProfileModel.serviceProviderBranch ?? [], - totalBranches: (providerProfileModel.noOfBranches ?? 0).toString(), - ); - }, - separatorBuilder: (context, index) => 12.height, - padding: const EdgeInsets.all(12), - ), - ).paddingOnly(left: 10, right: 10), - ), - ], + ).paddingOnly(left: 10, right: 10), + ), + ], + ), ), ), );