improvements

design_3.0_asset_delivery_module
Sikander Saleem 3 weeks ago
parent 9f670d4a0b
commit ab6b143763

@ -29,11 +29,9 @@ extension BuildContextExtension on BuildContext {
return isTablet;
}
void showConfirmDialog(String message, {String? title, VoidCallback? onTap, String? okTitle}) => showDialog(
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(

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

@ -78,6 +78,7 @@ class _AssetDeliveryAttachmentViewState extends State<AssetDeliveryAttachmentVie
attachment: _attachments,
buttonColor: AppColor.primary10,
onlyImages: false,
showAsListView: true,
// showAsGrid: true,
buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10),
onChange: (attachment) {},
@ -103,11 +104,11 @@ class _AssetDeliveryAttachmentViewState extends State<AssetDeliveryAttachmentVie
attachement.add(GenericAttachmentModel(id: item.id ?? 0, name: fileName));
}
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
Map<String,dynamic> payLoad ={
Map<String, dynamic> payLoad = {
'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);
if (status) {
///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:test_sa/extensions/int_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(
context: context,
childWidget: Column(
@ -31,14 +29,17 @@ class AssetDeliveryBottomSheet {
8.height,
Align(
alignment: AlignmentDirectional.centerStart,
child: Text('Change Status'.addTranslation,style: TextStyle(
child: Text(
'Change Status'.addTranslation,
style: TextStyle(
fontSize: 21.toScreenWidth,
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
decoration: TextDecoration.none,
),),
),
10.height,
),
),
16.height,
Row(
children: [
AppFilledButton(
@ -50,13 +51,15 @@ class AssetDeliveryBottomSheet {
showBorder: true,
onPressed: () async {
cancelStatusTap();
},
).expanded,
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();
}).expanded,
],
),

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

@ -83,17 +83,15 @@ class _EndUserCostCenterLIstViewState extends State<EndUserCostCenterLIstView> {
children: [
//Refactor this
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
? FooterActionButton.footerContainer(
context: context,
child: Row(
child: Column(
children: [
AppFilledButton(buttonColor: AppColor.primary10, label: 'Attachments'.addTranslation, maxWidth: true, onPressed: _attachmentTap),
16.height,
Row(
children: [
AppFilledButton(
label: 'Cancel'.addTranslation,
@ -106,6 +104,8 @@ class _EndUserCostCenterLIstViewState extends State<EndUserCostCenterLIstView> {
12.width,
AppFilledButton(buttonColor: AppColor.green70, label: 'Change Status'.addTranslation, maxWidth: true, onPressed: _changeStatusTap).expanded,
],
),
],
))
: const SizedBox(),
],

@ -84,58 +84,22 @@ class _TechnicalInspectionLinesListViewState extends State<TechnicalInspectionLi
),
body: Form(
key: _formKey,
child: Column(
child: (isLoading)
? const CircularProgressIndicator(color: AppColor.primary10).center
: (technicalInspectionLinesList.isEmpty)
? const NoDataFound().center
: Column(
children: [
Expanded(
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(
SingleChildScrollView(
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,
itemBuilder: (context, index) {
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.

Loading…
Cancel
Save