Refactor loading and error handling in DesktopHomePage; improve notification click handling in service worker
This commit is contained in:
@@ -21,62 +21,67 @@ class DesktopHomePage extends StatelessWidget {
|
||||
const DesktopNavigationWidget(
|
||||
currentIndex: 0, // Home index
|
||||
),
|
||||
Expanded(
|
||||
child: Consumer<HomeViewModel>(
|
||||
builder: (context, homeViewModel, child) {
|
||||
if (homeViewModel.isLoading) {
|
||||
return const Center(
|
||||
Consumer<HomeViewModel>(
|
||||
builder: (context, homeViewModel, child) {
|
||||
if (homeViewModel.isLoading) {
|
||||
return const Expanded(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.secondary50,
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (homeViewModel.errorMessage != null) {
|
||||
return Center(child: Text(homeViewModel.errorMessage!));
|
||||
}
|
||||
if (homeViewModel.errorMessage != null) {
|
||||
return Expanded(
|
||||
child: Center(child: Text(homeViewModel.errorMessage!)),
|
||||
);
|
||||
}
|
||||
|
||||
if (homeViewModel.tenderApprovalsStateResponse != null &&
|
||||
homeViewModel.data != null &&
|
||||
homeViewModel.feedbackStats != null) {
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
width: 780,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 55),
|
||||
// SizedBox(width: 780, child: NotificationCard()),
|
||||
const SizedBox(height: 40.0),
|
||||
_progressBarsRow(homeViewModel),
|
||||
SizedBox(height: 32.0.h()),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 15.0.w(),
|
||||
if (homeViewModel.tenderApprovalsStateResponse != null &&
|
||||
homeViewModel.data != null &&
|
||||
homeViewModel.feedbackStats != null) {
|
||||
return Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: 780,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 55),
|
||||
// SizedBox(width: 780, child: NotificationCard()),
|
||||
const SizedBox(height: 40.0),
|
||||
_progressBarsRow(homeViewModel),
|
||||
SizedBox(height: 32.0.h()),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 15.0.w(),
|
||||
),
|
||||
child: _firstTenderCardsRow(
|
||||
context,
|
||||
homeViewModel,
|
||||
),
|
||||
),
|
||||
child: _firstTenderCardsRow(
|
||||
context,
|
||||
homeViewModel,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 32.0.h()),
|
||||
_yourTenderText(homeViewModel),
|
||||
SizedBox(height: 8.0.h()),
|
||||
_bottomListView(homeViewModel),
|
||||
],
|
||||
SizedBox(height: 32.0.h()),
|
||||
_yourTenderText(homeViewModel),
|
||||
SizedBox(height: 8.0.h()),
|
||||
_bottomListView(homeViewModel),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.secondary50,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
}
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user