| @@ -10,6 +10,7 @@ class Nursery { | |||
| String media; | |||
| String seedName; | |||
| num substratesId; | |||
| String substrateName; | |||
| num seedLength; | |||
| num quantity; | |||
| num seedIncubationTime; | |||
| @@ -25,6 +26,7 @@ class Nursery { | |||
| this.media, | |||
| this.seedName, | |||
| this.substratesId, | |||
| this.substrateName, | |||
| this.seedLength, | |||
| this.quantity, | |||
| this.seedIncubationTime, | |||
| @@ -40,6 +42,7 @@ class Nursery { | |||
| media = json['media']; | |||
| seedName = json['seedName']; | |||
| substratesId = json['substratesId']; | |||
| substrateName = json['substrateName']; | |||
| seedLength = json['seedLength']; | |||
| quantity = json['quantity']; | |||
| seedIncubationTime = json['seedIncubationTime']; | |||
| @@ -62,6 +65,7 @@ class Nursery { | |||
| data['media'] = this.media; | |||
| data['seedName'] = this.seedName; | |||
| data['substratesId'] = this.substratesId; | |||
| data['substrateName'] = this.substrateName; | |||
| data['seedLength'] = this.seedLength; | |||
| data['quantity'] = this.quantity; | |||
| data['seedIncubationTime'] = this.seedIncubationTime; | |||
| @@ -219,9 +219,9 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> { | |||
| GetBuilder<ChangeSupply>( | |||
| builder: (_) => Expanded( | |||
| child: Text( | |||
| changeSupply.currentSupply.name == null | |||
| changeSupply.selectedSupplyName == null | |||
| ? "Loại giá thể" | |||
| : changeSupply.currentSupply.name.toString(), | |||
| : changeSupply.selectedSupplyName.toString(), | |||
| style: TextStyle( | |||
| fontSize: 14.0, color: Colors.black87)))), | |||
| Icon( | |||
| @@ -592,8 +592,9 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> { | |||
| } | |||
| //change subStrates | |||
| if (_nursery.substratesId != null) { | |||
| Get.find<ChangeSupply>() | |||
| .changeById(_nursery.substratesId); | |||
| Get.find<ChangeSupply>().changeByIdAndName( | |||
| _nursery.substratesId, | |||
| _nursery.substrateName); | |||
| } | |||
| } else if (state is ActionDetailInitial) { | |||
| print("init"); | |||
| @@ -4,6 +4,7 @@ import 'package:get/get.dart'; | |||
| class ChangeSupply extends GetxController { | |||
| Supply currentSupply; | |||
| int selectedSupplyId; | |||
| String selectedSupplyName; | |||
| void initValue() { | |||
| currentSupply = Supply(); | |||
| @@ -14,11 +15,13 @@ class ChangeSupply extends GetxController { | |||
| void change(Supply supply) { | |||
| currentSupply = supply; | |||
| selectedSupplyId = supply.id; | |||
| selectedSupplyName = supply.name; | |||
| update(); | |||
| } | |||
| void changeById(int supplyId) { | |||
| void changeByIdAndName(int supplyId, String supplyName) { | |||
| selectedSupplyId = supplyId; | |||
| selectedSupplyName = supplyName; | |||
| update(); | |||
| } | |||
| } | |||