Browse Source

nursery action

master
daivph 5 years ago
parent
commit
2d1531d199
3 changed files with 13 additions and 5 deletions
  1. +4
    -0
      lib/custom_model/Nursery.dart
  2. +5
    -4
      lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart
  3. +4
    -1
      lib/presentation/screens/actions/state_management_helper/change_supply.dart

+ 4
- 0
lib/custom_model/Nursery.dart View File

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;

+ 5
- 4
lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart View File

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");

+ 4
- 1
lib/presentation/screens/actions/state_management_helper/change_supply.dart View File

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();
} }
} }

Loading…
Cancel
Save