|
|
|
|
@ -48,6 +48,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
GasRefillProvider _gasRefillProvider;
|
|
|
|
|
GasRefillDetails _currentDetails = GasRefillDetails();
|
|
|
|
|
final TextEditingController _requestedQuantityController = TextEditingController();
|
|
|
|
|
final TextEditingController _deliveredQuantityController = TextEditingController();
|
|
|
|
|
GasRefillModel _formModel = GasRefillModel(details: []);
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
final GlobalKey _DetailsKey = GlobalKey<FormState>();
|
|
|
|
|
@ -125,6 +126,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
_validate = false;
|
|
|
|
|
Scrollable.ensureVisible(_DetailsKey.currentContext);
|
|
|
|
|
_requestedQuantityController.clear();
|
|
|
|
|
_deliveredQuantityController.clear();
|
|
|
|
|
_currentDetails = GasRefillDetails();
|
|
|
|
|
setState(() {});
|
|
|
|
|
return true;
|
|
|
|
|
@ -133,6 +135,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
_requestedQuantityController.dispose();
|
|
|
|
|
_deliveredQuantityController.dispose();
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -402,7 +405,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
ASubTitle(_subtitle.quantity),
|
|
|
|
|
ASubTitle(_subtitle.requestedQuantity),
|
|
|
|
|
if (_validate && _currentDetails?.requestedQuantity == null)
|
|
|
|
|
ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
@ -422,6 +425,26 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
_currentDetails?.requestedQuantity = double.tryParse(value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (widget.gasRefillModel != null) const SizedBox(height: 16),
|
|
|
|
|
if (widget.gasRefillModel != null) ASubTitle(_subtitle.deliveredQuantity),
|
|
|
|
|
if (widget.gasRefillModel != null && _validate && _currentDetails?.deliveredQuantity == null)
|
|
|
|
|
ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
if (widget.gasRefillModel != null) const SizedBox(height: 4),
|
|
|
|
|
if (widget.gasRefillModel != null)
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: (_currentDetails?.deliveredQuantity ?? "").toString(),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
controller: _deliveredQuantityController,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
_currentDetails?.deliveredQuantity = double.tryParse(value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
|
AButton(
|
|
|
|
|
text: _subtitle.add,
|
|
|
|
|
|