diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index 50dd6d6..850babd 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -358,7 +358,7 @@ "invoice.handling_fee":"Handling Fee", "invoice.custom_fee":"Custom Fee", "invoice.custom_fee_desc":"Custom Fee Description", - "invoice.discount":"Discounts", + "invoice.discount":"Discount Code", "invoice.payment_method":"Payment Method", "invoice.delivery_fee":"Delivery Fee : ", "invoice.payment_attachment":"Payment Attachment", @@ -368,6 +368,14 @@ "invoice.btn_save":"Save Invoice", "invoice.btn_payment_receipt":"Attachment Payment Receipt", "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 ================================================================":"", "Discount Start ================================================================":"", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index a947745..f9c49f6 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -358,7 +358,7 @@ "invoice.handling_fee":"ထိန်းသိမ်းခ", "invoice.custom_fee":"ကုန်သွယ်ခွန်", "invoice.custom_fee_desc":"ကုန်သွယ်ခွန်အကြောင်းအရာ", - "invoice.discount":"လျှော့စျေး : ", + "invoice.discount":"လျှော့စျေးကုဒ်", "invoice.payment_method":"ငွေပေးချေစနစ်", "invoice.delivery_fee":"ပို့ဆောင်ခ", "invoice.payment_attachment":"ပေးချေပြီးဖိုင်များ", @@ -367,7 +367,15 @@ "invoice.btn_create":"ငွေတောင်းခံလွှာ ပြုလုပ်ရန်", "invoice.btn_save":"ငွေတောင်းခံလွှာ သိမ်းရန်", "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 ================================================================":"", "Discount Start ================================================================":"", diff --git a/lib/pages/invoice/invoice_editor.dart b/lib/pages/invoice/invoice_editor.dart index 63aa5dc..c8adcf2 100644 --- a/lib/pages/invoice/invoice_editor.dart +++ b/lib/pages/invoice/invoice_editor.dart @@ -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/main_model.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/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/input_text.dart'; +import 'package:fcs/pages/widgets/local_dropdown.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'; @@ -38,29 +41,6 @@ class InvoiceEditor extends StatefulWidget { class _InvoiceEditorState extends State { User user; - List get paymentMethods { - List 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'); TextEditingController _invoiceNumberController = new TextEditingController(); TextEditingController _dateController = new TextEditingController(); @@ -83,6 +63,10 @@ class _InvoiceEditorState extends State { int customFee = 10; double total = 0; Discount _discount; + bool isNew = false; + Discount selectedDiscount; + int selectedDiscountAmt; + PaymentMethod paymentMethod; List selectedBoxes = []; @@ -122,6 +106,9 @@ class _InvoiceEditorState extends State { _customFeeController.text = '0'; _descriptionController.text = ''; _balanceController.text = '0'; + setState(() { + isNew = true; + }); } _boxes = [ @@ -181,7 +168,19 @@ class _InvoiceEditorState extends State { Widget build(BuildContext context) { var mainModel = Provider.of(context); var discountModel = Provider.of(context); - var languageModel = Provider.of(context); + var paymentMethodModel = Provider.of(context); + + final discountBox = Container( + child: DiscountDropdown( + callback: (v) { + setState(() { + selectedDiscount = v; + }); + }, + iconData: Entypo.price_ribbon, + selectedValue: selectedDiscount, + values: discountModel.discounts, + )); return LocalProgress( inAsyncCall: _isLoading, @@ -214,13 +213,12 @@ class _InvoiceEditorState extends State { labelTextKey: 'invoice.number', iconData: FontAwesomeIcons.fileInvoice, text: _invoiceNumberController.text), - widget.invoice == null ? Row( children: [ Expanded( child: DisplayText( - text: user != null ? user.name : "Myo Min", + text: user != null ? user.name : "", labelTextKey: "invoice.customer_name", iconData: Feather.user, )), @@ -238,21 +236,37 @@ class _InvoiceEditorState extends State { text: _nameController.text, iconData: Feather.user, labelTextKey: 'invoice.customer_name'), - + InputText( + controller: _handlingFeeController, + iconData: FontAwesomeIcons.moneyBill, + labelTextKey: 'invoice.handling_fee'), + SizedBox(height: 15), + discountBox, widget.invoice == null ? Container() : DisplayText( text: _statusController.text, iconData: Icons.av_timer, labelTextKey: 'invoice.status'), - - SizedBox(height: 15), - - LocalText(context, 'invoice.box_info', - color: primaryColor, - fontWeight: FontWeight.bold, - fontSize: 16.0), + SizedBox(height: 30), 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( scrollDirection: Axis.horizontal, child: MyDataTable( @@ -265,17 +279,17 @@ class _InvoiceEditorState extends State { MyDataColumn( label: LocalText( context, - "box.number", + "invoice.box.number", color: Colors.grey, ), ), MyDataColumn( label: Text( - getLocalString(context, "box.length") + + getLocalString(context, "invoice.box.length") + ' x ' + - getLocalString(context, "box.width") + + getLocalString(context, "invoice.box.width") + ' x ' + - getLocalString(context, "box.height"), + getLocalString(context, "invoice.box.height"), ), ), ], @@ -283,37 +297,44 @@ class _InvoiceEditorState extends State { ), ), ), - - SizedBox(height: 25), - - Divider(thickness: 1), - - SizedBox(height: 15), - + SizedBox(height: 40), 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)), ), - - Divider(thickness: 1), - - // InputText( - // controller: _handlingFeeController, - // iconData: FontAwesomeIcons.moneyBill, - // labelTextKey: 'invoice.handling_fee'), - + SizedBox(height: 20), Container( padding: EdgeInsets.only(top: 5, left: 18), child: Row( children: [ Expanded( - child: LocalText(context, 'invoice.payment_method', - fontSize: 16, - color: primaryColor, - fontWeight: FontWeight.bold)), + child: LocalText(context, 'invoice.payment_method', + fontSize: 16, + color: Colors.grey, + fontWeight: FontWeight.bold), + ), Container( width: 150.0, child: DropdownButtonFormField( - items: paymentMethods + icon: Icon(Icons.edit), + value: paymentMethod, + items: paymentMethodModel.paymentMethods .map((e) => DropdownMenuItem( child: Text(e.name), value: e.name)) .toList(), @@ -323,97 +344,31 @@ class _InvoiceEditorState extends State { ], ), ), - // Container( - // padding: EdgeInsets.only(top: 5), - // child: Row( - // children: [ - // Expanded( - // child: Padding( - // padding: const EdgeInsets.only(left: 18.0), - // child: LocalText(context, 'invoice.delivery_fee', - // fontSize: 16, - // color: primaryColor, - // fontWeight: FontWeight.bold), - // )), - // Switch( - // value: isSwitched, - // onChanged: (value) { - // setState(() { - // isSwitched = value; - // if (value) { - // deliveryfee = 5; - // } else { - // deliveryfee = 0; - // } - // print(isSwitched); - // }); - // }, - // 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.invoice != null - // ? Padding( - // padding: EdgeInsets.only(left: 20), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // 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, - // ), - // ], - // ), + SizedBox(height: 30), + !isNew + ? Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Icon(Icons.receipt, color: primaryColor), + SizedBox(width: 10), + LocalText( + context, + "invoice.payment_attachment", + color: Colors.grey, + fontSize: 20, + fontWeight: FontWeight.w700, + ), + ], + ), + ), + Spacer(), + Icon(Icons.add, color: primaryColor), + ], + ) + : Container() ]), )), widget.invoice == null @@ -428,7 +383,7 @@ class _InvoiceEditorState extends State { getLocalString(context, 'invoice.btn_save')) ], )), - widget.invoice == null + isNew ? Container() : fcsButton(context, getLocalString(context, 'invoice.btn_payment_receipt')) @@ -441,13 +396,15 @@ class _InvoiceEditorState extends State { getCargoTableByBox(BuildContext context) { var discountModel = Provider.of(context); - + total = 0; List dataRow = _cargoTypes.map((cargo) { var amount = cargo.weight * cargo.price; total += amount; return Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), 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( children: [ Expanded(flex: 2, child: Text('${cargo.type}')), @@ -469,16 +426,19 @@ class _InvoiceEditorState extends State { dataRow.insert( 0, 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( children: [ Expanded( flex: 2, - child: Text(getLocalString(context, 'invoice.description'), + child: Text(getLocalString(context, 'invoice.box.cargo_type'), style: TextStyle( fontSize: 12, fontWeight: FontWeight.bold, - color: primaryColor))), + color: Colors.grey))), Expanded( flex: 2, child: Text( @@ -489,17 +449,18 @@ class _InvoiceEditorState extends State { style: TextStyle( fontSize: 12, fontWeight: FontWeight.bold, - color: primaryColor))), + color: Colors.grey))), Expanded( child: Text(getLocalString(context, 'invoice.amount'), textAlign: TextAlign.end, style: TextStyle( fontSize: 12, fontWeight: FontWeight.bold, - color: primaryColor))) + color: Colors.grey))) ], ), )); + dataRow.insert( dataRow.length, Container( @@ -508,24 +469,38 @@ class _InvoiceEditorState extends State { child: Row( children: [ Expanded( - flex: 2, - child: Text(getLocalString(context, 'invoice.discount'))), + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.total', + color: Colors.black, + ), + ), + ), Expanded( - child: Container( - width: 80.0, - child: DropdownButtonFormField( - items: discountModel.discounts - .map((e) => DropdownMenuItem( - child: Text(e.code, style: TextStyle(fontSize: 13)), - value: e.code)) - .toList(), - onChanged: (selected) { - var d = discountModel.discounts - .firstWhere((d) => d.code == selected); - setState(() { - _discount = d; - }); - }, + child: Text( + '\$ $total', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + textAlign: TextAlign.end, + )) + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + 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 { dataRow.length, Container( 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( children: [ Expanded( flex: 2, - child: Text(getLocalString(context, 'invoice.custom_fee'))), - // Expanded( - // child: Text( - // '', - // )), - // Container( - // width: 100, - // child: InputText( - // controller: _customFeeController, - // iconData: null, - // labelTextKey: 'invoice.custom_fee'), - // ), + child: Center( + child: LocalText( + context, + 'invoice.custom_fee', + color: Colors.black, + ), + )), Expanded( child: Text('\$ ${customFee}', textAlign: TextAlign.end, @@ -582,8 +552,15 @@ class _InvoiceEditorState extends State { child: Row( children: [ Expanded( - flex: 2, - child: Text(getLocalString(context, 'invoice.delivery_fee'))), + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: LocalText( + context, + 'invoice.delivery_fee', + color: Colors.black, + ), + )), Switch( value: isSwitched, onChanged: (value) { @@ -610,6 +587,7 @@ class _InvoiceEditorState extends State { ], ), )); + dataRow.insert( dataRow.length, Container( @@ -623,6 +601,7 @@ class _InvoiceEditorState extends State { )), ], ))); + dataRow.insert( dataRow.length, Container( @@ -630,21 +609,25 @@ class _InvoiceEditorState extends State { left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), child: Row( children: [ - Expanded(flex: 1, child: Text('')), Expanded( flex: 2, - child: LocalText( - context, - 'invoice.total', - color: Colors.black, + child: Center( + child: LocalText( + context, + 'invoice.net_amount', + color: Colors.black, + fontSize: 15, + fontWeight: FontWeight.bold, + ), ), ), Expanded( - child: Text( - '\$ $total', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), - textAlign: TextAlign.end, - )) + child: Text('\$ ${getTotalBalance(total)}', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: primaryColor))) ], ), )); @@ -656,13 +639,16 @@ class _InvoiceEditorState extends State { left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), child: Row( children: [ - Expanded(flex: 1, child: Text('')), Expanded( flex: 2, - child: LocalText( - context, - 'invoice.balance', - color: Colors.black, + child: Center( + child: LocalText( + context, + 'invoice.balance', + color: Colors.black, + fontSize: 15, + fontWeight: FontWeight.bold, + ), ), ), Expanded( @@ -690,13 +676,11 @@ class _InvoiceEditorState extends State { List getBoxRow(BuildContext context) { return _boxes.map((p) { p.cargoTypes.map((cargo) { - print('cargo => $cargo'); _cargoTypes.asMap().map((index, _cargo) { if (_cargo.type == cargo.type) { setState(() { _cargoTypes[index].weight += cargo.weight; }); - print('${_cargoTypes[index].type} =>${_cargoTypes[index]}'); } }); }); diff --git a/lib/pages/invoice/payment_page.dart b/lib/pages/invoice/payment_page.dart index 89f3867..78c8adc 100644 --- a/lib/pages/invoice/payment_page.dart +++ b/lib/pages/invoice/payment_page.dart @@ -72,30 +72,26 @@ class _PaymentPageState extends State { backgroundColor: primaryColor, title: Text(AppTranslations.of(context).text("pm_.title")), ), - body: Card( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(15.0), - child: Container( - child: Row( - children: [ - LocalText(context, 'pm.total.amount', - color: Colors.black, fontSize: 16), - Text( - ' \$ ${_invoice.amount}', - style: TextStyle( - color: primaryColor, - fontSize: 16, - fontWeight: FontWeight.bold), - ) - ], - )), - ), - Padding( - padding: const EdgeInsets.all(15.0), - child: Container( - child: Row( + body: ListView( + padding: const EdgeInsets.all(15.0), + children: [ + Container( + child: Row( + children: [ + LocalText(context, 'pm.total.amount', + color: Colors.black, fontSize: 16), + Text( + ' \$ ${_invoice.amount}', + style: TextStyle( + color: primaryColor, + fontSize: 16, + fontWeight: FontWeight.bold), + ) + ], + )), + Container( + padding: const EdgeInsets.only(top: 15.0), + child: Row( children: [ LocalText(context, 'pm.remaining_balance', color: Colors.black, fontSize: 16), @@ -108,85 +104,68 @@ class _PaymentPageState extends State { ) ], )), - ), - Expanded( - child: ListView( - children: [ - ExpansionTile( - title: LocalText(context, 'pm.attachment', - color: Colors.black, fontSize: 16), - children: [ - Padding( - padding: EdgeInsets.only(left: 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only(top: 8), - 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: true, - controller: multiImgController, - title: "Receipt File", - )), - ), - ], - ), - ), - SizedBox( - height: 25, - ), - ], + SizedBox(height: 10), + Divider(), + SizedBox(height: 10), + LocalText(context, 'pm.attachment', + color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold), + Padding( + padding: EdgeInsets.only(left: 20, top: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(top: 8), + child: Text( + '${dateFormatter.format(_invoice.receipts[0].date)} ', + style: TextStyle(color: Colors.black, fontSize: 16), ), - ExpansionTile( - title: LocalText(context, 'pm.receipt', - color: Colors.black, fontSize: 16), - children: [ - Container( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: MyDataTable( - headingRowHeight: 40, - columnSpacing: 20, - columns: [ - MyDataColumn( - label: LocalText( - context, - "pm.date", - color: Colors.grey, - ), - ), - MyDataColumn( - label: LocalText( - context, - "pm.amount", - color: Colors.grey, - ), - ), - ], - rows: getPackageRow(context), - ), - ), - ), - SizedBox(height: 25), - ], - ), - ], - ), + ), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 10), + child: MultiImageFile( + enabled: true, + controller: multiImgController, + title: "Receipt File", + )), + ), + ], ), - saveBox, - SizedBox(height: 10), - ], - ), + ), + SizedBox(height: 25), + Divider(), + SizedBox(height: 10), + LocalText(context, 'pm.receipt', + color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold), + Container( + child: MyDataTable( + headingRowHeight: 40, + columnSpacing: 20, + columns: [ + MyDataColumn( + label: LocalText( + context, + "pm.date", + color: Colors.grey, + ), + ), + MyDataColumn( + label: LocalText( + context, + "pm.amount", + color: Colors.grey, + ), + ), + ], + rows: getPackageRow(context), + ), + ), + SizedBox(height: 25), + // saveBox, + // SizedBox(height: 10), + ], ), ), ); diff --git a/lib/pages/widgets/discount_dropdown.dart b/lib/pages/widgets/discount_dropdown.dart new file mode 100644 index 0000000..63bf769 --- /dev/null +++ b/lib/pages/widgets/discount_dropdown.dart @@ -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 extends StatelessWidget { + final Function(T) callback; + final IconData iconData; + final T selectedValue; + final List 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( + 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>((T value) { + return DropdownMenuItem( + value: value, + child: Text(value == null ? "" : (value as Discount).code, + overflow: TextOverflow.ellipsis, + style: TextStyle(color: primaryColor)), + ); + }).toList(), + ), + ], + ), + ), + ], + ), + ); + } +}