update widgets

This commit is contained in:
Sai Naw Wun
2020-10-14 10:33:14 +06:30
parent 8f5542c4fb
commit fa49b6a202
4 changed files with 149 additions and 198 deletions

View File

@@ -500,26 +500,22 @@ class _BoxEditorState extends State<BoxEditor> {
widget.box == null widget.box == null
? Container() ? Container()
: Center(child: nameWidget(_box.packageNumber)), : Center(child: nameWidget(_box.packageNumber)),
Container( SizedBox(
padding: EdgeInsets.only(top: 10), height: 10,
child: TitleWithAddButton(
titleKey: "box.shipment_info",
),
), ),
Column( TitleWithAddButton(
children: [ titleKey: "box.shipment_info",
shipmentBox, ),
SizedBox( shipmentBox,
height: 10, SizedBox(
), height: 10,
fcsIDBox, ),
phoneNumberBox, fcsIDBox,
namebox, phoneNumberBox,
mixBox, namebox,
SizedBox( mixBox,
height: 10, SizedBox(
), height: 10,
],
), ),
Divider(), Divider(),
Container( Container(
@@ -582,15 +578,11 @@ class _BoxEditorState extends State<BoxEditor> {
TitleWithAddButton( TitleWithAddButton(
titleKey: "box.dimension", titleKey: "box.dimension",
), ),
Column( shipmentWeightBox,
children: [ widthBox,
shipmentWeightBox, heightBox,
widthBox, lengthBox,
heightBox, SizedBox(height: 25),
lengthBox,
SizedBox(height: 25),
],
),
Divider(), Divider(),
Container( Container(
padding: EdgeInsets.only(left: 10, right: 10), padding: EdgeInsets.only(left: 10, right: 10),

View File

@@ -18,6 +18,7 @@ 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_dropdown.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/local_title.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';
import 'package:fcs/pages/widgets/my_data_table.dart'; import 'package:fcs/pages/widgets/my_data_table.dart';
@@ -196,181 +197,141 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
title: LocalText(context, 'invoice.form.title', title: LocalText(context, 'invoice.form.title',
color: primaryColor, fontSize: 20), color: primaryColor, fontSize: 20),
), ),
body: Card( body: Padding(
child: Column( padding: const EdgeInsets.all(8.0),
child: ListView(
children: <Widget>[ children: <Widget>[
Expanded( LocalTitle(textKey: "package.create.name"),
child: Padding( DisplayText(
padding: const EdgeInsets.all(10.0), labelTextKey: 'invoice.date',
child: ListView(children: <Widget>[ iconData: Icons.date_range,
DisplayText( text: _dateController.text),
labelTextKey: 'invoice.date', widget.invoice == null
iconData: Icons.date_range, ? Container()
text: _dateController.text), : DisplayText(
widget.invoice == null labelTextKey: 'invoice.number',
? Container() iconData: FontAwesomeIcons.fileInvoice,
: DisplayText( text: _invoiceNumberController.text),
labelTextKey: 'invoice.number', widget.invoice == null
iconData: FontAwesomeIcons.fileInvoice, ? Row(
text: _invoiceNumberController.text),
widget.invoice == null
? Row(
children: <Widget>[
Expanded(
child: DisplayText(
text: user != null ? user.name : "",
labelTextKey: "invoice.customer_name",
iconData: Feather.user,
)),
IconButton(
icon: Icon(Icons.search, color: primaryColor),
onPressed: () => searchUser(context,
callbackUserSelect: (u) {
setState(() {
this.user = u;
});
})),
],
)
: DisplayText(
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: 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(
headingRowHeight: 40,
columnSpacing: 20,
columns: [
MyDataColumn(
label: Text(''),
),
MyDataColumn(
label: LocalText(
context,
"invoice.box.number",
color: Colors.grey,
),
),
MyDataColumn(
label: Text(
getLocalString(context, "invoice.box.length") +
' x ' +
getLocalString(context, "invoice.box.width") +
' x ' +
getLocalString(context, "invoice.box.height"),
),
),
],
rows: getBoxRow(context),
),
),
),
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)),
),
SizedBox(height: 20),
Container(
padding: EdgeInsets.only(top: 5, left: 18),
child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: LocalText(context, 'invoice.payment_method', child: DisplayText(
fontSize: 16, text: user != null ? user.name : "",
color: Colors.grey, labelTextKey: "invoice.customer_name",
fontWeight: FontWeight.bold), iconData: Feather.user,
), )),
IconButton(
icon: Icon(Icons.search, color: primaryColor),
onPressed: () =>
searchUser(context, callbackUserSelect: (u) {
setState(() {
this.user = u;
});
})),
],
)
: DisplayText(
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: 30),
LocalTitle(textKey: "invoice.box_info"),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
// columnSpacing: 20,
columns: [
MyDataColumn(
label: Text(''),
),
MyDataColumn(
label: LocalText(
context,
"invoice.box.number",
color: Colors.grey,
),
),
MyDataColumn(
label: Text(
getLocalString(context, "invoice.box.length") +
' x ' +
getLocalString(context, "invoice.box.width") +
' x ' +
getLocalString(context, "invoice.box.height"),
),
),
],
rows: getBoxRow(context),
),
),
SizedBox(height: 40),
LocalTitle(textKey: "invoice.cargo_type"),
Column(children: getCargoTableByBox(context)),
SizedBox(height: 20),
Container(
padding: EdgeInsets.only(top: 5, left: 18),
child: Row(
children: <Widget>[
Expanded(
child: LocalText(context, 'invoice.payment_method',
fontSize: 16,
color: Colors.grey,
fontWeight: FontWeight.bold),
),
Container(
width: 150.0,
child: DropdownButtonFormField(
icon: Icon(Icons.edit),
value: paymentMethod,
items: paymentMethodModel.paymentMethods
.map((e) => DropdownMenuItem(
child: Text(e.name), value: e.name))
.toList(),
onChanged: (selected) => {},
),
),
],
),
),
SizedBox(height: 30),
!isNew
? Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container( Container(
width: 150.0, child: Row(
child: DropdownButtonFormField( children: [
icon: Icon(Icons.edit), Icon(Icons.receipt, color: primaryColor),
value: paymentMethod, SizedBox(width: 10),
items: paymentMethodModel.paymentMethods LocalText(
.map((e) => DropdownMenuItem( context,
child: Text(e.name), value: e.name)) "invoice.payment_attachment",
.toList(), color: Colors.grey,
onChanged: (selected) => {}, fontSize: 20,
fontWeight: FontWeight.w700,
),
],
), ),
), ),
Spacer(),
Icon(Icons.add, color: primaryColor),
], ],
), )
), : Container(),
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 widget.invoice == null
? fcsButton( ? fcsButton(
context, getLocalString(context, 'invoice.btn_create')) context, getLocalString(context, 'invoice.btn_create'))

View File

@@ -71,7 +71,6 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
double l = double.parse(_lengthCtl.text, (s) => 0); double l = double.parse(_lengthCtl.text, (s) => 0);
double w = double.parse(_widthCtl.text, (s) => 0); double w = double.parse(_widthCtl.text, (s) => 0);
double h = double.parse(_heightCtl.text, (s) => 0); double h = double.parse(_heightCtl.text, (s) => 0);
print("$l $w $h");
setState(() { setState(() {
shipmentWeight = l * w * h / volumetricRatio; shipmentWeight = l * w * h / volumetricRatio;
}); });

View File

@@ -239,7 +239,6 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
}, },
), ),
), ),
Column( Column(
children: getBoxList(context, boxModel.boxes), children: getBoxList(context, boxModel.boxes),
), ),