cleanup code

This commit is contained in:
tzw
2024-01-23 16:28:08 +06:30
parent a1e87cdbf6
commit f3f75a80c6
96 changed files with 232 additions and 439 deletions

View File

@@ -1,3 +1,5 @@
// ignore_for_file: unnecessary_null_comparison
import 'package:fcs/domain/entities/cargo_type.dart';
import 'package:fcs/domain/entities/carton.dart';
import 'package:fcs/domain/entities/custom_duty.dart';
@@ -81,7 +83,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
await _loadCartons();
await _loadShipments();
await _loadDiscount();
} catch (e) {} finally {
} catch (e) {
} finally {
setState(() {
_isLoading = false;
});
@@ -118,7 +121,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
DiscountModel discountModel =
Provider.of<DiscountModel>(context, listen: false);
discounts = (await discountModel.getDiscount(widget.customer!.id!))!;
if (discounts != null && discounts.length > 0) {
if (discounts.isNotEmpty) {
setState(() {
_invoice!.discount = discounts.first;
});
@@ -257,7 +260,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
InvoiceHandlingFeeList(shipments: _invoice!.shipments)));
_addShipment(shipment);
} else if (p.id == 3) {
Discount discount =
Discount? discount =
await Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => InvoiceDiscountList(
discounts: discounts,
@@ -412,7 +415,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
showMsgDialog(context, "Error", "Expected at least one cargo type");
return;
}
if ((amount ) <= 0) {
if ((amount) <= 0) {
showMsgDialog(context, "Error", "Expected positive amount");
return;
}