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

@@ -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/local_dropdown.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_file.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',
color: primaryColor, fontSize: 20),
),
body: Card(
child: Column(
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: ListView(children: <Widget>[
DisplayText(
labelTextKey: 'invoice.date',
iconData: Icons.date_range,
text: _dateController.text),
widget.invoice == null
? Container()
: DisplayText(
labelTextKey: 'invoice.number',
iconData: FontAwesomeIcons.fileInvoice,
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(
LocalTitle(textKey: "package.create.name"),
DisplayText(
labelTextKey: 'invoice.date',
iconData: Icons.date_range,
text: _dateController.text),
widget.invoice == null
? Container()
: DisplayText(
labelTextKey: 'invoice.number',
iconData: FontAwesomeIcons.fileInvoice,
text: _invoiceNumberController.text),
widget.invoice == null
? Row(
children: <Widget>[
Expanded(
child: LocalText(context, 'invoice.payment_method',
fontSize: 16,
color: Colors.grey,
fontWeight: FontWeight.bold),
),
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),
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(
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) => {},
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),
],
),
),
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()
]),
)),
)
: Container(),
widget.invoice == null
? fcsButton(
context, getLocalString(context, 'invoice.btn_create'))