fixed update tender intenders after in details updated and web issues inmobile and tablet

This commit is contained in:
amirrezaghabeli
2025-08-30 09:16:21 +03:30
parent f4d5d16959
commit f868dc7659
6 changed files with 150 additions and 116 deletions
+90 -78
View File
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
@@ -79,91 +80,102 @@ class _TenderDetailTabletPageState extends State<TenderDetailTabletPage> {
@override
Widget build(BuildContext context) {
final GlobalKey<ScaffoldState> key = GlobalKey();
return Scaffold(
key: key,
backgroundColor: AppColors.backgroundColor,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(64),
child: AppBar(
backgroundColor: AppColors.backgroundColor,
elevation: 0,
titleSpacing: 0,
leading: Padding(
padding: EdgeInsetsDirectional.only(start: 24.0.w()),
child: SvgPicture.asset(AssetsManager.logoSmall),
),
actions: [
IconButton(
icon: Padding(
padding: EdgeInsetsDirectional.only(end: 24.0.w()),
child: SvgPicture.asset(
AssetsManager.menu,
height: 32.0.w(),
width: 32.0.w(),
),
),
onPressed: () => key.currentState!.openDrawer(),
),
],
),
),
drawer: TabletNavigationWidget(
currentIndex: 1, // Home is index 0
onTabChanged: (index) {
// Handle navigation to other tabs
switch (index) {
case 0:
Router.neglect(context, () => context.go('/home'));
context.read<HomeViewModel>().init();
break;
case 1:
break;
case 2:
// Navigate to profile
context.pop();
Router.neglect(context, () => context.go('/profile'));
break;
}
},
),
body: Consumer<TenderDetailViewModel>(
builder: (context, tenderViewModel, child) {
if (tenderViewModel.isLoading) {
return const Center(
child: CircularProgressIndicator(color: AppColors.secondary50),
return PopScope(
onPopInvokedWithResult: (didPop, result) {
if (kIsWeb) {
WidgetsBinding.instance.addPostFrameCallback((_) {
context.read<TenderDetailViewModel>().updateTenderApprovals(
widget.tenderId,
);
}
});
}
},
key: key,
child: Scaffold(
backgroundColor: AppColors.backgroundColor,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(64),
child: AppBar(
backgroundColor: AppColors.backgroundColor,
elevation: 0,
titleSpacing: 0,
leading: Padding(
padding: EdgeInsetsDirectional.only(start: 24.0.w()),
child: SvgPicture.asset(AssetsManager.logoSmall),
),
actions: [
IconButton(
icon: Padding(
padding: EdgeInsetsDirectional.only(end: 24.0.w()),
child: SvgPicture.asset(
AssetsManager.menu,
height: 32.0.w(),
width: 32.0.w(),
),
),
onPressed: () => key.currentState!.openDrawer(),
),
],
),
),
drawer: TabletNavigationWidget(
currentIndex: 1, // Home is index 0
onTabChanged: (index) {
// Handle navigation to other tabs
switch (index) {
case 0:
Router.neglect(context, () => context.go('/home'));
context.read<HomeViewModel>().init();
break;
case 1:
break;
case 2:
// Navigate to profile
context.pop();
Router.neglect(context, () => context.go('/profile'));
break;
}
},
),
body: Consumer<TenderDetailViewModel>(
builder: (context, tenderViewModel, child) {
if (tenderViewModel.isLoading) {
return const Center(
child: CircularProgressIndicator(color: AppColors.secondary50),
);
}
if (tenderViewModel.errorMessage != null) {
return Center(child: Text(tenderViewModel.errorMessage!));
}
if (tenderViewModel.errorMessage != null) {
return Center(child: Text(tenderViewModel.errorMessage!));
}
final detail = tenderViewModel.tenderDetail;
if (detail == null) {
return const Center(child: Text(AppStrings.tenderNoData));
}
return SingleChildScrollView(
child: Center(
child: SizedBox(
width: 768,
final detail = tenderViewModel.tenderDetail;
if (detail == null) {
return const Center(child: Text(AppStrings.tenderNoData));
}
return SingleChildScrollView(
child: Center(
child: SizedBox(
width: 768,
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TenderDetailHeader(isScreenBig: true, detail: detail),
SizedBox(height: 28.0.h()),
TenderDetailCard(detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailActions(isScreenBig: true, detail: detail),
],
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TenderDetailHeader(isScreenBig: true, detail: detail),
SizedBox(height: 28.0.h()),
TenderDetailCard(detail: detail),
SizedBox(height: 24.0.h()),
TenderDetailActions(isScreenBig: true, detail: detail),
],
),
),
),
),
),
);
},
);
},
),
),
);
}