improvements

design_3.0_asset_delivery_module
Sikander Saleem 2 months ago
parent 9f670d4a0b
commit ab6b143763

@ -29,11 +29,9 @@ extension BuildContextExtension on BuildContext {
return isTablet; return isTablet;
} }
void showConfirmDialog(String message, {String? title, VoidCallback? onTap, String? okTitle}) => showDialog( void showConfirmDialog(String message, {String? title, VoidCallback? onTap, String? okTitle}) => showDialog(
context: this, context: this,
builder: (BuildContext cxt) => ConfirmDialog(message: message, onTap: onTap, title: title,okTitle: okTitle), builder: (BuildContext cxt) => ConfirmDialog(message: message, onTap: onTap, title: title, okTitle: okTitle),
); );
Future showBottomSheet(Widget childWidget, {bool? isDismissible, String? title}) => showModalBottomSheet( Future showBottomSheet(Widget childWidget, {bool? isDismissible, String? title}) => showModalBottomSheet(

@ -74,8 +74,10 @@ class _AssetDeliveryPageState extends State<AssetDeliveryPage> {
if (dataModel == null) { if (dataModel == null) {
return const NoDataFound().center; return const NoDataFound().center;
} }
return ListView( return SingleChildScrollView(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
requestDetailCard(context), requestDetailCard(context),
const Divider().defaultStyle(context), const Divider().defaultStyle(context),
@ -123,11 +125,7 @@ class _AssetDeliveryPageState extends State<AssetDeliveryPage> {
8.height, 8.height,
assetDeliveryTableList(context: context, assetDeliveryProvider: provider), assetDeliveryTableList(context: context, assetDeliveryProvider: provider),
], ],
).toShadowContainer( ).toShadowContainer(context, borderRadius: 20),
context,
borderRadius: 20,
padding: 0,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
); );
}, },
), ),

