2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 18:55:34 +00:00

Ability to edit Company model

This commit is contained in:
Oliver Walters
2020-04-18 23:33:52 +10:00
parent 16cdae42ed
commit 75725c2cb9
2 changed files with 101 additions and 1 deletions

View File

@ -1,6 +1,36 @@
import 'package:flutter/material.dart';
class StringField extends TextFormField {
StringField({String label, String hint, String initial, Function onSaved, Function validator, bool allowEmpty = false}) :
super(
decoration: InputDecoration(
labelText: label,
hintText: hint
),
initialValue: initial,
onSaved: onSaved,
validator: (value) {
print("Value: ${value}");
if (!allowEmpty && value.isEmpty) {
return "Value cannot be empty";
}
if (validator != null) {
return validator(value);
}
return null;
}
);
}
/*
* Helper class for quantity values
*/
class QuantityField extends TextFormField {
QuantityField({String label = "", String hint = "", String initial = "", double max = null, TextEditingController controller}) :