cleanup code
This commit is contained in:
@@ -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<BoxAddition> {
|
||||
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<CartonModel>(context);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: unnecessary_null_comparison
|
||||
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/carton.dart';
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
@@ -81,7 +83,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
await _loadCartons();
|
||||
await _loadShipments();
|
||||
await _loadDiscount();
|
||||
} catch (e) {} finally {
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
@@ -118,7 +121,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
DiscountModel discountModel =
|
||||
Provider.of<DiscountModel>(context, listen: false);
|
||||
discounts = (await discountModel.getDiscount(widget.customer!.id!))!;
|
||||
if (discounts != null && discounts.length > 0) {
|
||||
if (discounts.isNotEmpty) {
|
||||
setState(() {
|
||||
_invoice!.discount = discounts.first;
|
||||
});
|
||||
@@ -257,7 +260,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
InvoiceHandlingFeeList(shipments: _invoice!.shipments)));
|
||||
_addShipment(shipment);
|
||||
} else if (p.id == 3) {
|
||||
Discount discount =
|
||||
Discount? discount =
|
||||
await Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => InvoiceDiscountList(
|
||||
discounts: discounts,
|
||||
@@ -412,7 +415,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
|
||||
showMsgDialog(context, "Error", "Expected at least one cargo type");
|
||||
return;
|
||||
}
|
||||
if ((amount ) <= 0) {
|
||||
if ((amount) <= 0) {
|
||||
showMsgDialog(context, "Error", "Expected positive amount");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<PaymentPageEdit> {
|
||||
TextEditingController _amountController = new TextEditingController();
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
|
||||
Receipt _receipt = new Receipt();
|
||||
@@ -72,11 +68,11 @@ class _PaymentPageEditState extends State<PaymentPageEdit> {
|
||||
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'));
|
||||
|
||||
Reference in New Issue
Block a user