Merge branch 'master' of phyothandar/fcs into master

This commit is contained in:
2020-10-13 13:19:32 +00:00
committed by Gogs
5 changed files with 358 additions and 310 deletions

View File

@@ -358,7 +358,7 @@
"invoice.handling_fee":"Handling Fee", "invoice.handling_fee":"Handling Fee",
"invoice.custom_fee":"Custom Fee", "invoice.custom_fee":"Custom Fee",
"invoice.custom_fee_desc":"Custom Fee Description", "invoice.custom_fee_desc":"Custom Fee Description",
"invoice.discount":"Discounts", "invoice.discount":"Discount Code",
"invoice.payment_method":"Payment Method", "invoice.payment_method":"Payment Method",
"invoice.delivery_fee":"Delivery Fee : ", "invoice.delivery_fee":"Delivery Fee : ",
"invoice.payment_attachment":"Payment Attachment", "invoice.payment_attachment":"Payment Attachment",
@@ -368,6 +368,14 @@
"invoice.btn_save":"Save Invoice", "invoice.btn_save":"Save Invoice",
"invoice.btn_payment_receipt":"Attachment Payment Receipt", "invoice.btn_payment_receipt":"Attachment Payment Receipt",
"invoice.description": "Description", "invoice.description": "Description",
"invoice.box.cargo_type": "Cargo Types",
"invoice.cargo_type":"Cargo Types",
"invoice.box.number":"Box number",
"invoice.box.length":"Length",
"invoice.box.width":"Width",
"invoice.boc.height":"Height",
"invoice.discount_value": "Discount",
"invoice.net_amount":"Net Amount",
"Invoices End ================================================================":"", "Invoices End ================================================================":"",
"Discount Start ================================================================":"", "Discount Start ================================================================":"",

View File

@@ -358,7 +358,7 @@
"invoice.handling_fee":"ထိန်းသိမ်းခ", "invoice.handling_fee":"ထိန်းသိမ်းခ",
"invoice.custom_fee":"ကုန်သွယ်ခွန်", "invoice.custom_fee":"ကုန်သွယ်ခွန်",
"invoice.custom_fee_desc":"ကုန်သွယ်ခွန်အကြောင်းအရာ", "invoice.custom_fee_desc":"ကုန်သွယ်ခွန်အကြောင်းအရာ",
"invoice.discount":"လျှော့စျေး : ", "invoice.discount":"လျှော့စျေးကုဒ်",
"invoice.payment_method":"ငွေပေးချေစနစ်", "invoice.payment_method":"ငွေပေးချေစနစ်",
"invoice.delivery_fee":"ပို့ဆောင်ခ", "invoice.delivery_fee":"ပို့ဆောင်ခ",
"invoice.payment_attachment":"ပေးချေပြီးဖိုင်များ", "invoice.payment_attachment":"ပေးချေပြီးဖိုင်များ",
@@ -367,7 +367,15 @@
"invoice.btn_create":"ငွေတောင်းခံလွှာ ပြုလုပ်ရန်", "invoice.btn_create":"ငွေတောင်းခံလွှာ ပြုလုပ်ရန်",
"invoice.btn_save":"ငွေတောင်းခံလွှာ သိမ်းရန်", "invoice.btn_save":"ငွေတောင်းခံလွှာ သိမ်းရန်",
"invoice.btn_payment_receipt":"ငွေလက်ခံဖြတ်ပိုင်း ထည့်ရန်", "invoice.btn_payment_receipt":"ငွေလက်ခံဖြတ်ပိုင်း ထည့်ရန်",
"invoice.description": "အကြောင်းအရာ", "invoice.box.cargo_type": "ကုန်ပစ္စည်းအမျိုးအစားများ",
"invoice.description": "ငွေတောင်းခံလွှာအကြောင်းအရာ",
"invoice.cargo_type":"Cargo Types",
"invoice.box.number":"Box နံပါတ်",
"invoice.box.length":"အလျား",
"invoice.box.width":"အနံ",
"invoice.box.height":"အမြင့်",
"invoice.discount_value": "လျှော့စျေး",
"invoice.net_amount":"Net Amount",
"Invoices End ================================================================":"", "Invoices End ================================================================":"",
"Discount Start ================================================================":"", "Discount Start ================================================================":"",

