From f3f75a80c6d4b5745be6b09690a23722644d1068 Mon Sep 17 00:00:00 2001 From: tzw Date: Tue, 23 Jan 2024 16:28:08 +0630 Subject: [PATCH] cleanup code --- lib/data/provider/carton_data_provider.dart | 2 +- .../delivery_address_data_provider.dart | 1 - lib/data/provider/messaging_fcm.dart | 1 - lib/data/provider/package_data_provider.dart | 5 +- lib/data/provider/pickup_data_provider.dart | 2 +- lib/data/provider/rate_data_provider.dart | 24 ++-- lib/data/provider/user_data_provider.dart | 2 +- lib/domain/entities/carton.dart | 17 +-- lib/domain/entities/fcs_shipment.dart | 10 +- lib/domain/entities/invoice.dart | 9 +- lib/domain/entities/package.dart | 2 +- lib/domain/entities/shipment.dart | 3 +- lib/domain/entities/user.dart | 21 ++- lib/domain/exceiptions/server_exceptions.dart | 12 -- lib/helpers/api_helper.dart | 8 +- lib/helpers/firebase_helper.dart | 2 +- lib/helpers/network_connectivity.dart | 2 +- lib/pages/carton/cargo_table.dart | 7 +- lib/pages/carton/carton_cargo_table.dart | 11 +- lib/pages/carton/carton_cargo_table_old.dart | 7 +- lib/pages/carton/carton_editor.dart | 12 +- lib/pages/carton/carton_info.dart | 10 +- lib/pages/carton/package_carton_editor.dart | 8 +- lib/pages/carton_size/carton_size_list.dart | 2 +- lib/pages/customer/customer_list.dart | 2 +- lib/pages/customer/invitation_create.dart | 5 +- lib/pages/delivery/delivery_info.dart | 132 +++++++++--------- .../model/delivery_address_model.dart | 1 - lib/pages/discount/discount_list.dart | 1 - lib/pages/discount/discount_list_row.dart | 4 - lib/pages/discount/model/discount_model.dart | 2 +- lib/pages/faq/faq_detail_page.dart | 6 +- lib/pages/faq/faq_edit_page.dart | 1 - lib/pages/faq/faq_list_page.dart | 13 -- lib/pages/faq/widgets.dart | 5 +- lib/pages/fcs_shipment/fcs_shipment_info.dart | 10 +- lib/pages/invoice/box_addition.dart | 17 --- lib/pages/invoice/editor/invoice_editor.dart | 11 +- .../invoice/invoice_shipment_list_row.dart | 2 - lib/pages/invoice/invoice_table.dart | 3 +- .../invoice/payment/payment_page_edit.dart | 14 +- lib/pages/main/home_page.dart | 28 ++-- lib/pages/market/market_editor.dart | 2 +- lib/pages/package/model/package_model.dart | 18 +-- lib/pages/package/package_editor.dart | 7 +- lib/pages/package/package_new.dart | 4 +- lib/pages/package/tracking_id_page.dart | 2 - lib/pages/package_search/package_serach.dart | 2 - .../payment_method_editor.dart | 1 - .../payment_methods/payment_method_page.dart | 4 +- lib/pages/pickup/pickup_editor.dart | 1 - lib/pages/pickup/pickup_list.dart | 4 - .../processing/model/processing_model.dart | 2 - lib/pages/processing/package_editor.dart | 2 - lib/pages/processing/processing_editor.dart | 6 - .../processing_old/processing_editor.dart | 1 - lib/pages/processing_old/processing_info.dart | 1 - lib/pages/processing_old/processing_list.dart | 1 - lib/pages/rates/custom_editor.dart | 3 +- lib/pages/rates/custom_list.dart | 1 + lib/pages/rates/shipment_rates.dart | 2 +- lib/pages/rates/shipment_rates_calculate.dart | 4 +- lib/pages/rates/shipment_rates_edit.dart | 2 - lib/pages/receiving/receiving_editor.dart | 1 - lib/pages/receiving/receiving_info.dart | 1 - lib/pages/receiving/receiving_list.dart | 2 - lib/pages/shipment/shipment_assign.dart | 13 +- lib/pages/shipment/shipment_box_editor.dart | 15 +- lib/pages/shipment/shipment_confirm.dart | 1 - lib/pages/shipment/shipment_editor.dart | 6 +- lib/pages/shipment/shipment_info.dart | 16 +-- lib/pages/shipment/shipment_list.dart | 2 - lib/pages/staff/staff_editor.dart | 2 +- lib/pages/term/term_edit.dart | 3 - lib/pages/term/term_page.dart | 6 +- lib/pages/widgets/badge.dart | 2 +- lib/pages/widgets/bottom_up_page_route.dart | 23 --- lib/pages/widgets/bottom_widgets.dart | 1 - .../widgets/defalut_delivery_address.dart | 1 - lib/pages/widgets/discount_dropdown.dart | 1 - lib/pages/widgets/display_text.dart | 1 - lib/pages/widgets/img_picker.dart | 2 - lib/pages/widgets/input_date.dart | 11 +- lib/pages/widgets/input_text.dart | 1 - lib/pages/widgets/label_widgets.dart | 3 +- lib/pages/widgets/local_button.dart | 1 - .../widgets/local_popup_menu_button.dart | 1 - lib/pages/widgets/local_radio_buttons.dart | 1 - lib/pages/widgets/local_title.dart | 1 - lib/pages/widgets/multi_img_controller.dart | 4 +- lib/pages/widgets/my_data_table.dart | 33 ++--- lib/pages/widgets/number_cell.dart | 3 +- lib/pages/widgets/progress.dart | 1 - lib/pages/widgets/status_tree.dart | 2 - lib/pages/widgets/task_button.dart | 2 - lib/pages/widgets/title_with_add_button.dart | 1 - 96 files changed, 232 insertions(+), 439 deletions(-) delete mode 100644 lib/domain/exceiptions/server_exceptions.dart delete mode 100644 lib/pages/widgets/bottom_up_page_route.dart diff --git a/lib/data/provider/carton_data_provider.dart b/lib/data/provider/carton_data_provider.dart index 622b8c8..601059c 100644 --- a/lib/data/provider/carton_data_provider.dart +++ b/lib/data/provider/carton_data_provider.dart @@ -35,7 +35,7 @@ class CartonDataProvider { } Future> searchCarton(String term) async { - if (term == null || term == '') return []; + if (term == '') return []; // var bytes = utf8.encode(term); // var base64Str = base64.encode(bytes); diff --git a/lib/data/provider/delivery_address_data_provider.dart b/lib/data/provider/delivery_address_data_provider.dart index 72d9267..d9cec29 100644 --- a/lib/data/provider/delivery_address_data_provider.dart +++ b/lib/data/provider/delivery_address_data_provider.dart @@ -1,4 +1,3 @@ -import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/domain/vo/delivery_address.dart'; import 'package:fcs/helpers/api_helper.dart'; import 'package:fcs/helpers/firebase_helper.dart'; diff --git a/lib/data/provider/messaging_fcm.dart b/lib/data/provider/messaging_fcm.dart index 4a440b5..3ba6f96 100644 --- a/lib/data/provider/messaging_fcm.dart +++ b/lib/data/provider/messaging_fcm.dart @@ -59,7 +59,6 @@ class MessagingFCM { } _onNotify(Map message, OnNotify onNotify) { - var data = message['data'] ?? message; onNotify(Map.from(message)); } diff --git a/lib/data/provider/package_data_provider.dart b/lib/data/provider/package_data_provider.dart index 8183eaa..08d761d 100644 --- a/lib/data/provider/package_data_provider.dart +++ b/lib/data/provider/package_data_provider.dart @@ -57,7 +57,7 @@ class PackageDataProvider { } Future?> ftsSearchPackage(String term) async { - if (term == null || term == '') return []; + if (term == '') return []; var bytes = utf8.encode(term); var base64Str = base64.encode(bytes); @@ -86,8 +86,7 @@ class PackageDataProvider { } Future> searchPackage(String term) async { - if (term == null || term == '') return []; - + if (term == '') return []; List packages = []; try { diff --git a/lib/data/provider/pickup_data_provider.dart b/lib/data/provider/pickup_data_provider.dart index e28df19..bd5ef56 100644 --- a/lib/data/provider/pickup_data_provider.dart +++ b/lib/data/provider/pickup_data_provider.dart @@ -18,7 +18,7 @@ class PickupDataProvider { } Future> searchPickup(String term) async { - if (term == null || term == '') return []; + if (term == '') return []; List pickups = []; diff --git a/lib/data/provider/rate_data_provider.dart b/lib/data/provider/rate_data_provider.dart index e766044..df67560 100644 --- a/lib/data/provider/rate_data_provider.dart +++ b/lib/data/provider/rate_data_provider.dart @@ -86,10 +86,10 @@ class RateDataProvider { } } - late StreamSubscription rateListener; - late StreamSubscription> cargoListener; - late StreamSubscription> customListener; - late StreamSubscription> discountListener; + late StreamSubscription? rateListener; + late StreamSubscription>? cargoListener; + late StreamSubscription>? customListener; + late StreamSubscription>? discountListener; Stream rate() { Future _start() async { rateListener = _rateStream().listen((rate) { @@ -115,18 +115,10 @@ class RateDataProvider { } void _stop() { - if (rateListener != null) { - rateListener.cancel(); - } - if (cargoListener != null) { - cargoListener.cancel(); - } - if (customListener != null) { - customListener.cancel(); - } - if (discountListener != null) { - discountListener.cancel(); - } + rateListener?.cancel(); + cargoListener?.cancel(); + customListener?.cancel(); + discountListener?.cancel(); } controller = StreamController( diff --git a/lib/data/provider/user_data_provider.dart b/lib/data/provider/user_data_provider.dart index 3fc8394..3a606de 100644 --- a/lib/data/provider/user_data_provider.dart +++ b/lib/data/provider/user_data_provider.dart @@ -53,7 +53,7 @@ class UserDataProvider { } Future> searchUser(String term) async { - if (term == null || term == '') return []; + if (term == '') return []; var bytes = utf8.encode(term); var base64Str = base64.encode(bytes); diff --git a/lib/domain/entities/carton.dart b/lib/domain/entities/carton.dart index c17940e..7feb6fe 100644 --- a/lib/domain/entities/carton.dart +++ b/lib/domain/entities/carton.dart @@ -59,23 +59,17 @@ class Carton { List mixCartons; List mixCartonIDs; - int get amount => rate != null && weight != null ? (rate * weight) : 0; + int get amount => (rate * weight); // String get packageNumber => // shipmentNumber + "-" + receiverNumber + " #" + boxNumber; double get actualWeight => - cargoTypes == null ? 0 : cargoTypes.fold(0, (p, e) => e.weight + p); + cargoTypes.isEmpty ? 0 : cargoTypes.fold(0, (p, e) => e.weight + p); int getShipmentWeight(double volumetricRatio) { - if (length == null || - length <= 0 || - width == null || - width <= 0 || - height == null || - height <= 0 || - volumetricRatio == null || - volumetricRatio <= 0) return 0; + if (length <= 0 || width <= 0 || height <= 0 || volumetricRatio <= 0) + return 0; return ((length * width * height) / volumetricRatio).round(); } @@ -113,8 +107,7 @@ class Carton { double total = 0; cargoTypes.forEach((e) { - double r = - e.rate - (discountByWeight != null ? (discountByWeight.discount) : 0); + double r = e.rate - (discountByWeight.discount); double amount = e.weight * r; total += amount; }); diff --git a/lib/domain/entities/fcs_shipment.dart b/lib/domain/entities/fcs_shipment.dart index 794e65e..4f015dd 100644 --- a/lib/domain/entities/fcs_shipment.dart +++ b/lib/domain/entities/fcs_shipment.dart @@ -30,9 +30,13 @@ class FcsShipment { }); factory FcsShipment.fromMap(Map map, String docID) { - var _cutoffDate = (map['cutoff_date'] as Timestamp); - var _arrivalDate = (map['arrival_date'] as Timestamp); - var _departureDate = (map['departure_date'] as Timestamp); + var _cutoffDate = + map['cutoff_date'] == null ? null : (map['cutoff_date'] as Timestamp); + var _arrivalDate = + map['arrival_date'] == null ? null : (map['arrival_date'] as Timestamp); + var _departureDate = map['departure_date'] == null + ? null + : (map['departure_date'] as Timestamp); return FcsShipment( id: docID, diff --git a/lib/domain/entities/invoice.dart b/lib/domain/entities/invoice.dart index a15e905..6bb4170 100644 --- a/lib/domain/entities/invoice.dart +++ b/lib/domain/entities/invoice.dart @@ -35,7 +35,7 @@ class Invoice { String? invoiceURL; List getCargoTypes(Rate rate) { - if (cargoTypes != null) return cargoTypes; + if (cargoTypes.isNotEmpty) return cargoTypes; List _cargoTypes = []; double totalCalWeight = 0; @@ -59,8 +59,7 @@ class Invoice { rate.getDiscountByWeight(totalCalWeight); _cargoTypes.forEach((e) { - double r = - e.rate - (discountByWeight != null ? discountByWeight.discount : 0); + double r = e.rate - discountByWeight.discount; e.calRate = r; }); return _cargoTypes; @@ -95,11 +94,11 @@ class Invoice { } double getCustomFee() { - return customDuties == null ? 0 : customDuties.fold(0, (p, d) => p + d.fee); + return customDuties.isEmpty ? 0 : customDuties.fold(0, (p, d) => p + d.fee); } double getDeliveryFee() { - return deliveryFee == null ? 0 : deliveryFee; + return deliveryFee; } double getDiscount() => discount == null ? 0 : discount!.amount; diff --git a/lib/domain/entities/package.dart b/lib/domain/entities/package.dart index 882c2c2..1eb7564 100644 --- a/lib/domain/entities/package.dart +++ b/lib/domain/entities/package.dart @@ -38,7 +38,7 @@ class Package { //for packages in processing List photoFiles; - int get amount => rate != null && weight != null ? rate * weight : 0; + int get amount => rate * weight; double get price => rate.toDouble() * weight; diff --git a/lib/domain/entities/shipment.dart b/lib/domain/entities/shipment.dart index d1b31d6..c3739b5 100644 --- a/lib/domain/entities/shipment.dart +++ b/lib/domain/entities/shipment.dart @@ -74,7 +74,8 @@ class Shipment { bool get isReceived => status == shipment_received_status; factory Shipment.fromMap(Map map, String id) { - var pd = (map['pickup_date'] as Timestamp); + var pd = + map['pickup_date'] == null ? null : (map['pickup_date'] as Timestamp); var pa = map['pickup_address']; var _pa = pa != null ? DeliveryAddress.fromMap(pa, pa["id"]) : null; return Shipment( diff --git a/lib/domain/entities/user.dart b/lib/domain/entities/user.dart index 0ad4100..f3fd143 100644 --- a/lib/domain/entities/user.dart +++ b/lib/domain/entities/user.dart @@ -41,16 +41,10 @@ class User { } } - String get getUserUnseenCount => userUnseenCount != null - ? userUnseenCount > 100 - ? "99+" - : userUnseenCount.toString() - : "0"; - String get getFcsUnseenCount => fcsUnseenCount != null - ? fcsUnseenCount > 100 - ? "99+" - : fcsUnseenCount.toString() - : "0"; + String get getUserUnseenCount => + userUnseenCount > 100 ? "99+" : userUnseenCount.toString(); + String get getFcsUnseenCount => + fcsUnseenCount > 100 ? "99+" : fcsUnseenCount.toString(); List privileges = []; @@ -101,7 +95,8 @@ class User { } factory User.fromMap(Map map, String docID) { - var _date = (map['message_time'] as Timestamp); + var _date = + map['message_time'] == null ? null : (map['message_time'] as Timestamp); List _privileges = map['privileges'] == null ? [] : map['privileges'].cast(); @@ -127,7 +122,7 @@ class User { } bool isCustomer() { - return privileges == null || privileges.length == 0; + return privileges.length == 0; } bool hasSysAdmin() { @@ -183,7 +178,7 @@ class User { } bool _has(String privilege) { - return (privileges != null ? privileges.contains(privilege) : false); + return (privileges.contains(privilege)); } @override diff --git a/lib/domain/exceiptions/server_exceptions.dart b/lib/domain/exceiptions/server_exceptions.dart deleted file mode 100644 index 7436d0b..0000000 --- a/lib/domain/exceiptions/server_exceptions.dart +++ /dev/null @@ -1,12 +0,0 @@ - -class ServerException { - @override - List? get props => null; - - call() { - return null; - } - - @override - bool? get stringify => null; -} diff --git a/lib/helpers/api_helper.dart b/lib/helpers/api_helper.dart index 783a602..4868f75 100644 --- a/lib/helpers/api_helper.dart +++ b/lib/helpers/api_helper.dart @@ -27,7 +27,7 @@ Future requestAPI(String path, method, if (token != null) { headers["Token"] = token; } - if (devInfo != null && devInfo.deviceID != null && deviceName != null) { + if (devInfo.deviceID != null) { headers["Device"] = devInfo.deviceID ?? "" + ":" + deviceName; } headers["Project-ID"] = Config.instance.reportProjectID; @@ -148,8 +148,8 @@ typedef OnDownloadDone(File file); // if token is null Future requestDownload(String path, method, {dynamic payload, - required String token, - required String url, + required String? token, + required String? url, required String filePath, OnDownloadDone? onDownloadDone}) async { DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); @@ -187,7 +187,7 @@ Future requestDownload(String path, method, fileName = cd.substring(cd.indexOf("=") + 1); } - var file = filePath + "/" + fileName; + // var file = filePath + "/" + fileName; var fileSave = new File(filePath + "/" + fileName); response.listen((d) => _downloadData.addAll(d), onDone: () async { await fileSave.writeAsBytes(_downloadData); diff --git a/lib/helpers/firebase_helper.dart b/lib/helpers/firebase_helper.dart index 0184b69..4efa642 100644 --- a/lib/helpers/firebase_helper.dart +++ b/lib/helpers/firebase_helper.dart @@ -62,7 +62,7 @@ Future uploadStorage(String path, File? file, } Future deleteStorageFromUrls(List urls) async { - if (urls == null) return; + if (urls.isEmpty) return; for (int i = 0; i < urls.length; i++) { if (urls[i] == null) return; await deleteStorageFromUrl(urls[i]!); diff --git a/lib/helpers/network_connectivity.dart b/lib/helpers/network_connectivity.dart index 4a7932d..4b02658 100644 --- a/lib/helpers/network_connectivity.dart +++ b/lib/helpers/network_connectivity.dart @@ -51,7 +51,7 @@ class NetworkConnectivity { } } - if (_controller != null && !_controller.isClosed) + if (!_controller.isClosed) _controller.sink.add({"isOnline": isOnline}); } diff --git a/lib/pages/carton/cargo_table.dart b/lib/pages/carton/cargo_table.dart index 5e9d5ac..8b69d9b 100644 --- a/lib/pages/carton/cargo_table.dart +++ b/lib/pages/carton/cargo_table.dart @@ -1,8 +1,6 @@ import 'package:fcs/domain/entities/cargo_type.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/widgets/local_text.dart'; -import 'package:fcs/pages/widgets/my_data_table.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class CargoTable extends StatefulWidget { @@ -68,7 +66,7 @@ class _CargoTableState extends State { c.name ?? "", style: textStyle, )), - DataCell(c.qty == null || c.qty == 0 + DataCell(c.qty == 0 ? Center( child: Text( "-", @@ -82,8 +80,7 @@ class _CargoTableState extends State { ), )), DataCell( - Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2), - style: textStyle), + Text(c.weight.toStringAsFixed(2), style: textStyle), ), ], ); diff --git a/lib/pages/carton/carton_cargo_table.dart b/lib/pages/carton/carton_cargo_table.dart index a7751de..48d9f4d 100644 --- a/lib/pages/carton/carton_cargo_table.dart +++ b/lib/pages/carton/carton_cargo_table.dart @@ -3,7 +3,6 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/dialog_input.dart'; import 'package:fcs/pages/widgets/local_text.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; typedef OnRemove(CargoType cargoType); @@ -94,7 +93,7 @@ class _CargoTableState extends State { c.isCutomDuty! ? GestureDetector( onTap: () async { - String _t = await showDialog( + String? _t = await showDialog( context: context, builder: (_) => DialogInput( label: "cargo.qty", value: c.qty.toString())); @@ -114,7 +113,7 @@ class _CargoTableState extends State { borderRadius: BorderRadius.all(Radius.circular(5.0)), ), child: new Text( - c.qty == null ? "" : c.qty.toString(), + c.qty.toString(), style: textStyle, textAlign: TextAlign.center, ), @@ -140,7 +139,7 @@ class _CargoTableState extends State { return; } - String _t = await showDialog( + String? _t = await showDialog( context: context, builder: (_) => DialogInput( label: "cargo.weight", @@ -161,9 +160,7 @@ class _CargoTableState extends State { border: Border.all(color: primaryColor), borderRadius: BorderRadius.all(Radius.circular(5.0)), ), - child: Text( - c.weight == null ? "0.00" : c.weight.toStringAsFixed(2), - style: textStyle), + child: Text(c.weight.toStringAsFixed(2), style: textStyle), ), ), widget.onRemove == null diff --git a/lib/pages/carton/carton_cargo_table_old.dart b/lib/pages/carton/carton_cargo_table_old.dart index b2b8ff4..1c3a6d5 100644 --- a/lib/pages/carton/carton_cargo_table_old.dart +++ b/lib/pages/carton/carton_cargo_table_old.dart @@ -1,7 +1,6 @@ import 'package:fcs/domain/entities/cargo_type.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/widgets/local_text.dart'; -import 'package:fcs/pages/widgets/my_data_table.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -78,7 +77,7 @@ class _CargoTableState extends State { style: textStyle, ), new Text( - c.qty == null || c.qty == 0 ? "" : " x ${c.qty.toString()}", + c.qty == 0 ? "" : " x ${c.qty.toString()}", style: TextStyle(color: Colors.grey), ), ], @@ -135,9 +134,7 @@ class _CargoTableState extends State { totalWeight = _t; this.remainingWeight = this.totalWeight - _total; widget.cargoTypes!.forEach((c) { - if (c.qty == null) { - this._cargos.add(c); - } + this._cargos.add(c); }); this._cargos.forEach((c) { _list.add(c.name!); diff --git a/lib/pages/carton/carton_editor.dart b/lib/pages/carton/carton_editor.dart index 6cd3f09..38ffa9a 100644 --- a/lib/pages/carton/carton_editor.dart +++ b/lib/pages/carton/carton_editor.dart @@ -110,6 +110,7 @@ class _CartonEditorState extends State { 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 { 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 { _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 { } _addMixCarton(Carton carton) { - if (carton == null) return; if (this._mixCartons.any((c) => c.id == carton.id)) return; setState(() { this._mixCartons.add(carton); diff --git a/lib/pages/carton/carton_info.dart b/lib/pages/carton/carton_info.dart index db67495..83c0f2a 100644 --- a/lib/pages/carton/carton_info.dart +++ b/lib/pages/carton/carton_info.dart @@ -272,11 +272,11 @@ class _CartonInfoState extends State { final cargoTableBox = CargoTable( cargoTypes: _box!.cargoTypes, ); - final mixCartonNumberBox = DisplayText( - text: _box!.mixCartonNumber, - labelTextKey: "box.mix.carton", - iconData: MaterialCommunityIcons.package, - ); + // final mixCartonNumberBox = DisplayText( + // text: _box!.mixCartonNumber, + // labelTextKey: "box.mix.carton", + // iconData: MaterialCommunityIcons.package, + // ); final mixTypeBox = Container( padding: EdgeInsets.only(top: 20), diff --git a/lib/pages/carton/package_carton_editor.dart b/lib/pages/carton/package_carton_editor.dart index 2d52b7d..d70d6e1 100644 --- a/lib/pages/carton/package_carton_editor.dart +++ b/lib/pages/carton/package_carton_editor.dart @@ -293,11 +293,9 @@ class _PackageCartonEditorState extends State { _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; + }); } _creatCarton() async { diff --git a/lib/pages/carton_size/carton_size_list.dart b/lib/pages/carton_size/carton_size_list.dart index e396f11..51c9985 100644 --- a/lib/pages/carton_size/carton_size_list.dart +++ b/lib/pages/carton_size/carton_size_list.dart @@ -119,7 +119,7 @@ class _CartonSizeListState extends State { )); } - _remove(CartonSize cartonSize) { + _remove(CartonSize? cartonSize) { if (cartonSize == null) { showMsgDialog(context, "Esrror", "Invalid cartonsize!"); return; diff --git a/lib/pages/customer/customer_list.dart b/lib/pages/customer/customer_list.dart index ac17c52..24981aa 100644 --- a/lib/pages/customer/customer_list.dart +++ b/lib/pages/customer/customer_list.dart @@ -191,7 +191,7 @@ class _CustomerListState extends State { } Widget getCount(User customer) { - return customer.fcsUnseenCount != null && customer.fcsUnseenCount > 0 + return customer.fcsUnseenCount > 0 ? Container( padding: const EdgeInsets.all(8.0), decoration: diff --git a/lib/pages/customer/invitation_create.dart b/lib/pages/customer/invitation_create.dart index f058c9b..0ace991 100644 --- a/lib/pages/customer/invitation_create.dart +++ b/lib/pages/customer/invitation_create.dart @@ -146,10 +146,7 @@ class _InvitationCreateState extends State { _invite() async { String userName = _nameController.text; String phoneNumber = dialCode + _phoneController.text; - if (userName == null || - userName == "" || - phoneNumber == null || - phoneNumber == "") { + if (userName == "" || phoneNumber == "") { showMsgDialog(context, "Error", "Invalid name or phone number"); return; } diff --git a/lib/pages/delivery/delivery_info.dart b/lib/pages/delivery/delivery_info.dart index 0007a53..149a133 100644 --- a/lib/pages/delivery/delivery_info.dart +++ b/lib/pages/delivery/delivery_info.dart @@ -1,5 +1,4 @@ import 'package:fcs/domain/constants.dart'; -import 'package:fcs/domain/entities/cargo_type.dart'; import 'package:fcs/domain/entities/carton.dart'; import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/vo/delivery_address.dart'; @@ -14,7 +13,6 @@ import 'package:fcs/pages/rates/model/shipment_rate_model.dart'; import 'package:fcs/pages/widgets/defalut_delivery_address.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; -import 'package:fcs/pages/widgets/length_picker.dart'; import 'package:fcs/pages/widgets/local_button.dart'; import 'package:fcs/pages/widgets/local_radio_buttons.dart'; import 'package:fcs/pages/widgets/local_text.dart'; @@ -39,11 +37,8 @@ class DeliveryInfo extends StatefulWidget { class _DeliveryInfoState extends State { bool _isLoading = false; late Carton _box; - late String _selectedCartonType; - List _packages = []; - List _mixBoxes = []; - Carton _selectedShipmentBox = new Carton(); - List _cargoTypes = []; + + // List _cargoTypes = []; DeliveryAddress _deliveryAddress = new DeliveryAddress(); TextEditingController _widthController = new TextEditingController(); TextEditingController _heightController = new TextEditingController(); @@ -61,7 +56,6 @@ class _DeliveryInfoState extends State { void initState() { super.initState(); if (widget.box != null) _box = widget.box!; - _selectedCartonType = _box.cartonType ?? ''; //for shipment weight volumetricRatio = Provider.of(context, listen: false) @@ -79,7 +73,7 @@ class _DeliveryInfoState extends State { _widthController.text = _box.width.toString(); _heightController.text = _box.height.toString(); _lengthController.text = _box.length.toString(); - _cargoTypes = _box.cargoTypes; + // _cargoTypes = _box.cargoTypes; _deliveryAddress = _box.deliveryAddress!; isMixBox = _box.cartonType == carton_mix_box; isFromShipments = _box.cartonType == carton_from_shipments; @@ -155,70 +149,70 @@ class _DeliveryInfoState extends State { iconData: Icons.person, ); - final shipmentBoxTitle = Container( - padding: EdgeInsets.only(left: 15, right: 10.0, top: 20), - child: Row( - children: [ - Expanded( - child: - LocalText(context, 'box.shipment_number', color: Colors.grey), - ), - LocalText(context, 'box.shipment.desc', color: Colors.grey), - ], - ), - ); + // final shipmentBoxTitle = Container( + // padding: EdgeInsets.only(left: 15, right: 10.0, top: 20), + // child: Row( + // children: [ + // Expanded( + // child: + // LocalText(context, 'box.shipment_number', color: Colors.grey), + // ), + // LocalText(context, 'box.shipment.desc', color: Colors.grey), + // ], + // ), + // ); - final shipmentBoxRow = Container( - padding: EdgeInsets.only(left: 15.0, right: 10.0, top: 5.0, bottom: 5.0), - child: Row( - children: [ - Expanded( - child: new Text( - _selectedShipmentBox.shipmentNumber ?? "", - style: textStyle, - )), - new Text( - _selectedShipmentBox.desc ?? "", - style: textStyle, - ), - ], - ), - ); + // final shipmentBoxRow = Container( + // padding: EdgeInsets.only(left: 15.0, right: 10.0, top: 5.0, bottom: 5.0), + // child: Row( + // children: [ + // Expanded( + // child: new Text( + // _selectedShipmentBox.shipmentNumber ?? "", + // style: textStyle, + // )), + // new Text( + // _selectedShipmentBox.desc ?? "", + // style: textStyle, + // ), + // ], + // ), + // ); - final lengthBox = LengthPicker( - controller: _lengthController, - lableKey: "box.length", - isReadOnly: true, - ); - final widthBox = LengthPicker( - controller: _widthController, - lableKey: "box.width", - isReadOnly: true, - ); - final heightBox = LengthPicker( - controller: _heightController, - lableKey: "box.height", - isReadOnly: true, - ); + // final lengthBox = LengthPicker( + // controller: _lengthController, + // lableKey: "box.length", + // isReadOnly: true, + // ); + // final widthBox = LengthPicker( + // controller: _widthController, + // lableKey: "box.width", + // isReadOnly: true, + // ); + // final heightBox = LengthPicker( + // controller: _heightController, + // lableKey: "box.height", + // isReadOnly: true, + // ); - final dimBox = Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only(right: 8.0), - child: Icon(FontAwesome.arrow_circle_right, color: primaryColor), - ), - SizedBox(child: lengthBox, width: 80), - SizedBox(child: widthBox, width: 80), - SizedBox(child: heightBox, width: 80), - ], - ); + // final dimBox = Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Padding( + // padding: const EdgeInsets.only(right: 8.0), + // child: Icon(FontAwesome.arrow_circle_right, color: primaryColor), + // ), + // SizedBox(child: lengthBox, width: 80), + // SizedBox(child: widthBox, width: 80), + // SizedBox(child: heightBox, width: 80), + // ], + // ); - final shipmentWeightBox = DisplayText( - text: shipmentWeight.toStringAsFixed(0), - labelTextKey: "box.shipment_weight", - iconData: MaterialCommunityIcons.weight, - ); + // final shipmentWeightBox = DisplayText( + // text: shipmentWeight.toStringAsFixed(0), + // labelTextKey: "box.shipment_weight", + // iconData: MaterialCommunityIcons.weight, + // ); final mixCartonNumberBox = DisplayText( text: _box.mixCartonNumber, labelTextKey: "box.mix.carton", diff --git a/lib/pages/delivery_address/model/delivery_address_model.dart b/lib/pages/delivery_address/model/delivery_address_model.dart index 719c552..928bbda 100644 --- a/lib/pages/delivery_address/model/delivery_address_model.dart +++ b/lib/pages/delivery_address/model/delivery_address_model.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'package:barcode_scan2/gen/protos/protos.pb.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:fcs/data/services/services.dart'; import 'package:fcs/domain/vo/delivery_address.dart'; diff --git a/lib/pages/discount/discount_list.dart b/lib/pages/discount/discount_list.dart index 466f800..39419ed 100644 --- a/lib/pages/discount/discount_list.dart +++ b/lib/pages/discount/discount_list.dart @@ -2,7 +2,6 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/discount/discount_list_row.dart'; import 'package:fcs/pages/discount/model/discount_model.dart'; -import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/local_popup_menu_button.dart'; import 'package:fcs/pages/widgets/local_popupmenu.dart'; import 'package:fcs/pages/widgets/local_text.dart'; diff --git a/lib/pages/discount/discount_list_row.dart b/lib/pages/discount/discount_list_row.dart index b2702b2..405c9a4 100644 --- a/lib/pages/discount/discount_list_row.dart +++ b/lib/pages/discount/discount_list_row.dart @@ -1,9 +1,5 @@ -import 'package:fcs/domain/entities/carton.dart'; import 'package:fcs/domain/entities/discount.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/pages/discount/discount_editor.dart'; -import 'package:fcs/pages/main/util.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; import 'package:intl/intl.dart'; diff --git a/lib/pages/discount/model/discount_model.dart b/lib/pages/discount/model/discount_model.dart index ce2b478..77c7b32 100644 --- a/lib/pages/discount/model/discount_model.dart +++ b/lib/pages/discount/model/discount_model.dart @@ -59,7 +59,7 @@ class DiscountModel extends BaseModel { } } - Paginator _getUsed() { + Paginator? _getUsed() { if (user == null || !user!.hasFcsShipments()) throw "No Privilege"; var pageQuery = FirebaseFirestore.instance diff --git a/lib/pages/faq/faq_detail_page.dart b/lib/pages/faq/faq_detail_page.dart index d2bd99c..b1a56fd 100644 --- a/lib/pages/faq/faq_detail_page.dart +++ b/lib/pages/faq/faq_detail_page.dart @@ -28,9 +28,9 @@ class _FAQDetailPageState extends State { @override Widget build(BuildContext context) { - if(widget.faq.id != null) - faq = context.select((FAQModel m) => m.getFAQ(widget.faq.id!)); - if (faq == null) return Text("Deleted"); + if (widget.faq.id != null) + faq = context.select((FAQModel m) => m.getFAQ(widget.faq.id!)); + // if (faq == null) return Text("Deleted"); bool isEditable = context.select((MainModel m) => m.faqEditable()); return LocalProgress( diff --git a/lib/pages/faq/faq_edit_page.dart b/lib/pages/faq/faq_edit_page.dart index 29ca285..4114eb4 100644 --- a/lib/pages/faq/faq_edit_page.dart +++ b/lib/pages/faq/faq_edit_page.dart @@ -1,7 +1,6 @@ import 'package:fcs/domain/constants.dart'; import 'package:fcs/domain/entities/faq.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/faq/model/faq_model.dart'; import 'package:fcs/pages/faq/widgets.dart'; import 'package:fcs/pages/main/util.dart'; diff --git a/lib/pages/faq/faq_list_page.dart b/lib/pages/faq/faq_list_page.dart index 077f66a..6c5a804 100644 --- a/lib/pages/faq/faq_list_page.dart +++ b/lib/pages/faq/faq_list_page.dart @@ -15,7 +15,6 @@ import 'package:provider/provider.dart'; import 'model/faq_model.dart'; -const Duration _kExpand = Duration(milliseconds: 200); class FAQListPage extends StatefulWidget { @override @@ -24,18 +23,6 @@ class FAQListPage extends StatefulWidget { class _FAQListPageState extends State with SingleTickerProviderStateMixin { - AnimationController? _controller; - Animation? _iconTurns; - - @override - void initState() { - super.initState(); - _controller = AnimationController(duration: _kExpand, vsync: this); - var _halfTween = Tween(begin: 0.0, end: 0.5); - var _easeInTween = CurveTween(curve: Curves.easeIn); - _iconTurns = _controller?.drive(_halfTween.chain(_easeInTween)); - } - @override Widget build(BuildContext context) { FAQModel faqModel = Provider.of(context); diff --git a/lib/pages/faq/widgets.dart b/lib/pages/faq/widgets.dart index a954882..2136cba 100644 --- a/lib/pages/faq/widgets.dart +++ b/lib/pages/faq/widgets.dart @@ -14,7 +14,8 @@ Widget itemTitle(BuildContext context, String textKey) { ); } -Widget subItemTitle(BuildContext context, String textKey, {IconData? iconData}) { +Widget subItemTitle(BuildContext context, String textKey, + {IconData? iconData}) { return Padding( padding: const EdgeInsets.only(left: 0, top: 0, bottom: 0), child: Row( @@ -74,7 +75,7 @@ Widget contactItem(BuildContext context, String text, IconData iconData, Padding( padding: const EdgeInsets.all(8.0), child: Text( - text == null ? "" : text, + text, overflow: TextOverflow.ellipsis, maxLines: 5, style: TextStyle( diff --git a/lib/pages/fcs_shipment/fcs_shipment_info.dart b/lib/pages/fcs_shipment/fcs_shipment_info.dart index d3fa572..67b128c 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_info.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_info.dart @@ -88,11 +88,11 @@ class _FcsShipmentInfoState extends State { iconData: Icons.date_range, ); - final departureDateBox = DisplayText( - text: _departureDateControler.text, - labelTextKey: "FCSshipment.departure_date", - iconData: Icons.date_range, - ); + // final departureDateBox = DisplayText( + // text: _departureDateControler.text, + // labelTextKey: "FCSshipment.departure_date", + // iconData: Icons.date_range, + // ); final shipTypeBox = DisplayText( text: _shipmentTypeControler.text, diff --git a/lib/pages/invoice/box_addition.dart b/lib/pages/invoice/box_addition.dart index f14c26c..1a78001 100644 --- a/lib/pages/invoice/box_addition.dart +++ b/lib/pages/invoice/box_addition.dart @@ -1,11 +1,9 @@ import 'package:fcs/domain/entities/carton.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; -import 'package:fcs/pages/carton/model/carton_model.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class BoxAddition extends StatefulWidget { final Carton? box; @@ -16,25 +14,10 @@ class BoxAddition extends StatefulWidget { } class _BoxAdditionState extends State { - Carton _box = new Carton(); bool _isLoading = false; - @override - void initState() { - super.initState(); - if (widget.box != null) { - _box = widget.box!; - } - } - - @override - void dispose() { - super.dispose(); - } - @override Widget build(BuildContext context) { - var boxModel = Provider.of(context); return LocalProgress( inAsyncCall: _isLoading, child: Scaffold( diff --git a/lib/pages/invoice/editor/invoice_editor.dart b/lib/pages/invoice/editor/invoice_editor.dart index 99b5143..35e62aa 100644 --- a/lib/pages/invoice/editor/invoice_editor.dart +++ b/lib/pages/invoice/editor/invoice_editor.dart @@ -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 { await _loadCartons(); await _loadShipments(); await _loadDiscount(); - } catch (e) {} finally { + } catch (e) { + } finally { setState(() { _isLoading = false; }); @@ -118,7 +121,7 @@ class _InvoiceEditorState extends State { DiscountModel discountModel = Provider.of(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 { 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 { showMsgDialog(context, "Error", "Expected at least one cargo type"); return; } - if ((amount ) <= 0) { + if ((amount) <= 0) { showMsgDialog(context, "Error", "Expected positive amount"); return; } diff --git a/lib/pages/invoice/invoice_shipment_list_row.dart b/lib/pages/invoice/invoice_shipment_list_row.dart index a08a362..c0283f4 100644 --- a/lib/pages/invoice/invoice_shipment_list_row.dart +++ b/lib/pages/invoice/invoice_shipment_list_row.dart @@ -1,12 +1,10 @@ import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; import 'package:intl/intl.dart'; import '../main/util.dart'; -import 'invoice_customer_list.dart'; typedef OnSelect(FcsShipment fcsShipment); diff --git a/lib/pages/invoice/invoice_table.dart b/lib/pages/invoice/invoice_table.dart index 77812dd..0ca4b21 100644 --- a/lib/pages/invoice/invoice_table.dart +++ b/lib/pages/invoice/invoice_table.dart @@ -4,7 +4,6 @@ import 'package:fcs/domain/entities/invoice.dart'; import 'package:fcs/domain/entities/rate.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/local_text.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -89,7 +88,7 @@ class InvoiceTable extends StatelessWidget { }); // // add delivery fee tableRows.add(InvoiceTableRow( - data: invoice!.deliveryFee == null || invoice!.deliveryFee == 0 + data: invoice!.deliveryFee == 0 ? null : invoice!.deliveryFee, invoiceDataType: InvoiceDataType.DeliveryFeeType, diff --git a/lib/pages/invoice/payment/payment_page_edit.dart b/lib/pages/invoice/payment/payment_page_edit.dart index 098a354..d2e2ead 100644 --- a/lib/pages/invoice/payment/payment_page_edit.dart +++ b/lib/pages/invoice/payment/payment_page_edit.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:fcs/domain/entities/invoice.dart'; import 'package:fcs/domain/entities/receipt.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; @@ -8,9 +7,7 @@ import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/image_file_picker.dart'; -import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/local_text.dart'; -import 'package:fcs/pages/widgets/local_title.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/show_img.dart'; import 'package:flutter/cupertino.dart'; @@ -28,7 +25,6 @@ class PaymentPageEdit extends StatefulWidget { } class _PaymentPageEditState extends State { - TextEditingController _amountController = new TextEditingController(); var dateFormatter = new DateFormat('dd MMM yyyy'); Receipt _receipt = new Receipt(); @@ -72,11 +68,11 @@ class _PaymentPageEditState extends State { iconData: Icons.av_timer, text: _receipt.status); - final receiptFileBox = Row(children: [ - LocalText(context, 'pm.attachment', fontSize: 16, color: Colors.grey), - IconButton( - icon: Icon(Icons.attachment, color: primaryColor), onPressed: () {}) - ]); + // final receiptFileBox = Row(children: [ + // LocalText(context, 'pm.attachment', fontSize: 16, color: Colors.grey), + // IconButton( + // icon: Icon(Icons.attachment, color: primaryColor), onPressed: () {}) + // ]); final comfirmBox = fcsButton(context, getLocalString(context, 'pm.btn_confirm')); diff --git a/lib/pages/main/home_page.dart b/lib/pages/main/home_page.dart index e67daa7..8cfe636 100644 --- a/lib/pages/main/home_page.dart +++ b/lib/pages/main/home_page.dart @@ -27,7 +27,6 @@ import 'package:fcs/pages/pickup/pickup_list.dart'; import 'package:fcs/pages/processing/processing_list.dart'; import 'package:fcs/pages/rates/shipment_rates.dart'; import 'package:fcs/pages/receiving/receiving_list.dart'; -import 'package:fcs/pages/shipment/shipment_list.dart'; import 'package:fcs/pages/staff/staff_list.dart'; import 'package:fcs/pages/widgets/badge.dart'; import 'package:fcs/pages/widgets/bottom_widgets.dart'; @@ -38,7 +37,6 @@ import 'package:fcs/pages/widgets/task_button.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:logging/logging.dart'; import 'package:provider/provider.dart'; @@ -60,8 +58,8 @@ class _HomePageState extends State { bool login = false; bool _isLoading = false; List isSelected = [true, false]; - static FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); + // static FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = + // FlutterLocalNotificationsPlugin(); TextEditingController _searchCtl = TextEditingController(); List isFcs = [false]; @@ -255,17 +253,17 @@ class _HomePageState extends State { btnCallback: () => Navigator.of(context).push( CupertinoPageRoute(builder: (context) => CartonList()))); - final shipmentBtn = TaskButton("shipment", - icon: SimpleLineIcons.direction, - btnCallback: () => Navigator.of(context) - .push(CupertinoPageRoute(builder: (context) => ShipmentList()))); + // final shipmentBtn = TaskButton("shipment", + // icon: SimpleLineIcons.direction, + // btnCallback: () => Navigator.of(context) + // .push(CupertinoPageRoute(builder: (context) => ShipmentList()))); - final shipmentBtnFcs = TaskButton("shipment", - icon: SimpleLineIcons.direction, - btnCallback: () => Navigator.of(context).push(CupertinoPageRoute( - builder: (context) => ShipmentList( - forCustomer: false, - )))); + // final shipmentBtnFcs = TaskButton("shipment", + // icon: SimpleLineIcons.direction, + // btnCallback: () => Navigator.of(context).push(CupertinoPageRoute( + // builder: (context) => ShipmentList( + // forCustomer: false, + // )))); final pickupBtnFcs = TaskButton("pickup.title", icon: SimpleLineIcons.direction, @@ -538,7 +536,7 @@ class _HomePageState extends State { try { String term = _searchCtl.text; - if (term == null || term.trim() == "") return; + if ( term.trim() == "") return; var packageModel = Provider.of(context, listen: false); Package? package = await packageModel.lookupPackage(term); if (package == null) { diff --git a/lib/pages/market/market_editor.dart b/lib/pages/market/market_editor.dart index c6c8b23..8b2a764 100644 --- a/lib/pages/market/market_editor.dart +++ b/lib/pages/market/market_editor.dart @@ -102,7 +102,7 @@ class _MarketEditorState extends State { )); } - _remove(Market market) { + _remove(Market? market) { if (market == null) { showMsgDialog(context, "Esrror", "Invalid market!"); return; diff --git a/lib/pages/package/model/package_model.dart b/lib/pages/package/model/package_model.dart index dcbf6bc..d5e974c 100644 --- a/lib/pages/package/model/package_model.dart +++ b/lib/pages/package/model/package_model.dart @@ -258,7 +258,7 @@ class PackageModel extends BaseModel { } Future createReceiving( - User user, Package package, List files) async { + User? user, Package package, List? files) async { if (user != null) { package.fcsID = user.fcsID; } @@ -267,7 +267,7 @@ class PackageModel extends BaseModel { throw Exception("Exceed number of file upload"); } - package.photoUrls = package.photoUrls == null ? [] : package.photoUrls; + package.photoUrls = package.photoUrls; String path = Path.join(pkg_files_path); List urls = await uploadFiles(path, files); package.photoUrls = urls; @@ -284,26 +284,26 @@ class PackageModel extends BaseModel { } } - Future updateReceiving(User user, Package package, List files, + Future updateReceiving(User? user, Package package, List files, List deletedUrls) async { if (user != null) { package.fcsID = user.fcsID; } - if (deletedUrls != null) { + if (deletedUrls.isNotEmpty) { for (String? url in deletedUrls) { package.photoUrls.remove(url); } } List uploadedURL = []; - if (files != null) { + if (files.isNotEmpty) { var count = (package.photoUrls.length) + files.length - (deletedUrls.length); if (count > uploadPhotoLimit) throw Exception("Exceed number of file upload"); - package.photoUrls = package.photoUrls == null ? [] : package.photoUrls; + package.photoUrls = package.photoUrls; String path = Path.join(pkg_files_path); uploadedURL = await uploadFiles(path, files); uploadedURL.forEach((url) { @@ -329,20 +329,20 @@ class PackageModel extends BaseModel { Future updateProcessing( Package package, List files, List deletedUrls) async { - if (deletedUrls != null) { + if (deletedUrls.isNotEmpty) { for (String? url in deletedUrls) { package.photoUrls.remove(url); } } List uploadedURL = []; - if (files != null) { + if (files.isNotEmpty) { var count = (package.photoUrls.length) + files.length - (deletedUrls.length); if (count > uploadPhotoLimit) throw Exception("Exceed number of file upload"); - package.photoUrls = package.photoUrls == null ? [] : package.photoUrls; + package.photoUrls = package.photoUrls; String path = Path.join(pkg_files_path); uploadedURL = await uploadFiles(path, files); uploadedURL.forEach((url) { diff --git a/lib/pages/package/package_editor.dart b/lib/pages/package/package_editor.dart index 9afa78b..8592e0c 100644 --- a/lib/pages/package/package_editor.dart +++ b/lib/pages/package/package_editor.dart @@ -4,7 +4,6 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/market/market_editor.dart'; import 'package:fcs/pages/market/model/market_model.dart'; -import 'package:fcs/pages/package/model/package_model.dart'; import 'package:fcs/pages/package/tracking_id_page.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/input_text.dart'; @@ -226,8 +225,7 @@ class _PackageEditorPageState extends State { setState(() { _isLoading = true; }); - PackageModel packageModel = - Provider.of(context, listen: false); + try { _package!.desc = _descCtl.text; _package!.remark = _remarkCtl.text; @@ -252,8 +250,7 @@ class _PackageEditorPageState extends State { setState(() { _isLoading = true; }); - PackageModel packageModel = - Provider.of(context, listen: false); + try { // await packageModel.deletePackage(_package); Navigator.pop(context, true); diff --git a/lib/pages/package/package_new.dart b/lib/pages/package/package_new.dart index 1b33c1d..00bcbdb 100644 --- a/lib/pages/package/package_new.dart +++ b/lib/pages/package/package_new.dart @@ -3,9 +3,7 @@ import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/package/tracking_id_page.dart'; import 'package:fcs/pages/user_search/user_serach.dart'; -import 'package:fcs/pages/staff/model/staff_model.dart'; import 'package:fcs/pages/main/util.dart'; -import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/local_text.dart'; @@ -187,7 +185,7 @@ class _PackageNewState extends State { } _create() async { - if (user == null || packages == null || packages.length == 0) { + if (user == null || packages.length == 0) { showMsgDialog(context, "Error", "Invalid user!"); return; } diff --git a/lib/pages/package/tracking_id_page.dart b/lib/pages/package/tracking_id_page.dart index 6cdd773..2e17ad7 100644 --- a/lib/pages/package/tracking_id_page.dart +++ b/lib/pages/package/tracking_id_page.dart @@ -5,14 +5,12 @@ import 'package:fcs/pages/market/market_editor.dart'; import 'package:fcs/pages/market/model/market_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/barcode_scanner.dart'; -import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; -import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; const MANAGE_MARKET = "Manage Market"; diff --git a/lib/pages/package_search/package_serach.dart b/lib/pages/package_search/package_serach.dart index 3ada0bd..3d14be9 100644 --- a/lib/pages/package_search/package_serach.dart +++ b/lib/pages/package_search/package_serach.dart @@ -1,12 +1,10 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/package/model/package_model.dart'; import 'package:fcs/pages/package/package_list_row.dart'; import 'package:fcs/pages/widgets/barcode_scanner.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; -import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; Future searchPackage(BuildContext context, diff --git a/lib/pages/payment_methods/payment_method_editor.dart b/lib/pages/payment_methods/payment_method_editor.dart index 9699db7..fb95f43 100644 --- a/lib/pages/payment_methods/payment_method_editor.dart +++ b/lib/pages/payment_methods/payment_method_editor.dart @@ -1,6 +1,5 @@ import 'package:fcs/domain/entities/payment_method.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/payment_methods/model/payment_method_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/input_text.dart'; diff --git a/lib/pages/payment_methods/payment_method_page.dart b/lib/pages/payment_methods/payment_method_page.dart index 3f0ce64..5b17872 100644 --- a/lib/pages/payment_methods/payment_method_page.dart +++ b/lib/pages/payment_methods/payment_method_page.dart @@ -1,11 +1,9 @@ import 'package:fcs/domain/entities/payment_method.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/payment_methods/model/payment_method_model.dart'; import 'package:fcs/pages/payment_methods/payment_method_editor.dart'; import 'package:fcs/pages/main/util.dart'; -import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; @@ -128,7 +126,7 @@ class _PaymentMethodPageState extends State { } _itemRow(String text, String labelKey, {IconData? iconData}) { - return text == null || text == "" + return text == "" ? Container() : Row( children: [ diff --git a/lib/pages/pickup/pickup_editor.dart b/lib/pages/pickup/pickup_editor.dart index 281f6ab..242052f 100644 --- a/lib/pages/pickup/pickup_editor.dart +++ b/lib/pages/pickup/pickup_editor.dart @@ -1,7 +1,6 @@ import 'package:fcs/domain/entities/market.dart'; import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/entities/pickup.dart'; -import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/market/market_editor.dart'; import 'package:fcs/pages/market/model/market_model.dart'; diff --git a/lib/pages/pickup/pickup_list.dart b/lib/pages/pickup/pickup_list.dart index 74f7e35..c05cb6b 100644 --- a/lib/pages/pickup/pickup_list.dart +++ b/lib/pages/pickup/pickup_list.dart @@ -1,9 +1,5 @@ -import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/entities/pickup.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/pages/package/model/package_model.dart'; -import 'package:fcs/pages/package_search/package_serach.dart'; -import 'package:fcs/pages/pickup/pickup_editor.dart'; import 'package:fcs/pages/pickup/pickup_info.dart'; import 'package:fcs/pages/pickup/pickup_list_row.dart'; import 'package:fcs/pages/pickup_search/pickup_serach.dart'; diff --git a/lib/pages/processing/model/processing_model.dart b/lib/pages/processing/model/processing_model.dart index 0977245..438f021 100644 --- a/lib/pages/processing/model/processing_model.dart +++ b/lib/pages/processing/model/processing_model.dart @@ -1,8 +1,6 @@ import 'dart:async'; -import 'dart:io'; import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/entities/processing.dart'; import 'package:fcs/pages/main/model/base_model.dart'; import 'package:logging/logging.dart'; diff --git a/lib/pages/processing/package_editor.dart b/lib/pages/processing/package_editor.dart index 96fd95c..0847c88 100644 --- a/lib/pages/processing/package_editor.dart +++ b/lib/pages/processing/package_editor.dart @@ -9,7 +9,6 @@ import 'package:fcs/pages/package/model/package_model.dart'; import 'package:fcs/pages/package/tracking_id_page.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/package_search/package_serach.dart'; -import 'package:fcs/pages/widgets/barcode_scanner.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/local_text.dart'; @@ -19,7 +18,6 @@ import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; -import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; class PackageEditor extends StatefulWidget { diff --git a/lib/pages/processing/processing_editor.dart b/lib/pages/processing/processing_editor.dart index ad03853..02a7d53 100644 --- a/lib/pages/processing/processing_editor.dart +++ b/lib/pages/processing/processing_editor.dart @@ -257,12 +257,6 @@ class _ProcesingEditorState extends State { setState(() {}); } - _removePackage(Package package) { - if (package == null) return; - this.packages.removeWhere((p) => p.trackingID == package.trackingID); - setState(() {}); - } - _save() async { setState(() { _isLoading = true; diff --git a/lib/pages/processing_old/processing_editor.dart b/lib/pages/processing_old/processing_editor.dart index 59e0a3c..649441f 100644 --- a/lib/pages/processing_old/processing_editor.dart +++ b/lib/pages/processing_old/processing_editor.dart @@ -8,7 +8,6 @@ import 'package:fcs/pages/package/model/package_model.dart'; import 'package:fcs/pages/package/tracking_id_page.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/user_search/user_serach.dart'; -import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/input_text.dart'; diff --git a/lib/pages/processing_old/processing_info.dart b/lib/pages/processing_old/processing_info.dart index d48a433..0935539 100644 --- a/lib/pages/processing_old/processing_info.dart +++ b/lib/pages/processing_old/processing_info.dart @@ -2,7 +2,6 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/package/model/package_model.dart'; -import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/local_text.dart'; diff --git a/lib/pages/processing_old/processing_list.dart b/lib/pages/processing_old/processing_list.dart index de4aae4..949c8fe 100644 --- a/lib/pages/processing_old/processing_list.dart +++ b/lib/pages/processing_old/processing_list.dart @@ -1,6 +1,5 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/package/model/package_model.dart'; import 'package:fcs/pages/package_search/package_serach.dart'; import 'package:fcs/pages/widgets/local_text.dart'; diff --git a/lib/pages/rates/custom_editor.dart b/lib/pages/rates/custom_editor.dart index a5d5457..972e2bc 100644 --- a/lib/pages/rates/custom_editor.dart +++ b/lib/pages/rates/custom_editor.dart @@ -35,8 +35,7 @@ class _CustomEditorState extends State { _custom = widget.custom!; _productController.text = _custom.name ?? ""; _feeController.text = _custom.customDutyFee.toStringAsFixed(2); - _shipmentRateController.text = - _custom.rate == null ? "" : _custom.rate.toStringAsFixed(2); + _shipmentRateController.text = _custom.rate.toStringAsFixed(2); } else { _isNew = true; } diff --git a/lib/pages/rates/custom_list.dart b/lib/pages/rates/custom_list.dart index f5a1dc9..ddcae3d 100644 --- a/lib/pages/rates/custom_list.dart +++ b/lib/pages/rates/custom_list.dart @@ -83,6 +83,7 @@ class _CustomListState extends State { child: _row( custom.name??"", "Custom Fee \$ " + custom.customDutyFee.toStringAsFixed(2), + // ignore: unnecessary_null_comparison custom.rate == null ? "" : "Shipment rate \$ " + diff --git a/lib/pages/rates/shipment_rates.dart b/lib/pages/rates/shipment_rates.dart index 2082b6e..4bf2937 100644 --- a/lib/pages/rates/shipment_rates.dart +++ b/lib/pages/rates/shipment_rates.dart @@ -200,7 +200,7 @@ class _ShipmentRatesState extends State { } List getDiscountWidget(List discounts) { - if (discounts == null) return []; + if (discounts.isEmpty) return []; return discounts.map((d) { return Container( child: _row("${d.weight.toStringAsFixed(2)} lb", diff --git a/lib/pages/rates/shipment_rates_calculate.dart b/lib/pages/rates/shipment_rates_calculate.dart index c895f02..57c3a20 100644 --- a/lib/pages/rates/shipment_rates_calculate.dart +++ b/lib/pages/rates/shipment_rates_calculate.dart @@ -67,7 +67,7 @@ class _ShipmentRatesCalState extends State { setState(() { _deliveryFee = effectiveWeight > rate.freeDeliveryWeight ? 0 : rate.deliveryFee; - _amount = amount == null ? 0 : amount + _deliveryFee; + _amount = amount + _deliveryFee; _shipmentWeight = shipmentWeight.toDouble(); }); } @@ -109,7 +109,7 @@ class _ShipmentRatesCalState extends State { ); final shipmentWeightBox = DisplayText( - text: _shipmentWeight != null ? _shipmentWeight.toStringAsFixed(2) : "0", + text: _shipmentWeight.toStringAsFixed(2), labelTextKey: "box.shipment_weight", iconData: MaterialCommunityIcons.weight, ); diff --git a/lib/pages/rates/shipment_rates_edit.dart b/lib/pages/rates/shipment_rates_edit.dart index c5590c3..f75d316 100644 --- a/lib/pages/rates/shipment_rates_edit.dart +++ b/lib/pages/rates/shipment_rates_edit.dart @@ -49,8 +49,6 @@ class _ShipmentRatesEditState extends State { @override Widget build(BuildContext context) { - var shipmentRateModel = Provider.of(context); - final minWigBox = InputText( labelTextKey: 'rate.min_weight', iconData: FontAwesomeIcons.weightHanging, diff --git a/lib/pages/receiving/receiving_editor.dart b/lib/pages/receiving/receiving_editor.dart index e542548..960e0be 100644 --- a/lib/pages/receiving/receiving_editor.dart +++ b/lib/pages/receiving/receiving_editor.dart @@ -15,7 +15,6 @@ import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; -import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; typedef void FindCallBack(); diff --git a/lib/pages/receiving/receiving_info.dart b/lib/pages/receiving/receiving_info.dart index dcdf850..f617f08 100644 --- a/lib/pages/receiving/receiving_info.dart +++ b/lib/pages/receiving/receiving_info.dart @@ -5,7 +5,6 @@ import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/package/model/package_model.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; -import 'package:fcs/pages/widgets/local_button.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; diff --git a/lib/pages/receiving/receiving_list.dart b/lib/pages/receiving/receiving_list.dart index 16a95db..0808882 100644 --- a/lib/pages/receiving/receiving_list.dart +++ b/lib/pages/receiving/receiving_list.dart @@ -1,9 +1,7 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/package/model/package_model.dart'; import 'package:fcs/pages/package_search/package_serach.dart'; -import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pagination/paginator_listview.dart'; diff --git a/lib/pages/shipment/shipment_assign.dart b/lib/pages/shipment/shipment_assign.dart index ad2e808..c9347a2 100644 --- a/lib/pages/shipment/shipment_assign.dart +++ b/lib/pages/shipment/shipment_assign.dart @@ -1,4 +1,3 @@ -import 'package:fcs/domain/constants.dart'; import 'package:fcs/domain/entities/shipment.dart'; import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/helpers/theme.dart'; @@ -8,7 +7,6 @@ import 'package:fcs/pages/staff/model/staff_model.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/local_button.dart'; import 'package:fcs/pages/widgets/local_dropdown.dart'; -import 'package:fcs/pages/widgets/local_radio_buttons.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_title.dart'; import 'package:fcs/pages/widgets/progress.dart'; @@ -42,7 +40,6 @@ class _ShipmentAssignState extends State { bool _isLoading = false; var now = new DateTime.now(); - String? _selectedShipmentType; User? _user; List? _users; @@ -53,13 +50,10 @@ class _ShipmentAssignState extends State { _shipment = widget.shipment; _loadUsers(); - _selectedShipmentType = _shipment!.shipmentType; _fromTimeEditingController.text = _shipment!.pickupTimeStart!; _toTimeEditingController.text = _shipment!.pickupTimeEnd!; _pickupDate.text = dateFormatter.format(_shipment!.pickupDate ?? now); - _handlingFee.text = _shipment!.handlingFee != null - ? _shipment!.handlingFee.toString() - : "0"; + _handlingFee.text = _shipment!.handlingFee.toString(); } _loadUsers() async { @@ -74,12 +68,7 @@ class _ShipmentAssignState extends State { @override Widget build(BuildContext context) { - ShipmentModel pickupModel = Provider.of(context); final shipmentNumberBox = getShipmentNumberStatus(context, _shipment!); - bool isLocalPickup = _selectedShipmentType == shipment_local_pickup; - bool isCourierPickup = _selectedShipmentType == shipment_courier_pickup; - bool isLocalDropoff = _selectedShipmentType == shipment_local_dropoff; - bool isCourierDropoff = _selectedShipmentType == shipment_courier_dropoff; var usersBox = LocalDropdown( callback: (v) { diff --git a/lib/pages/shipment/shipment_box_editor.dart b/lib/pages/shipment/shipment_box_editor.dart index 8270da6..b89c46c 100644 --- a/lib/pages/shipment/shipment_box_editor.dart +++ b/lib/pages/shipment/shipment_box_editor.dart @@ -50,9 +50,9 @@ class _ShipmentBoxEditorState extends State { if (widget.box != null) { _box = widget.box; _isNew = false; - _lengthCtl.text = _box!.length != null ? _box!.length.toString() : ''; - _widthCtl.text = _box!.width != null ? _box!.width.toString() : ''; - _heightCtl.text = _box!.height != null ? _box!.height.toString() : ''; + _lengthCtl.text = _box!.length.toString(); + _widthCtl.text = _box!.width.toString(); + _heightCtl.text = _box!.height.toString(); } else { var shipmentModel = Provider.of(context, listen: false); @@ -86,7 +86,7 @@ class _ShipmentBoxEditorState extends State { final shipmentWeightBox = DisplayText( labelTextKey: "shipment.box.shipment.weight", - text: shipmentWeight == null ? "" : shipmentWeight.toStringAsFixed(0), + text: shipmentWeight.toStringAsFixed(0), iconData: MaterialCommunityIcons.weight, ); @@ -212,7 +212,7 @@ class _ShipmentBoxEditorState extends State { } List getCargoRows(BuildContext context) { - if (_box!.cargoTypes == null) { + if (_box!.cargoTypes.isEmpty) { return []; } double total = 0; @@ -238,8 +238,7 @@ class _ShipmentBoxEditorState extends State { Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2), - style: textStyle), + Text(c.weight.toStringAsFixed(2), style: textStyle), IconButton( icon: Icon( Icons.remove_circle, @@ -281,7 +280,7 @@ class _ShipmentBoxEditorState extends State { return rows; } - _addCargo(CargoType cargo) { + _addCargo(CargoType? cargo) { if (cargo == null) return; setState(() { _box!.cargoTypes.remove(cargo); diff --git a/lib/pages/shipment/shipment_confirm.dart b/lib/pages/shipment/shipment_confirm.dart index 05ed394..b7e45fc 100644 --- a/lib/pages/shipment/shipment_confirm.dart +++ b/lib/pages/shipment/shipment_confirm.dart @@ -8,7 +8,6 @@ import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_icons_null_safety/flutter_icons_null_safety.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; diff --git a/lib/pages/shipment/shipment_editor.dart b/lib/pages/shipment/shipment_editor.dart index 86d0bd9..d70095b 100644 --- a/lib/pages/shipment/shipment_editor.dart +++ b/lib/pages/shipment/shipment_editor.dart @@ -279,19 +279,19 @@ class _ShipmentEditorState extends State { }).toList(); } - _addBox(Carton box) { + _addBox(Carton? box) { if (box == null) return; box.cartonType = carton_from_shipments; _shipment!.boxes.add(box); setState(() {}); } - _saveBox(Carton box) { + _saveBox(Carton? box) { if (box == null) return; setState(() {}); } - _removeBox(Carton box) { + _removeBox(Carton? box) { if (box == null) return; _shipment!.boxes.remove(box); setState(() {}); diff --git a/lib/pages/shipment/shipment_info.dart b/lib/pages/shipment/shipment_info.dart index ee29ad5..97b66cd 100644 --- a/lib/pages/shipment/shipment_info.dart +++ b/lib/pages/shipment/shipment_info.dart @@ -53,14 +53,7 @@ class _ShipmentInfoState extends State { TextEditingController _noOfPackageEditingController = new TextEditingController(); TextEditingController _weightEditingController = new TextEditingController(); - TextEditingController _recipientNameEditingController = - new TextEditingController(); - TextEditingController _recipientPhoneEditingController = - new TextEditingController(); - TextEditingController _recipientAddressEditingController = - new TextEditingController(); TextEditingController _pickupDate = new TextEditingController(); - TextEditingController _handlingFeeController = new TextEditingController(); Shipment? _shipment; bool _isLoading = false; @@ -77,11 +70,8 @@ class _ShipmentInfoState extends State { _addressEditingController.text = _shipment!.address ?? ""; _fromTimeEditingController.text = _shipment!.pickupTimeStart ?? ""; _toTimeEditingController.text = _shipment!.pickupTimeEnd ?? ""; - _noOfPackageEditingController.text = _shipment!.numberOfPackage != null - ? _shipment!.numberOfPackage.toString() - : ""; - _weightEditingController.text = - _shipment!.weight != null ? _shipment!.weight.toString() : ""; + _noOfPackageEditingController.text = _shipment!.numberOfPackage.toString(); + _weightEditingController.text = _shipment!.weight.toString(); _pickupDate.text = dateFormatter.format(_shipment!.pickupDate ?? now); } @@ -362,7 +352,7 @@ class _ShipmentInfoState extends State { } List getBoxList(BuildContext context, List boxes) { - if (boxes == null) return []; + if (boxes.isEmpty) return []; return boxes.asMap().entries.map((_box) { return Row( children: [ diff --git a/lib/pages/shipment/shipment_list.dart b/lib/pages/shipment/shipment_list.dart index af047ab..b1b640a 100644 --- a/lib/pages/shipment/shipment_list.dart +++ b/lib/pages/shipment/shipment_list.dart @@ -1,7 +1,5 @@ import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/shipment/model/shipment_model.dart'; -import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/local_popup_menu_button.dart'; import 'package:fcs/pages/widgets/local_popupmenu.dart'; import 'package:fcs/pages/widgets/local_text.dart'; diff --git a/lib/pages/staff/staff_editor.dart b/lib/pages/staff/staff_editor.dart index 67197e0..6a31f78 100644 --- a/lib/pages/staff/staff_editor.dart +++ b/lib/pages/staff/staff_editor.dart @@ -276,7 +276,7 @@ class _StaffEditorState extends State { this.selectedUser = _user; this.user = _user; setState(() { - if (user.privileges != null) { + if (user.privileges.isNotEmpty) { privileges.forEach((p) => user.privileges.contains(p.id) ? p.isChecked = true : p.isChecked = false); diff --git a/lib/pages/term/term_edit.dart b/lib/pages/term/term_edit.dart index 750846d..1039dc9 100644 --- a/lib/pages/term/term_edit.dart +++ b/lib/pages/term/term_edit.dart @@ -1,14 +1,11 @@ -import 'dart:convert'; import 'package:fcs/domain/vo/term.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/pages/term/model/term_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; // import 'package:zefyrka/zefyrka.dart'; // import 'package:zefyr/zefyr.dart'; diff --git a/lib/pages/term/term_page.dart b/lib/pages/term/term_page.dart index 79a4778..d9db1c8 100644 --- a/lib/pages/term/term_page.dart +++ b/lib/pages/term/term_page.dart @@ -1,9 +1,7 @@ -import 'dart:convert'; import 'package:fcs/domain/entities/setting.dart'; import 'package:fcs/domain/vo/term.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/pages/main/model/language_model.dart'; import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/term/term_edit.dart'; import 'package:fcs/pages/widgets/local_text.dart'; @@ -24,14 +22,14 @@ class TermPage extends StatefulWidget { class _TermPageState extends State { // late ZefyrController _controller; - late FocusNode _focusNode; + // late FocusNode _focusNode; // late NotusDocument document = new NotusDocument(); bool isLoading = false; @override void initState() { super.initState(); - _focusNode = FocusNode(); + // _focusNode = FocusNode(); } // NotusDocument _loadDocument(Setting? setting) { diff --git a/lib/pages/widgets/badge.dart b/lib/pages/widgets/badge.dart index 2018b2f..80b5530 100644 --- a/lib/pages/widgets/badge.dart +++ b/lib/pages/widgets/badge.dart @@ -1,7 +1,7 @@ import 'package:fcs/helpers/theme.dart'; import 'package:flutter/material.dart'; -Widget badgeCounter(Widget child, int counter) { +Widget badgeCounter(Widget child, int? counter) { return Container( width: 120, child: new Stack( diff --git a/lib/pages/widgets/bottom_up_page_route.dart b/lib/pages/widgets/bottom_up_page_route.dart deleted file mode 100644 index 1f07ffc..0000000 --- a/lib/pages/widgets/bottom_up_page_route.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -class BottomUpPageRoute extends PageRouteBuilder { - final Widget child; - - BottomUpPageRoute(this.child) - : super( - pageBuilder: (context, animation, secondaryAnimation) => child, - transitionsBuilder: (context, animation, secondaryAnimation, child) { - var begin = Offset(0.0, 1.0); - var end = Offset.zero; - var curve = Curves.ease; - - var tween = - Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); - - return SlideTransition( - position: animation.drive(tween), - child: child, - ); - }, - ); -} diff --git a/lib/pages/widgets/bottom_widgets.dart b/lib/pages/widgets/bottom_widgets.dart index 067a134..515bad7 100644 --- a/lib/pages/widgets/bottom_widgets.dart +++ b/lib/pages/widgets/bottom_widgets.dart @@ -4,7 +4,6 @@ import 'package:fcs/pages/term/term_page.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; import 'package:provider/provider.dart'; diff --git a/lib/pages/widgets/defalut_delivery_address.dart b/lib/pages/widgets/defalut_delivery_address.dart index 3610701..1ccd543 100644 --- a/lib/pages/widgets/defalut_delivery_address.dart +++ b/lib/pages/widgets/defalut_delivery_address.dart @@ -1,7 +1,6 @@ import 'package:fcs/domain/vo/delivery_address.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/delivery_address/delivery_address_row.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; diff --git a/lib/pages/widgets/discount_dropdown.dart b/lib/pages/widgets/discount_dropdown.dart index 8f00fa7..7f9ce1a 100644 --- a/lib/pages/widgets/discount_dropdown.dart +++ b/lib/pages/widgets/discount_dropdown.dart @@ -1,6 +1,5 @@ import 'package:fcs/domain/entities/discount.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'local_text.dart'; diff --git a/lib/pages/widgets/display_text.dart b/lib/pages/widgets/display_text.dart index c8f8801..faeb06a 100644 --- a/lib/pages/widgets/display_text.dart +++ b/lib/pages/widgets/display_text.dart @@ -1,7 +1,6 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/main/model/language_model.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; diff --git a/lib/pages/widgets/img_picker.dart b/lib/pages/widgets/img_picker.dart index 43e2fb1..c99bd41 100644 --- a/lib/pages/widgets/img_picker.dart +++ b/lib/pages/widgets/img_picker.dart @@ -1,6 +1,4 @@ import 'dart:io'; - -import 'package:fcs/helpers/theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; diff --git a/lib/pages/widgets/input_date.dart b/lib/pages/widgets/input_date.dart index 4ee726a..ad88be5 100644 --- a/lib/pages/widgets/input_date.dart +++ b/lib/pages/widgets/input_date.dart @@ -1,14 +1,13 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/main/model/language_model.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; class InputDate extends StatelessWidget { - final String labelTextKey; - final IconData iconData; + final String? labelTextKey; + final IconData? iconData; final TextEditingController controller; final FormFieldValidator? validator; final int maxLines; @@ -44,7 +43,7 @@ class InputDate extends StatelessWidget { var dateFormatter = new DateFormat(dateFormatString); FocusScope.of(context).unfocus(); var initialDate = DateTime.now(); - if (controller != null) { + if (controller.text != "") { try { initialDate = dateFormatter.parse(controller.text); } catch (e) {} // ignore error @@ -55,7 +54,7 @@ class InputDate extends StatelessWidget { lastDate: DateTime(2025), initialDate: initialDate, ); - if (d != null && controller != null) { + if (d != null && controller.text != "") { controller.text = dateFormatter.format(d); } }, @@ -72,7 +71,7 @@ class InputDate extends StatelessWidget { ), labelText: labelTextKey == null ? null - : AppTranslations.of(context)!.text(labelTextKey), + : AppTranslations.of(context)!.text(labelTextKey!), labelStyle: languageModel.isEng ? newLabelStyle(color: Colors.black54, fontSize: 20) : newLabelStyleMM(color: Colors.black54, fontSize: 20), diff --git a/lib/pages/widgets/input_text.dart b/lib/pages/widgets/input_text.dart index 639d4b0..ca13218 100644 --- a/lib/pages/widgets/input_text.dart +++ b/lib/pages/widgets/input_text.dart @@ -1,7 +1,6 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/main/model/language_model.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; diff --git a/lib/pages/widgets/label_widgets.dart b/lib/pages/widgets/label_widgets.dart index 5358972..8410581 100644 --- a/lib/pages/widgets/label_widgets.dart +++ b/lib/pages/widgets/label_widgets.dart @@ -1,5 +1,4 @@ import 'package:fcs/helpers/theme.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'img_url.dart'; @@ -28,7 +27,7 @@ Widget labeledText(BuildContext context, String text, String label, padding: EdgeInsets.only(top: 10), // alignment: number ? Alignment.topRight : null, child: Text( - text == null ? "" : text, + text, style: textStyle, maxLines: 3, ), diff --git a/lib/pages/widgets/local_button.dart b/lib/pages/widgets/local_button.dart index f96c25e..00ca51f 100644 --- a/lib/pages/widgets/local_button.dart +++ b/lib/pages/widgets/local_button.dart @@ -1,6 +1,5 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/widgets/local_text.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'callbacks.dart'; diff --git a/lib/pages/widgets/local_popup_menu_button.dart b/lib/pages/widgets/local_popup_menu_button.dart index 8fa1e62..44facd4 100644 --- a/lib/pages/widgets/local_popup_menu_button.dart +++ b/lib/pages/widgets/local_popup_menu_button.dart @@ -122,7 +122,6 @@ class _LocalPopupMenuButtonState extends State { bool _needHighlight() { popmenus.forEach((e) { - if (e == null) return; if (e.selected && e.highlight) return; }); return false; diff --git a/lib/pages/widgets/local_radio_buttons.dart b/lib/pages/widgets/local_radio_buttons.dart index 11c72ad..01db508 100644 --- a/lib/pages/widgets/local_radio_buttons.dart +++ b/lib/pages/widgets/local_radio_buttons.dart @@ -1,5 +1,4 @@ import 'package:fcs/helpers/theme.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class LocalRadioButtons extends StatelessWidget { diff --git a/lib/pages/widgets/local_title.dart b/lib/pages/widgets/local_title.dart index 80397d3..55eb30f 100644 --- a/lib/pages/widgets/local_title.dart +++ b/lib/pages/widgets/local_title.dart @@ -1,6 +1,5 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/widgets/local_text.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class LocalTitle extends StatelessWidget { diff --git a/lib/pages/widgets/multi_img_controller.dart b/lib/pages/widgets/multi_img_controller.dart index ad0be39..c33bc8a 100644 --- a/lib/pages/widgets/multi_img_controller.dart +++ b/lib/pages/widgets/multi_img_controller.dart @@ -15,7 +15,7 @@ class MultiImgController { fileContainers = []; } - set setImageUrls(List imageUrls) { + set setImageUrls(List? imageUrls) { if (imageUrls == null) { return; } @@ -30,7 +30,7 @@ class MultiImgController { } } - set setImageFiles(List imageFiles) { + set setImageFiles(List? imageFiles) { if (imageFiles == null) { return; } diff --git a/lib/pages/widgets/my_data_table.dart b/lib/pages/widgets/my_data_table.dart index f44e089..d5b3179 100644 --- a/lib/pages/widgets/my_data_table.dart +++ b/lib/pages/widgets/my_data_table.dart @@ -1,9 +1,9 @@ +// ignore_for_file: unnecessary_null_comparison, dead_code + import 'dart:math' as math; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter/widgets.dart'; /// Signature for [MyDataColumn.onSort] callback. typedef MyDataColumnSortCallback = void Function( @@ -13,7 +13,7 @@ typedef MyDataColumnSortCallback = void Function( /// /// One column configuration must be provided for each column to /// display in the table. The list of [MyDataColumn] objects is passed -/// as the `columns` argument to the [new MyDataTable] constructor. +/// as the `columns` argument to the [MyDataTable.new] constructor. @immutable class MyDataColumn { /// Creates the configuration for a column of a [MyDataTable]. @@ -62,7 +62,7 @@ class MyDataColumn { /// /// One row configuration must be provided for each row to /// display in the table. The list of [MyDataRow] objects is passed -/// as the `rows` argument to the [new MyDataTable] constructor. +/// as the `rows` argument to the [MyDataTable.new] constructor. /// /// The data for this row of the table is provided in the [cells] /// property of the [MyDataRow] object. @@ -137,7 +137,7 @@ class MyDataRow { /// The data for a cell of a [MyDataTable]. /// /// One list of [MyDataCell] objects must be provided for each [MyDataRow] -/// in the [MyDataTable], in the [new MyDataRow] constructor's `cells` +/// in the [MyDataTable], in the [MyDataRow.new] constructor's `cells` /// argument. @immutable class MyDataCell { @@ -314,19 +314,18 @@ class MyDataTable extends StatelessWidget { this.sortColumnIndex, this.sortAscending = true, this.onSelectAll, - this.MyDataRowHeight = kMinInteractiveDimension, + this.myDataRowHeight = kMinInteractiveDimension, this.headingRowHeight = 56.0, this.horizontalMargin = 24.0, this.columnSpacing = 56.0, this.oddLine, this.evenLine, required this.rows, - }) : assert(columns != null), - assert(columns.isNotEmpty), + }) : assert(columns.isNotEmpty), assert(sortColumnIndex == null || (sortColumnIndex >= 0 && sortColumnIndex < columns.length)), assert(sortAscending != null), - assert(MyDataRowHeight != null), + assert(myDataRowHeight != null), assert(headingRowHeight != null), assert(horizontalMargin != null), assert(columnSpacing != null), @@ -382,7 +381,7 @@ class MyDataTable extends StatelessWidget { /// /// This value defaults to kMinInteractiveDimension to adhere to the Material /// Design specifications. - final double MyDataRowHeight; + final double myDataRowHeight; /// The height of the heading row. /// @@ -567,7 +566,7 @@ class MyDataTable extends StatelessWidget { } label = Container( padding: padding, - height: MyDataRowHeight, + height: myDataRowHeight, alignment: (numeric ?? false) ? Alignment.centerRight : AlignmentDirectional.centerStart, @@ -605,7 +604,6 @@ class MyDataTable extends StatelessWidget { Widget build(BuildContext context) { assert(!_debugInteractive || debugCheckHasMaterial(context)); - final ThemeData theme = Theme.of(context); final BoxDecoration _kSelectedDecoration = BoxDecoration( border: Border(bottom: Divider.createBorderSide(context, width: 1.0)), // The backgroundColor has to be transparent so you can see the ink on the material @@ -618,7 +616,6 @@ class MyDataTable extends StatelessWidget { ); final bool showCheckboxColumn = false; - final bool allChecked = false; final List tableColumns = (columns.length + (showCheckboxColumn ? 1 : 0)) as List; @@ -641,7 +638,7 @@ class MyDataTable extends StatelessWidget { int rowIndex; - int displayColumnIndex = 0; + int displayColumnIndex = 0; // if (showCheckboxColumn) { // tableColumns[0] = FixedColumnWidth( // horizontalMargin + Checkbox.width + horizontalMargin / 2.0); @@ -696,7 +693,7 @@ class MyDataTable extends StatelessWidget { } else { tableColumns[displayColumnIndex] = const IntrinsicColumnWidth(); } - tableRows[0].children![displayColumnIndex] = _buildHeadingCell( + tableRows[0].children[displayColumnIndex] = _buildHeadingCell( context: context, padding: padding, label: column.label, @@ -712,7 +709,7 @@ class MyDataTable extends StatelessWidget { rowIndex = 1; for (MyDataRow row in rows) { final MyDataCell cell = row.cells[MyDataColumnIndex]; - tableRows[rowIndex].children?[displayColumnIndex] = _buildMyDataCell( + tableRows[rowIndex].children[displayColumnIndex] = _buildMyDataCell( context: context, padding: padding, label: cell.child, @@ -780,13 +777,13 @@ class TableRowInkWell extends InkResponse { parentBox.applyPaintTransform(cell, transform); assert(table == cell.parent); cell = parentBox; - table = table?.parent; + table = table.parent; } if (table is RenderTable) { final TableCellParentData cellParentData = cell.parentData as TableCellParentData; assert(cellParentData.y != null); - final Rect rect = table .getRowBox(cellParentData.y!); + final Rect rect = table.getRowBox(cellParentData.y!); // The rect is in the table's coordinate space. We need to change it to the // TableRowInkWell's coordinate space. table.applyPaintTransform(cell, transform); diff --git a/lib/pages/widgets/number_cell.dart b/lib/pages/widgets/number_cell.dart index 9ec16c2..8012f2d 100644 --- a/lib/pages/widgets/number_cell.dart +++ b/lib/pages/widgets/number_cell.dart @@ -13,8 +13,7 @@ class NumberCell extends StatelessWidget { @override Widget build(BuildContext context) { - return new Text( - this.number == null ? '0' : numberFormatter.format(this.number), + return new Text(numberFormatter.format(this.number), style: textStyle == null ? theme.textStyle : textStyle); } } diff --git a/lib/pages/widgets/progress.dart b/lib/pages/widgets/progress.dart index df0c18d..0c04270 100644 --- a/lib/pages/widgets/progress.dart +++ b/lib/pages/widgets/progress.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:progress/progress.dart'; -import 'package:provider/provider.dart'; import 'package:fcs/helpers/theme.dart'; class LocalProgress extends Progress { diff --git a/lib/pages/widgets/status_tree.dart b/lib/pages/widgets/status_tree.dart index a01cb7e..30eef59 100644 --- a/lib/pages/widgets/status_tree.dart +++ b/lib/pages/widgets/status_tree.dart @@ -1,8 +1,6 @@ import 'package:fcs/domain/constants.dart'; -import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/vo/shipment_status.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart'; import 'package:intl/intl.dart'; diff --git a/lib/pages/widgets/task_button.dart b/lib/pages/widgets/task_button.dart index 638cc91..ed5674e 100644 --- a/lib/pages/widgets/task_button.dart +++ b/lib/pages/widgets/task_button.dart @@ -1,8 +1,6 @@ -import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/main/model/language_model.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; typedef BtnCallback(); diff --git a/lib/pages/widgets/title_with_add_button.dart b/lib/pages/widgets/title_with_add_button.dart index e988f4e..e22fb69 100644 --- a/lib/pages/widgets/title_with_add_button.dart +++ b/lib/pages/widgets/title_with_add_button.dart @@ -1,6 +1,5 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/widgets/local_text.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'callbacks.dart';