Browse Source

fix validate form Bug #7349

master
daivph 5 years ago
parent
commit
f62e0b0ac2
11 changed files with 15 additions and 108 deletions
  1. +1
    -19
      lib/presentation/screens/actions/crop_status/sc_edit_action_crop_status.dart
  2. +2
    -5
      lib/presentation/screens/actions/disease/sc_edit_action_disease.dart
  3. +1
    -1
      lib/presentation/screens/actions/end/sc_edit_action_end.dart
  4. +1
    -19
      lib/presentation/screens/actions/environment_update/sc_edit_action_environment_update.dart
  5. +1
    -13
      lib/presentation/screens/actions/harvest/sc_edit_action_harvest.dart
  6. +1
    -10
      lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart
  7. +2
    -2
      lib/presentation/screens/actions/other/sc_edit_action_other.dart
  8. +2
    -14
      lib/presentation/screens/actions/packing/sc_edit_action_packing.dart
  9. +1
    -4
      lib/presentation/screens/actions/plant/sc_edit_action_plant.dart
  10. +2
    -17
      lib/presentation/screens/actions/sell/sc_edit_action_sell.dart
  11. +1
    -4
      lib/presentation/screens/actions/use_water/sc_edit_action_user_water.dart

+ 1
- 19
lib/presentation/screens/actions/crop_status/sc_edit_action_crop_status.dart View File

@@ -222,9 +222,6 @@ class _EditActionCropStatusScreenState
],
decoration: InputDecoration(labelText: "Tỉ lệ lên cây"),
controller: _cropRateController,
validator: (String value) {
return Validators.validNumber(value, "Tỉ lệ lên cây");
},
onSaved: (newValue) {
_cropStatus.cropRate = newValue;
},
@@ -240,9 +237,6 @@ class _EditActionCropStatusScreenState
],
decoration: InputDecoration(labelText: "Số lượng lên cây"),
controller: _numTreeController,
validator: (String value) {
return Validators.validNumber(value, "Số lượng lên cây");
},
onSaved: (newValue) {
_cropStatus.numberOfTreeToGrow = newValue;
},
@@ -258,9 +252,6 @@ class _EditActionCropStatusScreenState
],
decoration: InputDecoration(labelText: "Chiều cao cây"),
controller: _heightOfTreeController,
validator: (String value) {
return Validators.validNumber(value, "Chiều cao cây");
},
onSaved: (newValue) {
_cropStatus.heightOfTree = newValue;
},
@@ -276,9 +267,6 @@ class _EditActionCropStatusScreenState
],
decoration: InputDecoration(labelText: "Số lá"),
controller: _numberOfLeafController,
validator: (String value) {
return Validators.validNumber(value, "Số lá");
},
onSaved: (newValue) {
_cropStatus.numberOfLeaf = newValue;
},
@@ -294,9 +282,6 @@ class _EditActionCropStatusScreenState
],
decoration: InputDecoration(labelText: "Kích thước lá"),
controller: _leafSizeController,
validator: (String value) {
return Validators.validNumber(value, "Kích thước lá");
},
onSaved: (newValue) {
_cropStatus.leafSize = newValue;
},
@@ -323,9 +308,6 @@ class _EditActionCropStatusScreenState
],
decoration: InputDecoration(labelText: "Dài đốt thân"),
controller: _internodeLengthController,
validator: (String value) {
return Validators.validNumber(value, "Dài đốt thân");
},
onSaved: (newValue) {
_cropStatus.internodeLength = newValue;
},
@@ -484,7 +466,7 @@ class _EditActionCropStatusScreenState
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

+ 2
- 5
lib/presentation/screens/actions/disease/sc_edit_action_disease.dart View File

@@ -207,7 +207,7 @@ class _EditActionDiseaseScreenState extends State<EditActionDiseaseScreen> {
Widget _typeOfPestField() {
return TextFormField(
keyboardType: TextInputType.text,
decoration: InputDecoration(labelText: "Loại dịch hại"),
decoration: InputDecoration(labelText: "Loại dịch hại *"),
controller: _typesOfPestController,
validator: (String value) {
return Validators.validateNotNullOrEmpty(value, "Loại dịch hại");
@@ -238,9 +238,6 @@ class _EditActionDiseaseScreenState extends State<EditActionDiseaseScreen> {
],
decoration: InputDecoration(labelText: "% cây"),
controller: _treePercentController,
validator: (String value) {
return Validators.validNumber(value, "% cây");
},
onSaved: (newValue) {
_disease.treePercent = newValue;
},
@@ -407,7 +404,7 @@ class _EditActionDiseaseScreenState extends State<EditActionDiseaseScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

+ 1
- 1
lib/presentation/screens/actions/end/sc_edit_action_end.dart View File

@@ -280,7 +280,7 @@ class _EditActionEndScreenState extends State<EditActionEndScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

+ 1
- 19
lib/presentation/screens/actions/environment_update/sc_edit_action_environment_update.dart View File

@@ -211,9 +211,6 @@ class _EditActionEnvironmentUpdateState
],
decoration: InputDecoration(labelText: "EC"),
controller: _ecController,
validator: (String value) {
return Validators.validNumber(value, "EC");
},
onSaved: (newValue) {
_environment.ec = newValue;
},
@@ -229,9 +226,6 @@ class _EditActionEnvironmentUpdateState
],
decoration: InputDecoration(labelText: "pH"),
controller: _phController,
validator: (String value) {
return Validators.validNumber(value, "pH");
},
onSaved: (newValue) {
_environment.pH = newValue;
},
@@ -247,9 +241,6 @@ class _EditActionEnvironmentUpdateState
],
decoration: InputDecoration(labelText: "Nhiệt độ dung dịch"),
controller: _ocddController,
validator: (String value) {
return Validators.validNumber(value, "Nhiệt độ dung dịch");
},
onSaved: (newValue) {
_environment.ocdd = newValue;
},
@@ -265,9 +256,6 @@ class _EditActionEnvironmentUpdateState
],
decoration: InputDecoration(labelText: "Nhiệt độ môi trường"),
controller: _temperatureController,
validator: (String value) {
return Validators.validNumber(value, "Nhiệt độ môi trường");
},
onSaved: (newValue) {
_environment.temperature = newValue;
},
@@ -283,9 +271,6 @@ class _EditActionEnvironmentUpdateState
],
decoration: InputDecoration(labelText: "Độ ẩm"),
controller: _doController,
validator: (String value) {
return Validators.validNumber(value, "Độ ẩm");
},
onSaved: (newValue) {
_environment.dodo = newValue;
},
@@ -301,9 +286,6 @@ class _EditActionEnvironmentUpdateState
],
decoration: InputDecoration(labelText: "Lưu lượng nước"),
controller: _llnController,
validator: (String value) {
return Validators.validNumber(value, "Lưu lượng nước");
},
onSaved: (newValue) {
_environment.lln = newValue;
},
@@ -459,7 +441,7 @@ class _EditActionEnvironmentUpdateState
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

+ 1
- 13
lib/presentation/screens/actions/harvest/sc_edit_action_harvest.dart View File

@@ -184,9 +184,6 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 1"),
controller: _l1Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 1");
},
onSaved: (newValue) {
_harvest.collectedQuantityLv1 = newValue.parseDoubleThousand();
},
@@ -202,9 +199,6 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 2"),
controller: _l2Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 2");
},
onSaved: (newValue) {
_harvest.collectedQuantityLv2 = newValue.parseDoubleThousand();
},
@@ -220,9 +214,6 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 3"),
controller: _l3Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 3");
},
onSaved: (newValue) {
_harvest.collectedQuantityLv3 = newValue.parseDoubleThousand();
},
@@ -238,9 +229,6 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại bỏ"),
controller: _removedQuantityController,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại bỏ");
},
onSaved: (newValue) {
_harvest.removedQuantity = newValue.parseDoubleThousand();
},
@@ -371,7 +359,7 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

+ 1
- 10
lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart View File

@@ -239,9 +239,6 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> {
],
decoration: InputDecoration(labelText: "Chiều dài mần"),
controller: _seedLengthController,
validator: (String value) {
return Validators.validNumber(value, "Chiều dài mần");
},
onSaved: (newValue) {
_nursery.seedLength = newValue.parseDoubleThousand();
},
@@ -257,9 +254,6 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> {
],
decoration: InputDecoration(labelText: "Số lượng hạt gieo"),
controller: _quantityController,
validator: (String value) {
return Validators.validNumber(value, "Số lượng hạt gieo");
},
onSaved: (newValue) {
_nursery.quantity = newValue.parseDoubleThousand();
},
@@ -275,9 +269,6 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> {
],
decoration: InputDecoration(labelText: "Thời gian ngâm hạt"),
controller: _seedIncubationTimeController,
validator: (String value) {
return Validators.validNumber(value, "Thời gian ngâm hạt");
},
onSaved: (newValue) {
_nursery.seedIncubationTime = newValue.parseDoubleThousand();
},
@@ -619,7 +610,7 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54,
fontSize: 13.0),

+ 2
- 2
lib/presentation/screens/actions/other/sc_edit_action_other.dart View File