View File

@@ -10,10 +10,13 @@ import 'package:fcs/pages/discount/model/discount_model.dart';
import 'package:fcs/pages/main/model/language_model.dart'; import 'package:fcs/pages/main/model/language_model.dart';
import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/main/model/main_model.dart';
import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/payment_methods/model/payment_method_model.dart';
import 'package:fcs/pages/user_search/user_serach.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/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/discount_dropdown.dart';
import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/display_text.dart';
import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/input_text.dart';
import 'package:fcs/pages/widgets/local_dropdown.dart';
import 'package:fcs/pages/widgets/local_text.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_controller.dart';
import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart';
@@ -38,29 +41,6 @@ class InvoiceEditor extends StatefulWidget {
class _InvoiceEditorState extends State<InvoiceEditor> { class _InvoiceEditorState extends State<InvoiceEditor> {
User user; User user;
List<PaymentMethod> get paymentMethods {
List<PaymentMethod> methods = [
PaymentMethod(
name: 'AYA Bank',
accountName: 'FCS',
account: '100 23404320548398',
phone: '+959123456789',
),
PaymentMethod(
name: 'KBZ Bank',
accountName: 'FCS',
account: '100 23404320548398',
phone: '+959123456789',
),
PaymentMethod(
name: 'PayPal',
accountName: 'FCS',
link: 'https://www.paypal.com/donate/buttons',
),
];
return methods;
}
var dateFormatter = new DateFormat('dd MMM yyyy'); var dateFormatter = new DateFormat('dd MMM yyyy');
TextEditingController _invoiceNumberController = new TextEditingController(); TextEditingController _invoiceNumberController = new TextEditingController();
TextEditingController _dateController = new TextEditingController(); TextEditingController _dateController = new TextEditingController();
@@ -83,6 +63,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
int customFee = 10; int customFee = 10;
double total = 0; double total = 0;
Discount _discount; Discount _discount;
bool isNew = false;
Discount selectedDiscount;
int selectedDiscountAmt;
PaymentMethod paymentMethod;
List<Box> selectedBoxes = []; List<Box> selectedBoxes = [];
@@ -122,6 +106,9 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
_customFeeController.text = '0'; _customFeeController.text = '0';
_descriptionController.text = ''; _descriptionController.text = '';
_balanceController.text = '0'; _balanceController.text = '0';
setState(() {
isNew = true;
});
} }
_boxes = [ _boxes = [
@@ -181,7 +168,19 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var mainModel = Provider.of<MainModel>(context); var mainModel = Provider.of<MainModel>(context);
var discountModel = Provider.of<DiscountModel>(context); var discountModel = Provider.of<DiscountModel>(context);
var languageModel = Provider.of<LanguageModel>(context); var paymentMethodModel = Provider.of<PaymentMethodModel>(context);
final discountBox = Container(
child: DiscountDropdown<Discount>(
callback: (v) {
setState(() {
selectedDiscount = v;
});
},
iconData: Entypo.price_ribbon,
selectedValue: selectedDiscount,
values: discountModel.discounts,
));
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
@@ -214,13 +213,12 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
labelTextKey: 'invoice.number', labelTextKey: 'invoice.number',
iconData: FontAwesomeIcons.fileInvoice, iconData: FontAwesomeIcons.fileInvoice,
text: _invoiceNumberController.text), text: _invoiceNumberController.text),
widget.invoice == null widget.invoice == null
? Row( ? Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: DisplayText( child: DisplayText(
text: user != null ? user.name : "Myo Min", text: user != null ? user.name : "",
labelTextKey: "invoice.customer_name", labelTextKey: "invoice.customer_name",
iconData: Feather.user, iconData: Feather.user,
)), )),
@@ -238,21 +236,37 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
text: _nameController.text, text: _nameController.text,
iconData: Feather.user, iconData: Feather.user,
labelTextKey: 'invoice.customer_name'), labelTextKey: 'invoice.customer_name'),
InputText(
controller: _handlingFeeController,
iconData: FontAwesomeIcons.moneyBill,
labelTextKey: 'invoice.handling_fee'),
SizedBox(height: 15),
discountBox,
widget.invoice == null widget.invoice == null
? Container() ? Container()
: DisplayText( : DisplayText(
text: _statusController.text, text: _statusController.text,
iconData: Icons.av_timer, iconData: Icons.av_timer,
labelTextKey: 'invoice.status'), labelTextKey: 'invoice.status'),
SizedBox(height: 30),
SizedBox(height: 15),
LocalText(context, 'invoice.box_info',
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 16.0),
Container( Container(
child: Row(
children: [
Icon(MaterialCommunityIcons.package,
color: primaryColor),
SizedBox(width: 10),
LocalText(
context,
"invoice.box_info",
color: Colors.grey,
fontSize: 20,
fontWeight: FontWeight.w700,
),
],
),
),
Container(
padding: const EdgeInsets.only(top: 15),
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: MyDataTable( child: MyDataTable(
@@ -265,17 +279,17 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
MyDataColumn( MyDataColumn(
label: LocalText( label: LocalText(
context, context,
"box.number", "invoice.box.number",
color: Colors.grey, color: Colors.grey,
), ),
), ),
MyDataColumn( MyDataColumn(
label: Text( label: Text(
getLocalString(context, "box.length") + getLocalString(context, "invoice.box.length") +
' x ' + ' x ' +
getLocalString(context, "box.width") + getLocalString(context, "invoice.box.width") +
' x ' + ' x ' +
getLocalString(context, "box.height"), getLocalString(context, "invoice.box.height"),
), ),
), ),
], ],
@@ -283,24 +297,28 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
), ),
), ),
), ),
SizedBox(height: 40),
SizedBox(height: 25),
Divider(thickness: 1),
SizedBox(height: 15),
Container( Container(
child: Row(
children: [
Icon(MaterialCommunityIcons.briefcase_check,
color: primaryColor),
SizedBox(width: 10),
LocalText(
context,
"invoice.cargo_type",
color: Colors.grey,
fontSize: 20,
fontWeight: FontWeight.w700,
),
],
),
),
Container(
padding: const EdgeInsets.only(top: 10),
child: Column(children: getCargoTableByBox(context)), child: Column(children: getCargoTableByBox(context)),
), ),
SizedBox(height: 20),
Divider(thickness: 1),
// InputText(
// controller: _handlingFeeController,
// iconData: FontAwesomeIcons.moneyBill,
// labelTextKey: 'invoice.handling_fee'),
Container( Container(
padding: EdgeInsets.only(top: 5, left: 18), padding: EdgeInsets.only(top: 5, left: 18),
child: Row( child: Row(
@@ -308,12 +326,15 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
Expanded( Expanded(
child: LocalText(context, 'invoice.payment_method', child: LocalText(context, 'invoice.payment_method',
fontSize: 16, fontSize: 16,
color: primaryColor, color: Colors.grey,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold),
),
Container( Container(
width: 150.0, width: 150.0,
child: DropdownButtonFormField( child: DropdownButtonFormField(
items: paymentMethods icon: Icon(Icons.edit),
value: paymentMethod,
items: paymentMethodModel.paymentMethods
.map((e) => DropdownMenuItem( .map((e) => DropdownMenuItem(
child: Text(e.name), value: e.name)) child: Text(e.name), value: e.name))
.toList(), .toList(),
@@ -323,97 +344,31 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
], ],
), ),
), ),
// Container( SizedBox(height: 30),
// padding: EdgeInsets.only(top: 5), !isNew
// child: Row( ? Row(
// children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
// Expanded( children: [
// child: Padding( Container(
// padding: const EdgeInsets.only(left: 18.0), child: Row(
// child: LocalText(context, 'invoice.delivery_fee', children: [
// fontSize: 16, Icon(Icons.receipt, color: primaryColor),
// color: primaryColor, SizedBox(width: 10),
// fontWeight: FontWeight.bold), LocalText(
// )), context,
// Switch( "invoice.payment_attachment",
// value: isSwitched, color: Colors.grey,
// onChanged: (value) { fontSize: 20,
// setState(() { fontWeight: FontWeight.w700,
// isSwitched = value; ),
// if (value) { ],
// deliveryfee = 5; ),
// } else { ),
// deliveryfee = 0; Spacer(),
// } Icon(Icons.add, color: primaryColor),
// print(isSwitched); ],
// }); )
// }, : Container()
// activeTrackColor: primaryColor.withOpacity(0.8),
// activeColor: primaryColor,
// ),
// Text(
// '(' +
// getLocalString(context, 'invoice.delivery_fee') +
// ' $deliveryfee)',
// style: TextStyle(
// color: primaryColor,
// fontWeight: FontWeight.bold,
// fontSize: 12),
// ),
// ],
// ),
// ),
// SizedBox(
// height: 10,
// ),
// ExpansionTile(
// title: LocalText(context, 'invoice.payment_attachment',
// color: primaryColor,
// fontWeight: FontWeight.bold,
// fontSize: 16.0),
// children: <Widget>[
// widget.invoice != null
// ? Padding(
// padding: EdgeInsets.only(left: 20),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
// Container(
// padding: EdgeInsets.only(top: 10),
// child: Text(
// '${dateFormatter.format(_invoice.receipts[0].date)} ',
// style: TextStyle(
// color: Colors.black, fontSize: 16),
// ),
// ),
// Expanded(
// child: Container(
// padding: EdgeInsets.only(left: 10),
// child: MultiImageFile(
// enabled: false,
// controller: multiImgController,
// title: "Receipt",
// )),
// ),
// Container(
// padding: EdgeInsets.only(top: 10, left: 10),
// child: Text(
// '\$${_invoice.receipts[0].amount} ',
// style: TextStyle(
// color: Colors.black, fontSize: 16),
// ),
// ),
// ],
// ),
// )
// : Container(),
// SizedBox(
// height: 25,
// ),
// ],
// ),
]), ]),
)), )),
widget.invoice == null widget.invoice == null
@@ -428,7 +383,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
getLocalString(context, 'invoice.btn_save')) getLocalString(context, 'invoice.btn_save'))
], ],
)), )),
widget.invoice == null isNew
? Container() ? Container()
: fcsButton(context, : fcsButton(context,
getLocalString(context, 'invoice.btn_payment_receipt')) getLocalString(context, 'invoice.btn_payment_receipt'))
@@ -441,13 +396,15 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
getCargoTableByBox(BuildContext context) { getCargoTableByBox(BuildContext context) {
var discountModel = Provider.of<DiscountModel>(context); var discountModel = Provider.of<DiscountModel>(context);
total = 0;
List<Widget> dataRow = _cargoTypes.map((cargo) { List<Widget> dataRow = _cargoTypes.map((cargo) {
var amount = cargo.weight * cargo.price; var amount = cargo.weight * cargo.price;
total += amount; total += amount;
return Container( return Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.grey))),
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
child: Row( child: Row(
children: [ children: [
Expanded(flex: 2, child: Text('${cargo.type}')), Expanded(flex: 2, child: Text('${cargo.type}')),
@@ -469,16 +426,19 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
dataRow.insert( dataRow.insert(
0, 0,
Container( Container(
padding: const EdgeInsets.all(5.0), padding: const EdgeInsets.only(
left: 5.0, right: 5.0, top: 15.0, bottom: 15.0),
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.grey))),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
flex: 2, flex: 2,
child: Text(getLocalString(context, 'invoice.description'), child: Text(getLocalString(context, 'invoice.box.cargo_type'),
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: primaryColor))), color: Colors.grey))),
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
@@ -489,17 +449,18 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: primaryColor))), color: Colors.grey))),
Expanded( Expanded(
child: Text(getLocalString(context, 'invoice.amount'), child: Text(getLocalString(context, 'invoice.amount'),
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: primaryColor))) color: Colors.grey)))
], ],
), ),
)); ));
dataRow.insert( dataRow.insert(
dataRow.length, dataRow.length,
Container( Container(
@@ -509,23 +470,37 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
children: [ children: [
Expanded( Expanded(
flex: 2, flex: 2,
child: Text(getLocalString(context, 'invoice.discount'))), child: Center(
child: LocalText(
context,
'invoice.total',
color: Colors.black,
),
),
),
Expanded( Expanded(
child: Container( child: Text(
width: 80.0, '\$ $total',
child: DropdownButtonFormField( style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
items: discountModel.discounts textAlign: TextAlign.end,
.map((e) => DropdownMenuItem( ))
child: Text(e.code, style: TextStyle(fontSize: 13)), ],
value: e.code)) ),
.toList(), ));
onChanged: (selected) {
var d = discountModel.discounts dataRow.insert(
.firstWhere((d) => d.code == selected); dataRow.length,
setState(() { Container(
_discount = d; padding: const EdgeInsets.only(left: 5.0, right: 5.0, top: 10),
}); child: Row(
}, children: [
Expanded(
flex: 2,
child: Center(
child: LocalText(
context,
'invoice.discount_value',
color: Colors.black,
), ),
), ),
), ),
@@ -545,23 +520,18 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
dataRow.length, dataRow.length,
Container( Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), left: 5.0, right: 5.0, top: 20.0, bottom: 0.0),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
flex: 2, flex: 2,
child: Text(getLocalString(context, 'invoice.custom_fee'))), child: Center(
// Expanded( child: LocalText(
// child: Text( context,
// '', 'invoice.custom_fee',
// )), color: Colors.black,
// Container( ),
// width: 100, )),
// child: InputText(
// controller: _customFeeController,
// iconData: null,
// labelTextKey: 'invoice.custom_fee'),
// ),
Expanded( Expanded(
child: Text('\$ ${customFee}', child: Text('\$ ${customFee}',
textAlign: TextAlign.end, textAlign: TextAlign.end,
@@ -582,8 +552,15 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
flex: 2, flex: 1,
child: Text(getLocalString(context, 'invoice.delivery_fee'))), child: Container(
alignment: Alignment.centerRight,
child: LocalText(
context,
'invoice.delivery_fee',
color: Colors.black,
),
)),
Switch( Switch(
value: isSwitched, value: isSwitched,
onChanged: (value) { onChanged: (value) {
@@ -610,6 +587,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
], ],
), ),
)); ));
dataRow.insert( dataRow.insert(
dataRow.length, dataRow.length,
Container( Container(
@@ -623,6 +601,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
)), )),
], ],
))); )));
dataRow.insert( dataRow.insert(
dataRow.length, dataRow.length,
Container( Container(
@@ -630,21 +609,25 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
child: Row( child: Row(
children: [ children: [
Expanded(flex: 1, child: Text('')),
Expanded( Expanded(
flex: 2, flex: 2,
child: Center(
child: LocalText( child: LocalText(
context, context,
'invoice.total', 'invoice.net_amount',
color: Colors.black, color: Colors.black,
fontSize: 15,
fontWeight: FontWeight.bold,
),
), ),
), ),
Expanded( Expanded(
child: Text( child: Text('\$ ${getTotalBalance(total)}',
'\$ $total',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
textAlign: TextAlign.end, textAlign: TextAlign.end,
)) style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: primaryColor)))
], ],
), ),
)); ));
@@ -656,13 +639,16 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), left: 5.0, right: 5.0, top: 10.0, bottom: 10.0),
child: Row( child: Row(
children: [ children: [
Expanded(flex: 1, child: Text('')),
Expanded( Expanded(
flex: 2, flex: 2,
child: Center(
child: LocalText( child: LocalText(
context, context,
'invoice.balance', 'invoice.balance',
color: Colors.black, color: Colors.black,
fontSize: 15,
fontWeight: FontWeight.bold,
),
), ),
), ),
Expanded( Expanded(
@@ -690,13 +676,11 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
List<MyDataRow> getBoxRow(BuildContext context) { List<MyDataRow> getBoxRow(BuildContext context) {
return _boxes.map((p) { return _boxes.map((p) {
p.cargoTypes.map((cargo) { p.cargoTypes.map((cargo) {
print('cargo => $cargo');
_cargoTypes.asMap().map((index, _cargo) { _cargoTypes.asMap().map((index, _cargo) {
if (_cargo.type == cargo.type) { if (_cargo.type == cargo.type) {
setState(() { setState(() {
_cargoTypes[index].weight += cargo.weight; _cargoTypes[index].weight += cargo.weight;
}); });
print('${_cargoTypes[index].type} =>${_cargoTypes[index]}');
} }
}); });
}); });

View File

@@ -72,12 +72,10 @@ class _PaymentPageState extends State<PaymentPage> {
backgroundColor: primaryColor, backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("pm_.title")), title: Text(AppTranslations.of(context).text("pm_.title")),
), ),
body: Card( body: ListView(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: Container( children: <Widget>[
Container(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
LocalText(context, 'pm.total.amount', LocalText(context, 'pm.total.amount',
@@ -91,10 +89,8 @@ class _PaymentPageState extends State<PaymentPage> {
) )
], ],
)), )),
), Container(
Padding( padding: const EdgeInsets.only(top: 15.0),
padding: const EdgeInsets.all(15.0),
child: Container(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
LocalText(context, 'pm.remaining_balance', LocalText(context, 'pm.remaining_balance',
@@ -108,16 +104,13 @@ class _PaymentPageState extends State<PaymentPage> {
) )
], ],
)), )),
), SizedBox(height: 10),
Expanded( Divider(),
child: ListView( SizedBox(height: 10),
children: [ LocalText(context, 'pm.attachment',
ExpansionTile( color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold),
title: LocalText(context, 'pm.attachment',
color: Colors.black, fontSize: 16),
children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only(left: 20), padding: EdgeInsets.only(left: 20, top: 10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -126,8 +119,7 @@ class _PaymentPageState extends State<PaymentPage> {
padding: EdgeInsets.only(top: 8), padding: EdgeInsets.only(top: 8),
child: Text( child: Text(
'${dateFormatter.format(_invoice.receipts[0].date)} ', '${dateFormatter.format(_invoice.receipts[0].date)} ',
style: TextStyle( style: TextStyle(color: Colors.black, fontSize: 16),
color: Colors.black, fontSize: 16),
), ),
), ),
Expanded( Expanded(
@@ -142,18 +134,12 @@ class _PaymentPageState extends State<PaymentPage> {
], ],
), ),
), ),
SizedBox( SizedBox(height: 25),
height: 25, Divider(),
), SizedBox(height: 10),
], LocalText(context, 'pm.receipt',
), color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold),
ExpansionTile(
title: LocalText(context, 'pm.receipt',
color: Colors.black, fontSize: 16),
children: <Widget>[
Container( Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable( child: MyDataTable(
headingRowHeight: 40, headingRowHeight: 40,
columnSpacing: 20, columnSpacing: 20,
@@ -176,18 +162,11 @@ class _PaymentPageState extends State<PaymentPage> {
rows: getPackageRow(context), rows: getPackageRow(context),
), ),
), ),
),
SizedBox(height: 25), SizedBox(height: 25),
// saveBox,
// SizedBox(height: 10),
], ],
), ),
],
),
),
saveBox,
SizedBox(height: 10),
],
),
),
), ),
); );
} }

View File

@@ -0,0 +1,69 @@
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';
class DiscountDropdown<T> extends StatelessWidget {
final Function(T) callback;
final IconData iconData;
final T selectedValue;
final List<T> values;
const DiscountDropdown(
{Key key, this.callback, this.iconData, this.selectedValue, this.values})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 5.0, right: 0),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 0, right: 10),
child: Icon(iconData, color: primaryColor),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(right: 18.0),
child: LocalText(
context,
"invoice.discount",
color: Colors.black54,
fontSize: 16,
),
),
DropdownButton<T>(
isDense: true,
value: selectedValue,
style: TextStyle(color: Colors.black, fontSize: 14),
underline: Container(
height: 1,
color: primaryColor,
),
onChanged: (T newValue) {
callback(newValue);
},
isExpanded: true,
items: values.map<DropdownMenuItem<T>>((T value) {
return DropdownMenuItem<T>(
value: value,
child: Text(value == null ? "" : (value as Discount).code,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: primaryColor)),
);
}).toList(),
),
],
),
),
],
),
);
}
}