Fix pm entry empty values when scroll

main_design2.0
zaid_daoud 2 years ago
parent 3e314447c6
commit 1c9101d8ab

@ -36,171 +36,174 @@ class _PentryInfoFormState extends State<PentryInfoForm> {
widget.model?.files ??= []; widget.model?.files ??= [];
final subtitle = AppLocalization.of(context).subtitle; final subtitle = AppLocalization.of(context).subtitle;
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
return ListView( return Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 12 * AppStyle.getScaleFactor(context), left: 12 * AppStyle.getScaleFactor(context), right: 12 * AppStyle.getScaleFactor(context), bottom: 80 * AppStyle.getScaleFactor(context)), top: 12 * AppStyle.getScaleFactor(context), left: 12 * AppStyle.getScaleFactor(context), right: 12 * AppStyle.getScaleFactor(context), bottom: 80 * AppStyle.getScaleFactor(context)),
shrinkWrap: true, child: SingleChildScrollView(
physics: const ClampingScrollPhysics(), child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.stretch,
const SizedBox( children: [
height: 8, const SizedBox(
), height: 8,
const ASubTitle("PPM Visit Status"), ),
if (widget.enableValidate && widget.model.ppmVisitStatus == null) const ASubTitle("PPM Visit Status"),
ASubTitle( if (widget.enableValidate && widget.model.ppmVisitStatus == null)
subtitle.requiredWord, ASubTitle(
color: Colors.red, subtitle.requiredWord,
), color: Colors.red,
const SizedBox( ),
height: 4, const SizedBox(
), height: 4,
PentryVisitsStatusMenu( ),
initialValue: widget.model.ppmVisitStatus, PentryVisitsStatusMenu(
onSelect: (status) { initialValue: widget.model.ppmVisitStatus,
if (status != null) { onSelect: (status) {
widget.model.ppmVisitStatus = status; if (status != null) {
} widget.model.ppmVisitStatus = status;
}, }
), },
const SizedBox( ),
height: 8, const SizedBox(
), height: 8,
const ASubTitle("Timer"), ),
if (widget.enableValidate && widget.model?.timer?.endAt == null) const ASubTitle("Timer"),
ASubTitle( if (widget.enableValidate && widget.model?.timer?.endAt == null)
subtitle.requiredWord, ASubTitle(
color: Colors.red, subtitle.requiredWord,
), color: Colors.red,
const SizedBox( ),
height: 4, const SizedBox(
), height: 4,
AppTimer( ),
timer: widget.model.timer, AppTimer(
enabled: widget.model.timer.endAt == null, timer: widget.model.timer,
onChange: (timer) async { enabled: widget.model.timer.endAt == null,
widget.model.timer = timer; onChange: (timer) async {
return true; widget.model.timer = timer;
}, return true;
), },
const SizedBox( ),
height: 8, const SizedBox(
), height: 8,
const ASubTitle("Status"), ),
if (widget.enableValidate && widget.model.status == null) const ASubTitle("Status"),
ASubTitle( if (widget.enableValidate && widget.model.status == null)
subtitle.requiredWord, ASubTitle(
color: Colors.red, subtitle.requiredWord,
), color: Colors.red,
const SizedBox( ),
height: 4, const SizedBox(
), height: 4,
PentryStatusMenu( ),
initialValue: widget.model.status, PentryStatusMenu(
onSelect: (status) { initialValue: widget.model.status,
widget.model.status = status; onSelect: (status) {
}, widget.model.status = status;
), },
const SizedBox( ),
height: 8, const SizedBox(
), height: 8,
const ASubTitle("Actual Visit Date"), ),
if (widget.enableValidate && widget.model.actualVisitDate == null) const ASubTitle("Actual Visit Date"),
ASubTitle( if (widget.enableValidate && widget.model.actualVisitDate == null)
subtitle.requiredWord, ASubTitle(
color: Colors.red, subtitle.requiredWord,
), color: Colors.red,
const SizedBox( ),
height: 4, const SizedBox(
), height: 4,
ADatePicker( ),
date: widget.model.actualVisitDate, ADatePicker(
from: DateTime.now().subtract(const Duration(days: 30)), date: widget.model.actualVisitDate,
onDatePicker: (date) { from: DateTime.now().subtract(const Duration(days: 30)),
if (date == null) return; onDatePicker: (date) {
widget.model.actualVisitDate = date; if (date == null) return;
setState(() {}); widget.model.actualVisitDate = date;
}, setState(() {});
), },
const SizedBox( ),
height: 8, const SizedBox(
), height: 8,
const ASubTitle("Expected Visit Date"), ),
if (widget.enableValidate && widget.model.expectedVisitDate == null) const ASubTitle("Expected Visit Date"),
ASubTitle( if (widget.enableValidate && widget.model.expectedVisitDate == null)
subtitle.requiredWord, ASubTitle(
color: Colors.red, subtitle.requiredWord,
), color: Colors.red,
const SizedBox( ),
height: 4, const SizedBox(
), height: 4,
ADatePicker( ),
date: widget.model.expectedVisitDate, ADatePicker(
from: DateTime.now().subtract(const Duration(days: 30)), date: widget.model.expectedVisitDate,
onDatePicker: (date) { from: DateTime.now().subtract(const Duration(days: 30)),
if (date == null) return; onDatePicker: (date) {
widget.model.expectedVisitDate = date; if (date == null) return;
setState(() {}); widget.model.expectedVisitDate = date;
}, setState(() {});
), },
const SizedBox( ),
height: 8, const SizedBox(
), height: 8,
const ASubTitle("Traveling Hours"), ),
const SizedBox( const ASubTitle("Traveling Hours"),
height: 4, const SizedBox(
), height: 4,
ATextFormField( ),
initialValue: (widget.model.travelingHours ?? "").toString(), ATextFormField(
textAlign: TextAlign.center, initialValue: (widget.model.travelingHours ?? "").toString(),
style: Theme.of(context).textTheme.titleMedium, textAlign: TextAlign.center,
textInputType: TextInputType.number, style: Theme.of(context).textTheme.titleMedium,
onChange: (value) { textInputType: TextInputType.number,
widget.model.travelingHours = value; onChange: (value) {
}, widget.model.travelingHours = value;
), },
const SizedBox(height: 12), ),
MultiFilesPicker(label: "PPM Attachments", files: widget.model.files), const SizedBox(height: 12),
// AMiniOneFilePicker( MultiFilesPicker(label: "PPM Attachments", files: widget.model.files),
// //error: _validate && _serviceReport.image == null, // AMiniOneFilePicker(
// file: widget.model.file, // //error: _validate && _serviceReport.image == null,
// onPick: (file) { // file: widget.model.file,
// widget.model.file = file; // onPick: (file) {
// }, // widget.model.file = file;
// ), // },
const SizedBox( // ),
height: 8, const SizedBox(
), height: 8,
const ASubTitle("Nurse Signature"), ),
ESignature( const ASubTitle("Nurse Signature"),
oldSignature: widget.model.signatureNurse, ESignature(
newSignature: widget.model.localNurseSignature, oldSignature: widget.model.signatureNurse,
onChange: (signature) { newSignature: widget.model.localNurseSignature,
if (signature == null || signature.isEmpty) { onChange: (signature) {
return; if (signature == null || signature.isEmpty) {
} return;
widget.model.localNurseSignature = signature; }
widget.model.signatureNurse = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"; widget.model.localNurseSignature = signature;
}, widget.model.signatureNurse = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
), },
const SizedBox( ),
height: 8, const SizedBox(
), height: 8,
const ASubTitle("Engineer Signature"), ),
ESignature( const ASubTitle("Engineer Signature"),
oldSignature: widget.model.signatureEngineer, ESignature(
newSignature: widget.model.localNurseSignature, oldSignature: widget.model.signatureEngineer,
onChange: (signature) { newSignature: widget.model.localEngineerSignature,
if (signature == null || signature.isEmpty) { onChange: (signature) {
return; if (signature == null || signature.isEmpty) {
} return;
widget.model.localNurseSignature = signature; }
widget.model.signatureEngineer = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}"; widget.model.localEngineerSignature = signature;
}, widget.model.signatureEngineer = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
), },
const SizedBox( ),
height: 8, const SizedBox(
), height: 8,
], ),
],
),
),
); );
} }
} }

Loading…
Cancel
Save