Enhancements

merge-requests/31/head
zaid_daoud 3 years ago
parent 9346990626
commit 59ca4277a9

@ -53,6 +53,7 @@ class CreateRequestPageState extends State<CreateRequestPage> {
ServiceRequest _serviceRequest;
final List<File> _deviceImages = [];
bool _isLoading = false;
bool _showDatePicker = false;
Device _device;
Subtitle _subtitle;
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@ -215,11 +216,12 @@ class CreateRequestPageState extends State<CreateRequestPage> {
onSelect: (status) {
_dateTime = null;
_serviceRequest.firstAction = status;
_showDatePicker = _serviceRequest.firstAction != null && _serviceRequest.firstAction.name == "Need a visit";
_serviceRequestsProvider.notifyListeners();
},
),
if (_serviceRequest.firstAction != null) 12.height,
if (_serviceRequest.firstAction != null)
if (_showDatePicker) 12.height,
if (_showDatePicker)
ADatePicker(
date: _dateTime,
from: DateTime.now(),
@ -288,7 +290,7 @@ class CreateRequestPageState extends State<CreateRequestPage> {
Fluttertoast.showToast(msg: _subtitle.pickDevice);
return;
}
if (_serviceRequest.firstAction != null && _dateTime == null) {
if (_serviceRequest.firstAction != null && _serviceRequest.firstAction.name == "Need a visit" && _dateTime == null) {
Fluttertoast.showToast(msg: _subtitle.noDateFound);
return;
}

@ -55,6 +55,7 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
bool _validate = false;
ServiceReport _serviceReport;
bool _isLoading = false;
bool _showCommentField = false;
Subtitle _subtitle;
File _image;
@ -282,6 +283,8 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
request: widget.request,
onSelect: (status) {
_serviceReport.status = status;
_showCommentField = _serviceReport.status?.name == "Resolved";
setState(() {});
},
),
],
@ -328,6 +331,21 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
),
],
),
if (_showCommentField)
const SizedBox(
height: 8,
),
if (_showCommentField)
ATextFormField(
initialValue: _serviceReport?.comment,
hintText: _subtitle.comment,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleMedium,
textInputType: TextInputType.multiline,
onSaved: (value) {
_serviceReport.comment = value;
},
),
SizedBox(
height: 8 * AppStyle.getScaleFactor(context),
),
@ -587,19 +605,6 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
_serviceReport.travelingExpense = int.tryParse(value) ?? 0;
},
),
const SizedBox(
height: 8,
),
ATextFormField(
initialValue: _serviceReport?.comment,
hintText: _subtitle.comment,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleMedium,
textInputType: TextInputType.multiline,
onSaved: (value) {
_serviceReport.comment = value;
},
),
const SizedBox(
height: 8,

Loading…
Cancel
Save