setValueByKeyAllNew method
void
setValueByKeyAllNew(})
Implementation
void setValueByKeyAllNew(dynamic chiTietDon,
{dynamic value = "", List<Widget> lsRows = const []}) {
// Control control = findControlInputFormAllPage(key);
// if (lsRows.isEmpty) {
// lsRows = lsRow;
// }
for (var page in lsPages) {
for (var row in page.row) {
for (var child in row) {
try {
// ignore: unnecessary_type_check
if (child is Control) {
Control control = child;
if (chiTietDon[control.id.toUpperCase()] != null) {
if (control.formatShow == FormatValuePresent.Percent) {
control.value.value =
chiTietDon[control.id.toUpperCase()]?.toString() ?? "0";
} else if (control.formatShow == FormatValuePresent.Money) {
control.value.value = chiTietDon[control.id.toUpperCase()]
?.toInt()
?.toString() ??
"0";
} else {
control.value.value =
chiTietDon[control.id.toUpperCase()]?.toString() ?? "";
}
}
}
} catch (e) {
printDebug(e);
}
}
}
}
// for (var element in lsRows) {
// Row row = element as Row;
// for (var child in row.children) {
// try {
// // Expanded exp = child as Expanded;
// if (child is FormObject) {
// FormObject form = child as FormObject;
// Control control = form.control!;
// if (chiTietDon[control.id.toUpperCase()] != null) {
// if (control.formatShow == FormatValuePresent.Percent) {
// control.value.value =
// chiTietDon[control.id.toUpperCase()]?.toString() ?? "0";
// } else if (control.formatShow == FormatValuePresent.Money) {
// control.value.value =
// chiTietDon[control.id.toUpperCase()]?.toInt()?.toString() ??
// "0";
// } else {
// control.value.value =
// chiTietDon[control.id.toUpperCase()]?.toString() ?? "";
// }
// }
// }
// } catch (e) {
// printDebug(e);
// }
// }
// }
}