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

@@ -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;

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

@@ -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
- 1
lib/presentation/screens/actions/state_management_helper/change_supply.dart View File

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

Loading…
Cancel
Save