From 8e8cdb6bfe0c3f99b82c830ddc52a8cfa661e10f Mon Sep 17 00:00:00 2001 From: zaid_daoud Date: Sun, 9 Jul 2023 15:05:33 +0300 Subject: [PATCH] Dropdown issue --- .../pages/user/visits/pantry/edit_pentry.dart | 19 +- .../widgets/pentry/pentry_pm_kit_form.dart | 187 ++++++------------ 2 files changed, 69 insertions(+), 137 deletions(-) diff --git a/lib/views/pages/user/visits/pantry/edit_pentry.dart b/lib/views/pages/user/visits/pantry/edit_pentry.dart index a6ec92b..f0c1c88 100644 --- a/lib/views/pages/user/visits/pantry/edit_pentry.dart +++ b/lib/views/pages/user/visits/pantry/edit_pentry.dart @@ -14,7 +14,6 @@ import 'package:test_sa/models/visits/visit.dart'; import 'package:test_sa/views/widgets/buttons/app_small_button.dart'; import 'package:test_sa/views/widgets/loaders/loading_manager.dart'; import 'package:test_sa/views/widgets/pentry/pentry_calibration_tool_form.dart'; -import 'package:test_sa/views/widgets/pentry/pentry_info_form.dart'; import 'package:test_sa/views/widgets/pentry/pentry_pm_kit_form.dart'; import 'package:test_sa/views/widgets/pentry/pentry_ppm_check_list_form.dart'; @@ -113,15 +112,15 @@ class _EditPentryState extends State with SingleTickerProviderStateM Tab( text: "PPM Check List", ), - // Tab( - // text: "Calibration Tools", - // ), Tab( - text: "PM Kits", + text: "Calibration Tools", ), Tab( - text: "PM Entry", + text: "PM Kits", ), + // Tab( + // text: "PM Entry", + // ), ]), ), ), @@ -144,10 +143,10 @@ class _EditPentryState extends State with SingleTickerProviderStateM models: _pentry.pmKits, enableValidate: _validate, ), - PentryInfoForm( - model: _pentry, - enableValidate: _validate, - ) + // PentryInfoForm( + // model: _pentry, + // enableValidate: _validate, + // ) ], ), Align( diff --git a/lib/views/widgets/pentry/pentry_pm_kit_form.dart b/lib/views/widgets/pentry/pentry_pm_kit_form.dart index f6ac9b1..3fb154d 100644 --- a/lib/views/widgets/pentry/pentry_pm_kit_form.dart +++ b/lib/views/widgets/pentry/pentry_pm_kit_form.dart @@ -26,133 +26,66 @@ class _PentryPMKitFormState extends State { Widget build(BuildContext context) { final subtitle = AppLocalization.of(context).subtitle; return ListView.builder( - padding: EdgeInsets.only( - top: 12 * AppStyle.getScaleFactor(context), left: 12 * AppStyle.getScaleFactor(context), right: 12 * AppStyle.getScaleFactor(context), bottom: 80 * AppStyle.getScaleFactor(context)), - itemCount: widget.models.length + 1, - itemBuilder: (context, index) { - if (index == widget.models.length) { - return AButton( - text: subtitle.add, - onPressed: () { - widget.models.add(PMKit()); - setState(() {}); - }, - ); - } - final model = widget.models[index]; - return ListView( - shrinkWrap: true, - physics: const ClampingScrollPhysics(), - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - ASubTitle("#${index + 1}"), - if (index != 0) - ASmallButton( - color: Theme.of(context).colorScheme.error, - text: subtitle.delete, - onPressed: () { - widget.models.remove(model); - setState(() {}); - }, - ), - ], - ), - const SizedBox( - height: 8, - ), - const ASubTitle("Item Code"), - const SizedBox( - height: 4, - ), - AutoCompletePartsField( - clearAfterPick: false, - initialValue: (model.itemCode?.name ?? "").toString(), - onPick: (part) { - model.itemCode = Lookup(id: part.id, name: part.code); - }, - ), - const SizedBox( - height: 8, - ), - // const ASubTitle("Item Name"), - // const SizedBox(height: 4,), - // ATextFormField( - // initialValue: (model.itemName ?? "").toString(), - // textAlign: TextAlign.center, - // style: Theme.of(context).textTheme.subtitle1, - // textInputType: TextInputType.text, - // onChange: (value){ - // model.itemName = value; - // }, - // ), - // const SizedBox(height: 8,), - // const ASubTitle("Preparation Time Frame"), - // const SizedBox(height: 4,), - // ATextFormField( - // initialValue: (model.preparationTimeFrame ?? "").toString(), - // textAlign: TextAlign.center, - // style: Theme.of(context).textTheme.subtitle1, - // textInputType: TextInputType.text, - // onChange: (value){ - // model.preparationTimeFrame = value; - // }, - // ), - // const SizedBox(height: 8,), - // const ASubTitle("kit Frequency Demand"), - // const SizedBox(height: 4,), - // ATextFormField( - // initialValue: (model.kitFrequencyDemand ?? "").toString(), - // textAlign: TextAlign.center, - // style: Theme.of(context).textTheme.subtitle1, - // textInputType: TextInputType.text, - // onChange: (value){ - // model.kitFrequencyDemand = value; - // }, - // ), - // const SizedBox(height: 8,), - // const ASubTitle("Availability"), - // const SizedBox(height: 4,), - // ATextFormField( - // initialValue: (model.availability ?? "").toString(), - // textAlign: TextAlign.center, - // style: Theme.of(context).textTheme.subtitle1, - // textInputType: TextInputType.text, - // onChange: (value){ - // model.availability = value; - // }, - // ), - // const SizedBox(height: 8,), - // const ASubTitle("Quantity Needed"), - // const SizedBox(height: 4,), - // ATextFormField( - // initialValue: (model.quantityNeeded ?? "").toString(), - // textAlign: TextAlign.center, - // style: Theme.of(context).textTheme.subtitle1, - // textInputType: TextInputType.number, - // onChange: (value){ - // model.quantityNeeded = value; - // }, - // ), - // const SizedBox(height: 8,), - // const ASubTitle("Quantity Reserved"), - // const SizedBox(height: 4,), - // ATextFormField( - // initialValue: (model.quantityReserved ?? "").toString(), - // textAlign: TextAlign.center, - // style: Theme.of(context).textTheme.subtitle1, - // textInputType: TextInputType.number, - // onChange: (value){ - // model.quantityReserved = value; - // }, - // ), - // const SizedBox(height: 8,), - Divider( - color: Theme.of(context).textTheme.titleMedium.color, - ), - ], + padding: EdgeInsets.only( + top: 12 * AppStyle.getScaleFactor(context), + left: 12 * AppStyle.getScaleFactor(context), + right: 12 * AppStyle.getScaleFactor(context), + bottom: 100 * AppStyle.getScaleFactor(context) + MediaQuery.of(context).padding.bottom, + ), + itemCount: widget.models.length + 1, + shrinkWrap: true, + itemBuilder: (context, index) { + if (index == widget.models.length) { + return AButton( + text: subtitle.add, + onPressed: () { + widget.models.add(PMKit()); + setState(() {}); + }, ); - }); + } + final model = widget.models[index]; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + ASubTitle("#${index + 1}"), + if (index != 0) + ASmallButton( + color: Theme.of(context).colorScheme.error, + text: subtitle.delete, + onPressed: () { + widget.models.remove(model); + setState(() {}); + }, + ), + ], + ), + const SizedBox( + height: 8, + ), + const ASubTitle("Item Code"), + const SizedBox( + height: 4, + ), + AutoCompletePartsField( + clearAfterPick: false, + initialValue: (model.itemCode?.name ?? "").toString(), + onPick: (part) { + model.itemCode = Lookup(id: part.id, name: part.code); + }, + ), + const SizedBox( + height: 8, + ), + Divider( + color: Theme.of(context).textTheme.titleMedium.color, + ), + ], + ); + }, + ); } }