| String media; | String media; | ||||
| String seedName; | String seedName; | ||||
| num substratesId; | num substratesId; | ||||
| String substrateName; | |||||
| num seedLength; | num seedLength; | ||||
| num quantity; | num quantity; | ||||
| num seedIncubationTime; | num seedIncubationTime; | ||||
| this.media, | this.media, | ||||
| this.seedName, | this.seedName, | ||||
| this.substratesId, | this.substratesId, | ||||
| this.substrateName, | |||||
| this.seedLength, | this.seedLength, | ||||
| this.quantity, | this.quantity, | ||||
| this.seedIncubationTime, | this.seedIncubationTime, | ||||
| media = json['media']; | media = json['media']; | ||||
| seedName = json['seedName']; | seedName = json['seedName']; | ||||
| substratesId = json['substratesId']; | substratesId = json['substratesId']; | ||||
| substrateName = json['substrateName']; | |||||
| seedLength = json['seedLength']; | seedLength = json['seedLength']; | ||||
| quantity = json['quantity']; | quantity = json['quantity']; | ||||
| seedIncubationTime = json['seedIncubationTime']; | seedIncubationTime = json['seedIncubationTime']; | ||||
| data['media'] = this.media; | data['media'] = this.media; | ||||
| data['seedName'] = this.seedName; | data['seedName'] = this.seedName; | ||||
| data['substratesId'] = this.substratesId; | data['substratesId'] = this.substratesId; | ||||
| data['substrateName'] = this.substrateName; | |||||
| data['seedLength'] = this.seedLength; | data['seedLength'] = this.seedLength; | ||||
| data['quantity'] = this.quantity; | data['quantity'] = this.quantity; | ||||
| data['seedIncubationTime'] = this.seedIncubationTime; | data['seedIncubationTime'] = this.seedIncubationTime; |
| GetBuilder<ChangeSupply>( | GetBuilder<ChangeSupply>( | ||||
| builder: (_) => Expanded( | builder: (_) => Expanded( | ||||
| child: Text( | child: Text( | ||||
| changeSupply.currentSupply.name == null | |||||
| changeSupply.selectedSupplyName == null | |||||
| ? "Loại giá thể" | ? "Loại giá thể" | ||||
| : changeSupply.currentSupply.name.toString(), | |||||
| : changeSupply.selectedSupplyName.toString(), | |||||
| style: TextStyle( | style: TextStyle( | ||||
| fontSize: 14.0, color: Colors.black87)))), | fontSize: 14.0, color: Colors.black87)))), | ||||
| Icon( | Icon( | ||||
| } | } | ||||
| //change subStrates | //change subStrates | ||||
| if (_nursery.substratesId != null) { | if (_nursery.substratesId != null) { | ||||
| Get.find<ChangeSupply>() | |||||
| .changeById(_nursery.substratesId); | |||||
| Get.find<ChangeSupply>().changeByIdAndName( | |||||
| _nursery.substratesId, | |||||
| _nursery.substrateName); | |||||
| } | } | ||||
| } else if (state is ActionDetailInitial) { | } else if (state is ActionDetailInitial) { | ||||
| print("init"); | print("init"); |
| class ChangeSupply extends GetxController { | class ChangeSupply extends GetxController { | ||||
| Supply currentSupply; | Supply currentSupply; | ||||
| int selectedSupplyId; | int selectedSupplyId; | ||||
| String selectedSupplyName; | |||||
| void initValue() { | void initValue() { | ||||
| currentSupply = Supply(); | currentSupply = Supply(); | ||||
| void change(Supply supply) { | void change(Supply supply) { | ||||
| currentSupply = supply; | currentSupply = supply; | ||||
| selectedSupplyId = supply.id; | selectedSupplyId = supply.id; | ||||
| selectedSupplyName = supply.name; | |||||
| update(); | update(); | ||||
| } | } | ||||
| void changeById(int supplyId) { | |||||
| void changeByIdAndName(int supplyId, String supplyName) { | |||||
| selectedSupplyId = supplyId; | selectedSupplyId = supplyId; | ||||
| selectedSupplyName = supplyName; | |||||
| update(); | update(); | ||||
| } | } | ||||
| } | } |