This commit is contained in:
tzw
2021-09-13 09:57:02 +06:30
8 changed files with 37 additions and 24 deletions

View File

@@ -69,6 +69,7 @@ const privilege_delivery = "deli";
const privilege_invoice = "inv";
const privilege_processing = "pr";
const privilege_receiving = "rc";
const privilege_pickup = "pku";
// Pickup types
const shipment_local_pickup = "Local pickup";

View File

@@ -109,7 +109,6 @@ class Carton {
double wd = sw - aw;
wd = wd - rate.diffDiscountWeight;
double wdAmount = wd > 0 ? wd * rate.diffWeightRate : 0;
DiscountByWeight discountByWeight = rate.getDiscountByWeight(aw);
double total = 0;

View File

@@ -16,10 +16,12 @@ class Rate {
DiscountByWeight getDiscountByWeight(double weight) {
discountByWeights.sort((d1, d2) => d2.weight.compareTo(d1.weight));
return discountByWeights.firstWhere((e) => e.weight < weight);
return discountByWeights.firstWhere((e) => e.weight < weight,
orElse: () => DiscountByWeight());
}
CargoType get defaultCargoType => cargoTypes.firstWhere((e) => e.name == "General");
CargoType get defaultCargoType =>
cargoTypes.firstWhere((e) => e.name == "General");
Rate(
{this.deliveryFee = 0,

View File

@@ -43,6 +43,8 @@ class Privilege {
iconData = FontAwesome.dropbox;
} else if (this.id == privilege_receiving) {
iconData = MaterialCommunityIcons.inbox_arrow_down;
} else if (this.id == privilege_pickup) {
iconData = FontAwesome.dropbox;
} else {
iconData = MaterialCommunityIcons.account_question;
}

View File

@@ -42,7 +42,7 @@ Future<void> showConfirmDialog(
child: LocalText(
context,
translationKey,
translationVariables: translationVariables!,
translationVariables: translationVariables,
color: primaryColor,
),
),

View File

@@ -39,7 +39,8 @@ class _ProcessingInfoState extends State<ProcessingInfo> {
initPackage(widget.package!);
}
initPackage(Package package) {
initPackage(Package? package) {
if (package == null) return;
setState(() {
_package = package;
multiImgController.setImageUrls = package.photoUrls;
@@ -223,7 +224,7 @@ class _ProcessingInfoState extends State<ProcessingInfo> {
PackageModel packageModel =
Provider.of<PackageModel>(context, listen: false);
Package? p = await packageModel.getPackage(_package!.id!);
initPackage(p!);
initPackage(p);
}
}
}

View File

@@ -40,7 +40,8 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
initPackage(widget.package!);
}
initPackage(Package package) {
initPackage(Package? package) {
if (package == null) return;
multiImgController.setImageUrls = package.photoUrls;
setState(() {
_package = package;
@@ -150,7 +151,7 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
PackageModel packageModel =
Provider.of<PackageModel>(context, listen: false);
var pkg = await packageModel.getPackage(widget.package!.id!);
initPackage(pkg!);
initPackage(pkg);
}
_delete() {

View File

@@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "22.0.0"
version: "25.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.1"
version: "2.2.0"
args:
dependency: transitive
description:
@@ -28,7 +28,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "2.8.1"
barcode_scan2:
dependency: "direct main"
description:
@@ -91,7 +91,7 @@ packages:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
cli_util:
dependency: transitive
description:
@@ -434,6 +434,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "9.1.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
glob:
dependency: transitive
description:
@@ -531,7 +538,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
mime:
dependency: transitive
description:
@@ -893,21 +900,21 @@ packages:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.8"
version: "1.17.10"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.4.2"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.19"
version: "0.4.0"
timeline_list:
dependency: "direct main"
description: