update invoice

This commit is contained in:
PhyoThandar
2020-10-16 21:38:39 +06:30
parent ad7d0039fc
commit 274c999959
18 changed files with 658 additions and 398 deletions

View File

@@ -36,11 +36,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import 'box_addition.dart';
class InvoiceInfoPage extends StatefulWidget {
final Invoice invoice;
InvoiceInfoPage({this.invoice});
final User customer;
InvoiceInfoPage({this.invoice, this.customer});
@override
_InvoiceInfoPageState createState() => _InvoiceInfoPageState();
@@ -57,7 +56,6 @@ class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
TextEditingController _discountController = new TextEditingController();
TextEditingController _amountController = new TextEditingController();
TextEditingController _statusController = new TextEditingController();
TextEditingController _handlingFeeController = new TextEditingController();
TextEditingController _customFeeController = new TextEditingController();
MultiImgController multiImgController = MultiImgController();
TextEditingController _descriptionController = new TextEditingController();
@@ -106,7 +104,6 @@ class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
// _amountController.text = _invoice.getAmount.toString();
_amountController.text = _invoice.amount.toString();
_statusController.text = _invoice.status.toString();
_handlingFeeController.text = '0';
_customFeeController.text = '0';
// multiImgController.setImageUrls = _receipts;
_descriptionController.text = 'For Electronics goods';
@@ -116,7 +113,6 @@ class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
} else {
_dateController.text = dateFormatter.format(DateTime.now());
_amountController.text = '0';
_handlingFeeController.text = '0';
_customFeeController.text = '0';
_descriptionController.text = '';
_balanceController.text = '0';
@@ -180,31 +176,15 @@ class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
@override
Widget build(BuildContext context) {
var mainModel = Provider.of<MainModel>(context);
var discountModel = Provider.of<DiscountModel>(context);
var paymentMethodModel = Provider.of<PaymentMethodModel>(context);
final nameBox = DisplayText(
iconData: Feather.user,
labelTextKey: 'invoice.customer_name',
text: user != null ? user.name : '');
text: user != null ? user.name : 'Ko Nyi');
final fcsIDBox = Row(
children: <Widget>[
Expanded(
child: DisplayText(
text: user != null ? user.fcsID : "",
labelTextKey: "box.fcs.id",
icon: FcsIDIcon(),
)),
IconButton(
icon: Icon(Icons.search, color: primaryColor),
onPressed: () => searchUser(context, callbackUserSelect: (u) {
setState(() {
this.user = u;
});
})),
],
final fcsIDBox = DisplayText(
text: user != null ? user.fcsID : "FCS-KRUTUG",
labelTextKey: "box.fcs.id",
icon: FcsIDIcon(),
);
final statusBox = DisplayText(
@@ -309,9 +289,17 @@ class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0),
child: Row(
children: [
Expanded(flex: 2, child: Text(box.packageNumber)),
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(box.packageNumber),
Text(box.shipmentNumber),
],
)),
Expanded(
flex: 2,
child: Text(
box.length == null
? ""
@@ -341,22 +329,27 @@ class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
child: Row(
children: [
Expanded(
flex: 2,
child: LocalText(
context,
"invoice.box.number",
color: Colors.grey,
flex: 1,
child: Center(
child: LocalText(
context,
"invoice.box.number",
color: Colors.grey,
),
)),
Expanded(
flex: 1,
child:
Text('L x W x H', style: TextStyle(color: Colors.grey))),
flex: 2,
child: Center(
child: Text('L x W x H',
style: TextStyle(color: Colors.grey)))),
Expanded(
flex: 2,
child: LocalText(
context,
"invoice.shipment_weight",
color: Colors.grey,
child: Center(
child: LocalText(
context,
"invoice.shipment_weight",
color: Colors.grey,
),
)),
],
),
@@ -596,7 +589,7 @@ class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
dataRow.length,
Container(
padding: const EdgeInsets.only(
left: 5.0, right: 5.0, top: 20.0, bottom: 0.0),
left: 5.0, right: 5.0, top: 20.0, bottom: 5.0),
child: Row(
children: [
Expanded(
@@ -609,7 +602,7 @@ class _InvoiceInfoPageState extends State<InvoiceInfoPage> {
),
)),
Expanded(
child: Text('\$ $customFee',
child: Text('\$ 10.0',
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 15,