@ -78,6 +78,7 @@ class _AssetDeliveryAttachmentViewState extends State<AssetDeliveryAttachmentVie
attachment: _attachments, attachment: _attachments,
buttonColor: AppColor.primary10, buttonColor: AppColor.primary10,
onlyImages: false, onlyImages: false,
showAsListView: true,
// showAsGrid: true, // showAsGrid: true,
buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10), buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10),
onChange: (attachment) {}, onChange: (attachment) {},
@ -103,11 +104,11 @@ class _AssetDeliveryAttachmentViewState extends State<AssetDeliveryAttachmentVie
attachement.add(GenericAttachmentModel(id: item.id ?? 0, name: fileName)); attachement.add(GenericAttachmentModel(id: item.id ?? 0, name: fileName));
} }
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
Map<String,dynamic> payLoad ={ Map<String, dynamic> payLoad = {
'assetDeliveryExternalDeliveryId': widget.tableItemId, 'assetDeliveryExternalDeliveryId': widget.tableItemId,
'attachments':attachement, 'attachments': attachement,
}; };
await assetDeliveryProvider.saveAttachment(payload:payLoad).then((status) async { await assetDeliveryProvider.saveAttachment(payload: payLoad).then((status) async {
Navigator.pop(context); Navigator.pop(context);
if (status) { if (status) {
///Need to verify need to stay on this page and refresh or go back.. ///Need to verify need to stay on this page and refresh or go back..

@ -1,5 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart'; import 'package:test_sa/extensions/string_extensions.dart';
@ -21,7 +19,7 @@ class AssetDeliveryBottomSheet {
); );
} }
static Future changeStatusBottomSheet({required BuildContext context,required VoidCallback cancelStatusTap,required VoidCallback statusChangeTap}) { static Future changeStatusBottomSheet({required BuildContext context, required VoidCallback cancelStatusTap, required VoidCallback statusChangeTap}) {
return buildBottomSheetParent( return buildBottomSheetParent(
context: context, context: context,
childWidget: Column( childWidget: Column(
@ -31,14 +29,17 @@ class AssetDeliveryBottomSheet {
8.height, 8.height,
Align( Align(
alignment: AlignmentDirectional.centerStart, alignment: AlignmentDirectional.centerStart,
child: Text('Change Status'.addTranslation,style: TextStyle( child: Text(
'Change Status'.addTranslation,
style: TextStyle(
fontSize: 21.toScreenWidth, fontSize: 21.toScreenWidth,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal, fontStyle: FontStyle.normal,
decoration: TextDecoration.none, decoration: TextDecoration.none,
),),
), ),
10.height, ),
),
16.height,
Row( Row(
children: [ children: [
AppFilledButton( AppFilledButton(
@ -50,13 +51,15 @@ class AssetDeliveryBottomSheet {
showBorder: true, showBorder: true,
onPressed: () async { onPressed: () async {
cancelStatusTap(); cancelStatusTap();
}, },
).expanded, ).expanded,
12.width, 12.width,
AppFilledButton(buttonColor: AppColor.green70, label: 'Change Status'.addTranslation, maxWidth: true, onPressed: () { AppFilledButton(
buttonColor: AppColor.green70,
label: 'Change Status'.addTranslation,
maxWidth: true,
onPressed: () {
statusChangeTap(); statusChangeTap();
}).expanded, }).expanded,
], ],
), ),

@ -1,4 +1,3 @@
import 'dart:developer'; import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -103,24 +102,23 @@ class _CostCenterFormViewState extends State<CostCenterFormView> {
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: DefaultAppBar( appBar: DefaultAppBar(
title: 'Cost Center for Item'.addTranslation, title: 'Cost Center for Item'.addTranslation,
onBackPress: () { // onBackPress: () {
Navigator.pop(context); // Navigator.pop(context);
}, // },
), ),
body: Consumer<AssetDeliveryProvider>(builder: (context, provider, child) { body: Consumer<AssetDeliveryProvider>(builder: (context, provider, child) {
return Column( return provider.isLoading
? const CircularProgressIndicator(color: AppColor.primary10).center
: Column(
children: [ children: [
itemDetails(context: context, itemNo: widget.itemNo, itemDescription: widget.itemDescription), itemDetails(context: context, itemNo: widget.itemNo, itemDescription: widget.itemDescription),
provider.isLoading ListView.builder(
? const CircularProgressIndicator(color: AppColor.primary10).center
: ListView.builder(
itemCount: _list.length + 1, itemCount: _list.length + 1,
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.all(widget.cardPadding ?? 16), padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 8),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index == _list.length) { if (index == _list.length) {
return Visibility( return AppFilledButton(
child: AppFilledButton(
label: "Add Cost Center".addTranslation, label: "Add Cost Center".addTranslation,
maxWidth: true, maxWidth: true,
textColor: AppColor.textColor(context), textColor: AppColor.textColor(context),
@ -128,7 +126,6 @@ class _CostCenterFormViewState extends State<CostCenterFormView> {
icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)), icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)),
showIcon: true, showIcon: true,
onPressed: _addNewEntry, onPressed: _addNewEntry,
),
); );
} }
return CostCenterItemCard( return CostCenterItemCard(
@ -142,7 +139,6 @@ class _CostCenterFormViewState extends State<CostCenterFormView> {
); );
}, },
).expanded, ).expanded,
8.height,
FooterActionButton.footerContainer( FooterActionButton.footerContainer(
context: context, context: context,
child: AppFilledButton( child: AppFilledButton(
@ -172,6 +168,7 @@ class _CostCenterFormViewState extends State<CostCenterFormView> {
Widget itemDetails({required BuildContext context, String? itemNo, String? itemDescription}) { Widget itemDetails({required BuildContext context, String? itemNo, String? itemDescription}) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
'Item No'.addTranslation, 'Item No'.addTranslation,
@ -197,7 +194,8 @@ Widget itemDetails({required BuildContext context, String? itemNo, String? itemD
context, context,
borderRadius: 20, borderRadius: 20,
padding: 12, padding: 12,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), showShadow: false,
margin: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8),
); );
} }
@ -293,6 +291,6 @@ class CostCenterItemCard extends StatelessWidget {
], ],
) )
], ],
).toShadowContainer(context, paddingObject: const EdgeInsets.symmetric(horizontal: 16, vertical: 12)).paddingOnly(bottom: 12); ).toShadowContainer(context, paddingObject: const EdgeInsets.symmetric(horizontal: 12, vertical: 12)).paddingOnly(bottom: 12);
} }
} }

@ -124,17 +124,14 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
], ],
).toShadowContainer(context, borderRadius: 20, padding: 12)) ).toShadowContainer(context, borderRadius: 20, padding: 12))
.expanded, .expanded,
if (!viewOnly) ...[
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(buttonColor: AppColor.primary10, label: 'Attachments'.addTranslation, maxWidth: true, onPressed: _attachmentTap),
),
8.height,
],
FooterActionButton.footerContainer( FooterActionButton.footerContainer(
context: context, context: context,
child: !viewOnly child: !viewOnly
? Row( ? Column(
children: [
AppFilledButton(buttonColor: AppColor.primary10, label: 'Attachments'.addTranslation, maxWidth: true, onPressed: _attachmentTap),
16.height,
Row(
children: [ children: [
AppFilledButton( AppFilledButton(
label: 'Cancel'.addTranslation, label: 'Cancel'.addTranslation,
@ -148,6 +145,8 @@ class _DeliveryInspectionFormViewState extends State<DeliveryInspectionFormView>
12.width, 12.width,
AppFilledButton(buttonColor: AppColor.green70, label: 'Change Status'.addTranslation, maxWidth: true, onPressed: _changeStatusTap).expanded, AppFilledButton(buttonColor: AppColor.green70, label: 'Change Status'.addTranslation, maxWidth: true, onPressed: _changeStatusTap).expanded,
], ],
),
],
) )
: AppFilledButton(buttonColor: AppColor.primary10, label: 'Next'.addTranslation, maxWidth: true, onPressed: _nextTap), : AppFilledButton(buttonColor: AppColor.primary10, label: 'Next'.addTranslation, maxWidth: true, onPressed: _nextTap),
), ),

@ -83,17 +83,15 @@ class _EndUserCostCenterLIstViewState extends State<EndUserCostCenterLIstView> {
children: [ children: [
//Refactor this //Refactor this
SingleChildScrollView(padding: const EdgeInsets.all(16), child: linesList(context).toShadowContainer(context, borderRadius: 20, padding: 12)).expanded, SingleChildScrollView(padding: const EdgeInsets.all(16), child: linesList(context).toShadowContainer(context, borderRadius: 20, padding: 12)).expanded,
if (!viewOnly) ...[
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(buttonColor: AppColor.primary10, label: 'Attachments'.addTranslation, maxWidth: true, onPressed: _attachmentTap),
),
8.height,
],
!viewOnly !viewOnly
? FooterActionButton.footerContainer( ? FooterActionButton.footerContainer(
context: context, context: context,
child: Row( child: Column(
children: [
AppFilledButton(buttonColor: AppColor.primary10, label: 'Attachments'.addTranslation, maxWidth: true, onPressed: _attachmentTap),
16.height,
Row(
children: [ children: [
AppFilledButton( AppFilledButton(
label: 'Cancel'.addTranslation, label: 'Cancel'.addTranslation,
@ -106,6 +104,8 @@ class _EndUserCostCenterLIstViewState extends State<EndUserCostCenterLIstView> {
12.width, 12.width,
AppFilledButton(buttonColor: AppColor.green70, label: 'Change Status'.addTranslation, maxWidth: true, onPressed: _changeStatusTap).expanded, AppFilledButton(buttonColor: AppColor.green70, label: 'Change Status'.addTranslation, maxWidth: true, onPressed: _changeStatusTap).expanded,
], ],
),
],
)) ))
: const SizedBox(), : const SizedBox(),
], ],

@ -84,58 +84,22 @@ class _TechnicalInspectionLinesListViewState extends State<TechnicalInspectionLi
), ),
body: Form( body: Form(
key: _formKey, key: _formKey,
child: Column( child: (isLoading)
? const CircularProgressIndicator(color: AppColor.primary10).center
: (technicalInspectionLinesList.isEmpty)
? const NoDataFound().center
: Column(
children: [ children: [
Expanded( SingleChildScrollView(
child: linesList(context).toShadowContainer(context, borderRadius: 20, padding: 12),
),
if (!viewOnly) ...[
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(buttonColor: AppColor.primary10, label: 'Attachments'.addTranslation, maxWidth: true, onPressed: _attachmentTap),
),
8.height,
],
FooterActionButton.footerContainer(
context: context,
child: !viewOnly
? Row(
children: [
AppFilledButton(
label: 'Cancel'.addTranslation,
maxWidth: true,
buttonColor: AppColor.background(context),
// textColor: context.isDark ? AppColor.neutral30 : Colors.white,
textColor: AppColor.red30,
showBorder: true,
onPressed: _cancelTap,
).expanded,
12.width,
AppFilledButton(buttonColor: AppColor.green70, label: 'Change Status'.addTranslation, maxWidth: true, onPressed: _changeStatusTap).expanded,
],
)
: AppFilledButton(buttonColor: AppColor.primary10, label: 'Next'.addTranslation, maxWidth: true, onPressed: _nextTap),
),
],
),
),
);
}
Widget linesList(BuildContext context) {
if (isLoading) {
return SizedBox.expand(
child: const CircularProgressIndicator(color: AppColor.primary10).center,
);
}
if (technicalInspectionLinesList.isEmpty) {
return const NoDataFound().center;
}
return ListView.separated(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
itemCount: technicalInspectionLinesList.length + 1, // +1 for the header child: Column(
children: [
ListView.separated(
padding: const EdgeInsets.all(0),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: technicalInspectionLinesList.length + 1,
// +1 for the header
separatorBuilder: (_, __) => 8.height, separatorBuilder: (_, __) => 8.height,
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index == 0) { if (index == 0) {
@ -164,7 +128,40 @@ class _TechnicalInspectionLinesListViewState extends State<TechnicalInspectionLi
}, },
); );
}, },
).toShadowContainer(context, borderRadius: 20, padding: 12); ).toShadowContainer(context, borderRadius: 20, padding: 12),
],
),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: !viewOnly
? Column(
children: [
AppFilledButton(buttonColor: AppColor.primary10, label: 'Attachments'.addTranslation, maxWidth: true, onPressed: _attachmentTap),
16.height,
Row(
children: [
AppFilledButton(
label: 'Cancel'.addTranslation,
maxWidth: true,
buttonColor: AppColor.background(context),
// textColor: context.isDark ? AppColor.neutral30 : Colors.white,
textColor: AppColor.red30,
showBorder: true,
onPressed: _cancelTap,
).expanded,
12.width,
AppFilledButton(buttonColor: AppColor.green70, label: 'Change Status'.addTranslation, maxWidth: true, onPressed: _changeStatusTap).expanded,
],
),
],
)
: AppFilledButton(buttonColor: AppColor.primary10, label: 'Next'.addTranslation, maxWidth: true, onPressed: _nextTap),
),
],
),
),
);
} }
//May be need to show data. //May be need to show data.

Loading…
Cancel
Save