2020-06-24 16:06:15 +06:30
|
|
|
import 'package:fcs/model/main_model.dart';
|
2020-06-25 15:34:41 +06:30
|
|
|
import 'package:fcs/model/shipment_model.dart';
|
|
|
|
|
import 'package:fcs/pages/barcode_screen_page.dart';
|
2020-06-29 16:03:41 +06:30
|
|
|
import 'package:fcs/pages/shipping_address_editor.dart';
|
2020-09-04 15:30:10 +06:30
|
|
|
import 'package:fcs/fcs/common/pages/util.dart';
|
2020-06-29 16:03:41 +06:30
|
|
|
import 'package:fcs/pages_fcs/shipping_address_row.dart';
|
2020-06-01 11:52:12 +06:30
|
|
|
import 'package:fcs/vo/package.dart';
|
2020-06-25 15:34:41 +06:30
|
|
|
import 'package:fcs/vo/shipping_address.dart';
|
|
|
|
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
2020-06-01 11:52:12 +06:30
|
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
2020-06-25 15:34:41 +06:30
|
|
|
import 'package:fcs/widget/my_data_table.dart';
|
2020-06-01 11:52:12 +06:30
|
|
|
import 'package:fcs/widget/progress.dart';
|
2020-06-02 00:00:05 +06:30
|
|
|
import 'package:flutter/material.dart';
|
2020-06-03 00:42:31 +06:30
|
|
|
import 'package:flutter_icons/flutter_icons.dart';
|
2020-06-02 00:00:05 +06:30
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
2020-06-03 00:42:31 +06:30
|
|
|
import 'package:intl/intl.dart';
|
2020-06-24 16:06:15 +06:30
|
|
|
import 'package:provider/provider.dart';
|
2020-06-03 00:42:31 +06:30
|
|
|
import 'package:timeline_list/timeline.dart';
|
|
|
|
|
import 'package:timeline_list/timeline_model.dart';
|
2020-06-01 11:52:12 +06:30
|
|
|
|
2020-09-04 15:30:10 +06:30
|
|
|
import '../fcs/common/helpers/theme.dart';
|
2020-06-29 16:03:41 +06:30
|
|
|
import 'shipping_address_list.dart';
|
2020-06-01 11:52:12 +06:30
|
|
|
|
|
|
|
|
class PackageEditor extends StatefulWidget {
|
|
|
|
|
final Package package;
|
|
|
|
|
PackageEditor({this.package});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_PackageEditorState createState() => _PackageEditorState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _PackageEditorState extends State<PackageEditor> {
|
|
|
|
|
TextEditingController _addressEditingController = new TextEditingController();
|
|
|
|
|
TextEditingController _fromTimeEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _toTimeEditingController = new TextEditingController();
|
|
|
|
|
TextEditingController _noOfPackageEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _weightEditingController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
Package _package;
|
|
|
|
|
bool _isLoading = false;
|
2020-06-03 00:42:31 +06:30
|
|
|
List<String> _images = [
|
|
|
|
|
"assets/photos/1.jpg",
|
|
|
|
|
"assets/photos/2.jpg",
|
|
|
|
|
"assets/photos/3.jpg"
|
|
|
|
|
];
|
|
|
|
|
bool isNew;
|
2020-06-29 16:03:41 +06:30
|
|
|
ShippingAddress shippingAddress = ShippingAddress(
|
|
|
|
|
fullName: 'U Nyi Nyi',
|
|
|
|
|
addressLine1: '154-19 64th Ave.',
|
|
|
|
|
addressLine2: 'Flushing',
|
|
|
|
|
city: 'NY',
|
|
|
|
|
state: 'NY',
|
|
|
|
|
phoneNumber: '+1 (292)215-2247');
|
2020-06-01 11:52:12 +06:30
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
if (widget.package != null) {
|
|
|
|
|
_package = widget.package;
|
2020-06-03 00:42:31 +06:30
|
|
|
isNew = false;
|
2020-06-01 11:52:12 +06:30
|
|
|
// _addressEditingController.text = _pickUp.address;
|
|
|
|
|
// _fromTimeEditingController.text = _pickUp.fromTime;
|
|
|
|
|
// _toTimeEditingController.text = _pickUp.toTime;
|
|
|
|
|
// _noOfPackageEditingController.text = _pickUp.numberOfPackage.toString();
|
|
|
|
|
// _weightEditingController.text = _pickUp.weight.toString();
|
2020-06-02 16:19:10 +06:30
|
|
|
} else {
|
2020-06-03 00:42:31 +06:30
|
|
|
isNew = true;
|
2020-06-02 16:19:10 +06:30
|
|
|
_package = Package(rate: 0, weight: 0);
|
2020-06-01 11:52:12 +06:30
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-03 00:42:31 +06:30
|
|
|
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
|
|
|
|
|
2020-06-24 16:06:15 +06:30
|
|
|
List<TimelineModel> _models() {
|
|
|
|
|
print('_package.statusHistory=> ${_package.statusHistory}');
|
|
|
|
|
return _package.statusHistory
|
|
|
|
|
.map((e) => TimelineModel(
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(18.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(e.status,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: e.done ? primaryColor : Colors.grey,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
|
e.status == "Processed"
|
|
|
|
|
? Text("(Waiting for payment)",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: e.done ? primaryColor : Colors.grey,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.bold))
|
|
|
|
|
: Container(),
|
|
|
|
|
Text(dateFormat.format(e.date)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
iconBackground: e.done ? primaryColor : Colors.grey,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
e.status == "Shipped"
|
|
|
|
|
? Ionicons.ios_airplane
|
|
|
|
|
: e.status == "Delivered"
|
|
|
|
|
? MaterialCommunityIcons.truck_fast
|
|
|
|
|
: e.status == "Processed"
|
|
|
|
|
? MaterialIcons.check
|
|
|
|
|
: Octicons.package,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
)))
|
|
|
|
|
.toList();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-01 11:52:12 +06:30
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-06-24 16:06:15 +06:30
|
|
|
var owner = Provider.of<MainModel>(context).isOwner();
|
|
|
|
|
|
2020-06-03 00:42:31 +06:30
|
|
|
var images = isNew ? [] : _images;
|
2020-06-01 11:52:12 +06:30
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
leading: new IconButton(
|
|
|
|
|
icon: new Icon(Icons.close),
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
title: Text(AppTranslations.of(context).text("package.edit.title")),
|
|
|
|
|
),
|
|
|
|
|
body: Card(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
2020-06-04 01:36:49 +06:30
|
|
|
isNew ? Container() : Center(child: nameWidget(_package.market)),
|
|
|
|
|
isNew
|
2020-06-03 00:42:31 +06:30
|
|
|
? Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(8),
|
|
|
|
|
child: Text("New Package")))
|
2020-06-04 01:36:49 +06:30
|
|
|
: Center(child: nameWidget(_package.trackingID)),
|
2020-06-01 11:52:12 +06:30
|
|
|
Expanded(
|
2020-06-02 16:19:10 +06:30
|
|
|
child: ListView(
|
|
|
|
|
children: [
|
2020-06-24 16:06:15 +06:30
|
|
|
owner
|
|
|
|
|
? ExpansionTile(
|
2020-06-04 01:36:49 +06:30
|
|
|
title: Text(
|
2020-06-24 16:06:15 +06:30
|
|
|
'Receiving',
|
2020-06-04 01:36:49 +06:30
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 20.0, right: 20),
|
|
|
|
|
child: TextFormField(
|
2020-06-25 15:34:41 +06:30
|
|
|
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
|
2020-06-24 16:06:15 +06:30
|
|
|
decoration: InputDecoration(
|
|
|
|
|
fillColor: Colors.white,
|
2020-06-25 15:34:41 +06:30
|
|
|
labelText: 'Tracking ID',
|
|
|
|
|
hintText: 'Tracking ID',
|
2020-06-24 16:06:15 +06:30
|
|
|
filled: true,
|
2020-06-25 15:34:41 +06:30
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Ionicons.ios_barcode,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
BottomUpPageRoute(
|
|
|
|
|
BarcodeScreenPage()),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
icon: Icon(Octicons.package,
|
2020-06-24 16:06:15 +06:30
|
|
|
color: primaryColor),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 20.0, right: 20),
|
|
|
|
|
child: TextFormField(
|
2020-06-25 15:34:41 +06:30
|
|
|
initialValue: isNew ? "" : "FCS-0203-390-2",
|
2020-06-24 16:06:15 +06:30
|
|
|
decoration: InputDecoration(
|
2020-06-25 15:34:41 +06:30
|
|
|
fillColor: Colors.white,
|
|
|
|
|
labelText: 'FCS_ID',
|
|
|
|
|
hintText: 'FCS_ID',
|
|
|
|
|
filled: true,
|
|
|
|
|
icon: Icon(Feather.user,
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(Icons.search),
|
|
|
|
|
onPressed: () {})),
|
2020-06-24 16:06:15 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 20.0, right: 20),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
initialValue: _package.receiverName,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
labelText: 'Customer Name',
|
|
|
|
|
filled: true,
|
|
|
|
|
icon: Icon(Feather.user,
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(Icons.search),
|
|
|
|
|
onPressed: () {})),
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-07-02 16:16:21 +06:30
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.only(
|
|
|
|
|
// left: 20.0, right: 20),
|
|
|
|
|
// child: TextFormField(
|
|
|
|
|
// initialValue: isNew ? "" : "PKG2039",
|
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
|
// fillColor: Colors.white,
|
|
|
|
|
// labelText: 'Package ID',
|
|
|
|
|
// hintText: 'Package ID',
|
|
|
|
|
// filled: true,
|
|
|
|
|
// icon: Icon(MaterialCommunityIcons.id_card,
|
|
|
|
|
// color: primaryColor),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
2020-06-24 16:06:15 +06:30
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 20.0, right: 20),
|
|
|
|
|
child: TextFormField(
|
2020-07-02 16:16:21 +06:30
|
|
|
initialValue: isNew ? "" : "Amazon",
|
2020-06-24 16:06:15 +06:30
|
|
|
decoration: InputDecoration(
|
2020-07-02 16:16:21 +06:30
|
|
|
fillColor: Colors.white,
|
|
|
|
|
labelText: 'Market',
|
|
|
|
|
hintText: 'FCS_ID',
|
|
|
|
|
filled: true,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
MaterialCommunityIcons.cart_outline,
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
),
|
2020-06-24 16:06:15 +06:30
|
|
|
),
|
2020-06-04 01:36:49 +06:30
|
|
|
),
|
2020-07-02 16:16:21 +06:30
|
|
|
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.only(
|
|
|
|
|
// left: 20.0, right: 20),
|
|
|
|
|
// child: TextFormField(
|
|
|
|
|
// initialValue: isNew ? "" : "",
|
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
|
// fillColor: Colors.white,
|
|
|
|
|
// labelText: 'Pickup ID',
|
|
|
|
|
// filled: true,
|
|
|
|
|
// icon: Icon(
|
|
|
|
|
// MaterialCommunityIcons.directions,
|
|
|
|
|
// color: primaryColor),
|
|
|
|
|
// suffixIcon: IconButton(
|
|
|
|
|
// icon: Icon(Icons.search),
|
|
|
|
|
// onPressed: () {})),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
2020-06-04 01:36:49 +06:30
|
|
|
],
|
2020-06-24 16:06:15 +06:30
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
owner
|
|
|
|
|
? isNew
|
|
|
|
|
? Container()
|
|
|
|
|
: ExpansionTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
'Processing',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 20.0, right: 20),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
initialValue: isNew
|
|
|
|
|
? ""
|
|
|
|
|
: _package.cargoDesc.toString(),
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
labelText: 'Description',
|
|
|
|
|
filled: true,
|
|
|
|
|
icon: Icon(MaterialIcons.description,
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
)),
|
|
|
|
|
),
|
2020-06-25 15:34:41 +06:30
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 20.0, right: 20),
|
|
|
|
|
child: fcsInput(
|
|
|
|
|
"Remark",
|
|
|
|
|
MaterialCommunityIcons.note,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 5),
|
2020-06-24 16:06:15 +06:30
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
2020-06-04 01:36:49 +06:30
|
|
|
isNew
|
|
|
|
|
? Container()
|
|
|
|
|
: ExpansionTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
'Photos',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
2020-06-03 00:42:31 +06:30
|
|
|
),
|
2020-06-04 01:36:49 +06:30
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
height: 130,
|
|
|
|
|
width: 500,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) => Divider(
|
|
|
|
|
color: Colors.black,
|
2020-06-03 00:42:31 +06:30
|
|
|
),
|
2020-06-04 01:36:49 +06:30
|
|
|
itemCount: images.length + 1,
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
if (index == images.length) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 200,
|
|
|
|
|
height: 70,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
width: 2.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Icon(SimpleLineIcons.plus),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 200,
|
|
|
|
|
height: 70,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
width: 2.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Image.asset(images[index],
|
|
|
|
|
width: 50, height: 50),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
2020-06-02 16:19:10 +06:30
|
|
|
),
|
2020-08-30 21:26:37 +06:30
|
|
|
isNew ? Container() : getShippingAddressList(context),
|
2020-06-24 16:06:15 +06:30
|
|
|
isNew
|
|
|
|
|
? Container()
|
|
|
|
|
: ExpansionTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
'Status',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
height: 500,
|
|
|
|
|
padding: EdgeInsets.only(left: 20),
|
|
|
|
|
child: isNew
|
|
|
|
|
? Container()
|
|
|
|
|
: Timeline(
|
|
|
|
|
children: _models(),
|
|
|
|
|
position: TimelinePosition.Left),
|
|
|
|
|
),
|
|
|
|
|
],
|
2020-06-25 15:34:41 +06:30
|
|
|
),
|
2020-06-02 16:19:10 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-06-24 16:06:15 +06:30
|
|
|
owner
|
|
|
|
|
? widget.package == null
|
|
|
|
|
? Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 250,
|
|
|
|
|
child: FlatButton(
|
|
|
|
|
child: Text('Complete receiving'),
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)))
|
|
|
|
|
: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 250,
|
|
|
|
|
child: FlatButton(
|
|
|
|
|
child: Text('Complete processing'),
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
))),
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
: Container()
|
2020-06-01 11:52:12 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-06-25 15:34:41 +06:30
|
|
|
|
|
|
|
|
Widget getShippingAddressList(BuildContext context) {
|
|
|
|
|
var shipmentModel = Provider.of<ShipmentModel>(context);
|
|
|
|
|
return Container(
|
|
|
|
|
child: ExpansionTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
"Shipping Addresses",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontStyle: FontStyle.normal,
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
),
|
|
|
|
|
children: <Widget>[
|
2020-06-29 16:03:41 +06:30
|
|
|
// Column(
|
|
|
|
|
// children: getAddressList(context, shipmentModel.shippingAddresses),
|
|
|
|
|
// ),
|
2020-06-25 15:34:41 +06:30
|
|
|
Container(
|
2020-06-29 16:03:41 +06:30
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-06-25 15:34:41 +06:30
|
|
|
),
|
2020-06-29 16:03:41 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
2020-06-25 15:34:41 +06:30
|
|
|
),
|
|
|
|
|
),
|
2020-06-29 16:03:41 +06:30
|
|
|
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(
|
2020-06-30 16:11:58 +06:30
|
|
|
'Select \nAddress',
|
2020-06-29 16:03:41 +06:30
|
|
|
style: TextStyle(fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
2020-06-25 15:34:41 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-29 16:03:41 +06:30
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-25 15:34:41 +06:30
|
|
|
List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) {
|
|
|
|
|
return addresses.map((s) {
|
|
|
|
|
return MyDataRow(
|
2020-06-29 16:03:41 +06:30
|
|
|
onSelectChanged: (selected) {},
|
2020-06-25 15:34:41 +06:30
|
|
|
cells: [
|
|
|
|
|
MyDataCell(
|
|
|
|
|
new Text(
|
|
|
|
|
s.fullName,
|
|
|
|
|
style: textStyle,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
MyDataCell(
|
|
|
|
|
new Text(
|
|
|
|
|
s.phoneNumber,
|
|
|
|
|
style: textStyle,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
}
|
2020-06-01 11:52:12 +06:30
|
|
|
}
|