This commit is contained in:
PhyoThandar
2020-06-25 15:34:41 +06:30
parent 0007c193b4
commit a41edffe02
4 changed files with 272 additions and 108 deletions

View File

@@ -1,7 +1,12 @@
import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/pages/barcode_screen_page.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/package.dart';
import 'package:fcs/vo/shipping_address.dart';
import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:fcs/widget/my_data_table.dart';
import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
@@ -141,6 +146,50 @@ class _PackageEditorState extends State<PackageEditor> {
fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Tracking ID',
hintText: 'Tracking ID',
filled: true,
suffixIcon: IconButton(
icon: Icon(
Ionicons.ios_barcode,
color: primaryColor,
),
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(
BarcodeScreenPage()),
);
}),
icon: Icon(Octicons.package,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "FCS-0203-390-2",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'FCS_ID',
hintText: 'FCS_ID',
filled: true,
icon: Icon(Feather.user,
color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
@@ -172,38 +221,6 @@ class _PackageEditorState extends State<PackageEditor> {
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Tracking ID',
hintText: 'Tracking ID',
filled: true,
icon: Icon(Octicons.package,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "FCS-0203-390-2",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'FCS_ID',
hintText: 'FCS_ID',
filled: true,
icon: Icon(Feather.user,
color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
@@ -266,6 +283,15 @@ class _PackageEditorState extends State<PackageEditor> {
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: fcsInput(
"Remark",
MaterialCommunityIcons.note,
),
),
SizedBox(height: 5),
],
)
: Container(),
@@ -346,7 +372,8 @@ class _PackageEditorState extends State<PackageEditor> {
position: TimelinePosition.Left),
),
],
)
),
getShippingAddressList(context),
],
),
),
@@ -392,4 +419,74 @@ class _PackageEditorState extends State<PackageEditor> {
),
);
}
Widget getShippingAddressList(BuildContext context) {
var shipmentModel = Provider.of<ShipmentModel>(context);
return Container(
// padding: EdgeInsets.only(top: 5, left: 10),
child: ExpansionTile(
title: Text(
"Shipping Addresses",
style: TextStyle(
fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal,
color: primaryColor),
),
children: <Widget>[
Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 50,
columns: [
MyDataColumn(
label: Text(
"Full Name",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600],
),
)),
MyDataColumn(
label: Text(
"Phone Number",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600],
),
)),
],
rows: getAddressRows(shipmentModel.shippingAddresses),
),
),
),
],
),
);
}
List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) {
return addresses.map((s) {
return MyDataRow(
onSelectChanged: (selected) {
},
cells: [
MyDataCell(
new Text(
s.fullName,
style: textStyle,
),
),
MyDataCell(
new Text(
s.phoneNumber,
style: textStyle,
),
),
],
);
}).toList();
}
}