add pagination for invoice and update ui for material 3

This commit is contained in:
tzw
2024-01-26 16:56:20 +06:30
parent 93a5fe071a
commit 8d0f712bf4
32 changed files with 351 additions and 635 deletions

View File

@@ -14,8 +14,8 @@ class CustomDuty {
factory CustomDuty.fromMap(Map<String, dynamic> map, String id) {
return CustomDuty(
id: id,
productType: map['product_type'],
desc: map['desc'],
productType: map['product_type'] ?? "",
desc: map['desc'] ?? "",
fee: (map['fee'] ?? 0).toDouble(),
);
}

View File

@@ -133,8 +133,9 @@ class Invoice {
cargoTypesMaps.map((e) => CargoType.fromMap(e, e["id"])).toList();
var customDutiesMap =
List<Map<String, dynamic>>.from(map['custom_duties'] ?? []);
var customDuties =
customDutiesMap.map((e) => CustomDuty.fromMap(e, e["id"])).toList();
var customDuties = customDutiesMap
.map((e) => CustomDuty.fromMap(e, e["id"] ?? ""))
.toList();
var handlingShipmentsMap =
List<Map<String, dynamic>>.from(map['handling_fee_shipments'] ?? []);
var handingShipments =
@@ -149,22 +150,23 @@ class Invoice {
var discount = Discount.fromMap(discountMap, discountMap['id']);
var paymentMaps = List<Map<String, dynamic>>.from(map['payments'] ?? []);
var payments = paymentMaps.map((e) => Payment.fromMap(e, e["id"])).toList();
return Invoice(
id: docID,
invoiceNumber: map['invoice_number'],
invoiceNumber: map['invoice_number'] ?? "",
invoiceDate: invd.toDate(),
userName: map['user_name'],
fcsID: map['fcs_id'],
phoneNumber: map['phone_number'],
amount: map['amount'],
userName: map['user_name'] ?? "",
fcsID: map['fcs_id'] ?? "",
phoneNumber: map['phone_number'] ?? "",
amount: map['amount'] ?? 0,
paidAmount: double.tryParse(map['paid_amount'].toString()) ?? 0,
status: map['status'],
status: map['status'] ?? "",
cartons: cartons,
cargoTypes: cargoTypes,
shipments: handingShipments,
customDuties: customDuties,
deliveryFee: map['delivery_fee'],
invoiceURL: map['invoice_url'],
deliveryFee: map['delivery_fee'] ?? 0,
invoiceURL: map['invoice_url'] ?? "",
paymentMethod: paymentMethod,
discount: discount,
payments: payments,

View File

@@ -109,8 +109,8 @@ class User {
fcsID: map['fcs_id'],
privileges: _privileges,
lastMessage: map['last_message'],
userUnseenCount: map['user_unseen_count'],
fcsUnseenCount: map['fcs_unseen_count'],
userUnseenCount: map['user_unseen_count'] ?? 0,
fcsUnseenCount: map['fcs_unseen_count'] ?? 0,
preferCurrency: map['preferred_currency'],
lastMessageTime: _date == null ? null : _date.toDate());
}