@@ -194,7 +194,7 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> {
if (snapshot.hasData) {
return DropdownButtonFormField<ActionType>(
value: _actionType,
hint: Text("Hoạt động"),
hint: Text("Hoạt động *"),
onChanged: (ActionType newValue) {
setState(() {
_actionType = newValue;
@@ -340,7 +340,7 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

+ 2
- 14
lib/presentation/screens/actions/packing/sc_edit_action_packing.dart View File

@@ -175,7 +175,7 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> {
if (snapshot.hasData) {
return DropdownButtonFormField<Harvest>(
value: harvestValue,
hint: Text("Mã thu hoạch"),
hint: Text("Mã thu hoạch *"),
onChanged: (Harvest newValue) {
setState(() {
harvestValue = newValue;
@@ -239,9 +239,6 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 1"),
controller: _l1Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 1");
},
onSaved: (newValue) {
_packing.quantityLv1 = newValue.parseDoubleThousand();
},
@@ -257,9 +254,6 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 2"),
controller: _l2Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 2");
},
onSaved: (newValue) {
_packing.quantityLv2 = newValue.parseDoubleThousand();
},
@@ -275,9 +269,6 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 3"),
controller: _l3Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 3");
},
onSaved: (newValue) {
_packing.quantityLv3 = newValue.parseDoubleThousand();
},
@@ -293,9 +284,6 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại bỏ"),
controller: _removedQuantityController,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại bỏ");
},
onSaved: (newValue) {
_packing.removedQuantity = newValue.parseDoubleThousand();
},
@@ -437,7 +425,7 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

+ 1
- 4
lib/presentation/screens/actions/plant/sc_edit_action_plant.dart View File

@@ -186,9 +186,6 @@ class _EditActionPlantScreenState extends State<EditActionPlantScreen> {
],
decoration: InputDecoration(labelText: "Số lượng cây trồng"),
controller: _quantityController,
validator: (String value) {
return Validators.validNumber(value, "Số lượng cây trồng");
},
onSaved: (newValue) {
_plant.quantity = newValue.parseDoubleThousand();
},
@@ -330,7 +327,7 @@ class _EditActionPlantScreenState extends State<EditActionPlantScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54,
fontSize: 13.0),

+ 2
- 17
lib/presentation/screens/actions/sell/sc_edit_action_sell.dart View File

@@ -174,7 +174,7 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
if (snapshot.hasData) {
return DropdownButtonFormField<Harvest>(
value: harvestValue,
hint: Text("Mã thu hoạch"),
hint: Text("Mã thu hoạch *"),
onChanged: (Harvest newValue) {
setState(() {
harvestValue = newValue;
@@ -238,9 +238,6 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 1"),
controller: _l1Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 1");
},
onSaved: (newValue) {
_sell.quantityLv1 = newValue.parseDoubleThousand();
},
@@ -256,9 +253,6 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 2"),
controller: _l2Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 2");
},
onSaved: (newValue) {
_sell.quantityLv2 = newValue.parseDoubleThousand();
},
@@ -274,9 +268,6 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại 3"),
controller: _l3Controller,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại 3");
},
onSaved: (newValue) {
_sell.quantityLv3 = newValue.parseDoubleThousand();
},
@@ -292,9 +283,6 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
],
decoration: InputDecoration(labelText: "Số lượng/khối lượng loại bỏ"),
controller: _removedQuantityController,
validator: (String value) {
return Validators.validNumber(value, "Số lượng/khối lượng loại bỏ");
},
onSaved: (newValue) {
_sell.removedQuantity = newValue.parseDoubleThousand();
},
@@ -306,9 +294,6 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
keyboardType: TextInputType.text,
decoration: InputDecoration(labelText: "Khách hàng"),
controller: _buyerController,
validator: (String value) {
return Validators.validateNotNullOrEmpty(value, "Khách hàng");
},
onSaved: (newValue) {
_sell.buyer = newValue;
},
@@ -451,7 +436,7 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

+ 1
- 4
lib/presentation/screens/actions/use_water/sc_edit_action_user_water.dart View File

@@ -183,9 +183,6 @@ class _EditActionUseWaterScreenState extends State<EditActionUseWaterScreen> {
],
decoration: InputDecoration(labelText: "Thể tích nước sử dụng"),
controller: _amountController,
validator: (String value) {
return Validators.validNumber(value, "Thể tích nước sử dụng");
},
onSaved: (newValue) {
_useWater.amount = newValue.parseDoubleThousand();
},
@@ -347,7 +344,7 @@ class _EditActionUseWaterScreenState extends State<EditActionUseWaterScreen> {
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện",
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
),

Loading…
Cancel
Save