cleanup code
This commit is contained in:
@@ -110,6 +110,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
name: _carton!.senderName);
|
||||
_selectedMixBoxType = _carton!.mixBoxType;
|
||||
this._mixCartons =
|
||||
// ignore: unnecessary_null_comparison
|
||||
_carton!.mixCartons == null ? [] : List.from(_carton!.mixCartons);
|
||||
bool isMixBox = _carton!.cartonType == carton_mix_box;
|
||||
bool isFromPackages = _carton!.cartonType == carton_from_packages;
|
||||
@@ -665,11 +666,11 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
bool isFromPackages = _selectedCartonType == carton_from_packages;
|
||||
bool isFromCartons = _selectedCartonType == carton_from_cartons;
|
||||
|
||||
if (isFromPackages) {
|
||||
_loadPackages();
|
||||
c.value.packages = _carton!.packages;
|
||||
Carton _c = await Navigator.push(
|
||||
Carton? _c = await Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => PackageCartonEditor(
|
||||
@@ -791,10 +792,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
_updateCargo(CargoType cargo) {
|
||||
setState(() {
|
||||
var _c = _cargoTypes.firstWhere((e) => e.id == cargo.id);
|
||||
if (_c != null) {
|
||||
_c.weight = cargo.weight;
|
||||
_c.qty = cargo.qty;
|
||||
}
|
||||
_c.weight = cargo.weight;
|
||||
_c.qty = cargo.qty;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -880,7 +879,6 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
}
|
||||
|
||||
_addMixCarton(Carton carton) {
|
||||
if (carton == null) return;
|
||||
if (this._mixCartons.any((c) => c.id == carton.id)) return;
|
||||
setState(() {
|
||||
this._mixCartons.add(carton);
|
||||
|
||||
Reference in New Issue
Block a user