modify
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
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/shipping_address_editor.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/pages_fcs/shipping_address_row.dart';
|
||||
import 'package:fcs/vo/package.dart';
|
||||
import 'package:fcs/vo/shipping_address.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
@@ -17,6 +19,7 @@ import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
import 'shipping_address_list.dart';
|
||||
|
||||
class PackageEditor extends StatefulWidget {
|
||||
final Package package;
|
||||
@@ -43,6 +46,13 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
"assets/photos/3.jpg"
|
||||
];
|
||||
bool isNew;
|
||||
ShippingAddress shippingAddress = ShippingAddress(
|
||||
fullName: 'U Nyi Nyi',
|
||||
addressLine1: '154-19 64th Ave.',
|
||||
addressLine2: 'Flushing',
|
||||
city: 'NY',
|
||||
state: 'NY',
|
||||
phoneNumber: '+1 (292)215-2247');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -352,6 +362,7 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
),
|
||||
],
|
||||
),
|
||||
getShippingAddressList(context),
|
||||
isNew
|
||||
? Container()
|
||||
: ExpansionTile(
|
||||
@@ -373,7 +384,6 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
),
|
||||
],
|
||||
),
|
||||
getShippingAddressList(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -432,45 +442,152 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
color: primaryColor),
|
||||
),
|
||||
children: <Widget>[
|
||||
// Column(
|
||||
// children: getAddressList(context, shipmentModel.shippingAddresses),
|
||||
// ),
|
||||
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],
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
shippingAddress.fullName == null
|
||||
? ''
|
||||
: shippingAddress.fullName,
|
||||
style: new TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
shippingAddress.addressLine1 == null
|
||||
? ''
|
||||
: shippingAddress.addressLine1,
|
||||
style: new TextStyle(
|
||||
fontSize: 14.0, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
shippingAddress.addressLine2 == null
|
||||
? ''
|
||||
: shippingAddress.addressLine2,
|
||||
style: new TextStyle(
|
||||
fontSize: 14.0, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
shippingAddress.city == null
|
||||
? ''
|
||||
: shippingAddress.city,
|
||||
style: new TextStyle(
|
||||
fontSize: 14.0, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
shippingAddress.state == null
|
||||
? ''
|
||||
: shippingAddress.state,
|
||||
style: new TextStyle(
|
||||
fontSize: 14.0, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: new Text(
|
||||
shippingAddress.phoneNumber == null
|
||||
? ''
|
||||
: "Phone:${shippingAddress.phoneNumber}",
|
||||
style: new TextStyle(
|
||||
fontSize: 14.0, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
MyDataColumn(
|
||||
label: Text(
|
||||
"Phone Number",
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
)),
|
||||
],
|
||||
rows: getAddressRows(shipmentModel.shippingAddresses),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Container(
|
||||
width: 130,
|
||||
height: 40,
|
||||
child: FloatingActionButton.extended(
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
onPressed: () async {
|
||||
var address = await Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(ShippingAddressList()),
|
||||
);
|
||||
print('address => ${address}');
|
||||
setState(() {
|
||||
if (address != null) {
|
||||
this.shippingAddress = address;
|
||||
}
|
||||
});
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(
|
||||
'Add Shipping\nAddress',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> getAddressList(
|
||||
BuildContext context, List<ShippingAddress> addresses) {
|
||||
return addresses.asMap().entries.map((s) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s.value)),
|
||||
);
|
||||
},
|
||||
child: ShippingAddressRow(shippingAddress: s.value, index: s.key),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) {
|
||||
return addresses.map((s) {
|
||||
return MyDataRow(
|
||||
onSelectChanged: (selected) {
|
||||
|
||||
},
|
||||
onSelectChanged: (selected) {},
|
||||
cells: [
|
||||
MyDataCell(
|
||||
new Text(
|
||||
|
||||
Reference in New Issue
Block a user