2020-10-12 08:26:27 +06:30
|
|
|
import 'package:fcs/domain/constants.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/domain/entities/box.dart';
|
|
|
|
|
import 'package:fcs/domain/entities/cargo.dart';
|
|
|
|
|
import 'package:fcs/domain/entities/pickup.dart';
|
2020-10-08 11:38:05 +06:30
|
|
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:fcs/localization/app_translations.dart';
|
|
|
|
|
import 'package:fcs/pages/box/model/box_model.dart';
|
2020-10-12 08:26:27 +06:30
|
|
|
import 'package:fcs/pages/delivery_address/delivery_address_list.dart';
|
2020-10-08 15:54:43 +06:30
|
|
|
import 'package:fcs/pages/delivery_address/delivery_address_row.dart';
|
|
|
|
|
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/main/model/main_model.dart';
|
2020-10-07 14:42:07 +06:30
|
|
|
import 'package:fcs/pages/shipment/model/shipment_model.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/main/util.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
2020-10-12 08:26:27 +06:30
|
|
|
import 'package:fcs/pages/widgets/display_text.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/input_date.dart';
|
2020-10-08 11:43:53 +06:30
|
|
|
import 'package:fcs/pages/widgets/input_text.dart';
|
2020-10-12 08:26:27 +06:30
|
|
|
import 'package:fcs/pages/widgets/input_time.dart';
|
2020-10-07 19:53:47 +06:30
|
|
|
import 'package:fcs/pages/widgets/local_text.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/progress.dart';
|
2020-06-01 14:42:42 +06:30
|
|
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
2020-05-31 15:00:11 +06:30
|
|
|
import 'package:flutter_icons/flutter_icons.dart';
|
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
2020-06-01 14:42:42 +06:30
|
|
|
import 'package:intl/intl.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
2020-06-26 16:17:40 +06:30
|
|
|
import 'pickup_box_editor.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
|
2020-10-07 14:42:07 +06:30
|
|
|
class ShipmentEditor extends StatefulWidget {
|
2020-10-12 08:26:27 +06:30
|
|
|
final Shipment shipment;
|
|
|
|
|
ShipmentEditor({this.shipment});
|
2020-05-29 15:54:26 +06:30
|
|
|
|
|
|
|
|
@override
|
2020-10-07 14:42:07 +06:30
|
|
|
_ShipmentEditorState createState() => _ShipmentEditorState();
|
2020-05-29 15:54:26 +06:30
|
|
|
}
|
|
|
|
|
|
2020-10-07 14:42:07 +06:30
|
|
|
class _ShipmentEditorState extends State<ShipmentEditor> {
|
2020-06-01 14:42:42 +06:30
|
|
|
var dateFormatter = new DateFormat('dd MMM yyyy');
|
2020-06-24 16:06:40 +06:30
|
|
|
final numberFormatter = new NumberFormat("#,###");
|
2020-07-02 16:16:21 +06:30
|
|
|
MultiImgController multiImgController = MultiImgController();
|
2020-06-01 14:42:42 +06:30
|
|
|
|
2020-05-29 15:54:26 +06:30
|
|
|
TextEditingController _addressEditingController = new TextEditingController();
|
|
|
|
|
TextEditingController _fromTimeEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _toTimeEditingController = new TextEditingController();
|
|
|
|
|
TextEditingController _noOfPackageEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _weightEditingController = new TextEditingController();
|
2020-06-01 14:42:42 +06:30
|
|
|
TextEditingController _recipientNameEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _recipientPhoneEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _recipientAddressEditingController =
|
|
|
|
|
new TextEditingController();
|
|
|
|
|
TextEditingController _pickupDate = new TextEditingController();
|
2020-06-24 16:06:40 +06:30
|
|
|
TextEditingController _handlingFeeController = new TextEditingController();
|
2020-05-29 15:54:26 +06:30
|
|
|
|
2020-10-07 14:42:07 +06:30
|
|
|
Shipment _pickUp;
|
2020-05-29 15:54:26 +06:30
|
|
|
bool _isLoading = false;
|
2020-06-01 14:42:42 +06:30
|
|
|
var now = new DateTime.now();
|
2020-10-12 08:26:27 +06:30
|
|
|
bool _isNew;
|
|
|
|
|
DeliveryAddress _pickupAddress = new DeliveryAddress();
|
2020-05-29 15:54:26 +06:30
|
|
|
|
2020-07-01 08:12:59 +06:30
|
|
|
int _currVal = 1;
|
2020-10-12 08:26:27 +06:30
|
|
|
String selectedPickupType;
|
2020-06-30 16:27:56 +06:30
|
|
|
|
2020-05-29 15:54:26 +06:30
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
2020-10-12 08:26:27 +06:30
|
|
|
selectedPickupType = shipment_local_pickup;
|
|
|
|
|
|
|
|
|
|
if (widget.shipment != null) {
|
|
|
|
|
_isNew = false;
|
|
|
|
|
_pickUp = widget.shipment;
|
2020-05-29 15:54:26 +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-01 14:42:42 +06:30
|
|
|
_pickupDate.text = dateFormatter.format(now);
|
2020-06-24 16:06:40 +06:30
|
|
|
_handlingFeeController.text = numberFormatter.format(_pickUp.handlingFee);
|
2020-07-01 08:12:59 +06:30
|
|
|
_currVal = _pickUp.radioIndex;
|
2020-06-01 14:42:42 +06:30
|
|
|
|
|
|
|
|
var mainModel = Provider.of<MainModel>(context, listen: false);
|
2020-10-07 02:33:06 +06:30
|
|
|
// _recipientNameEditingController.text = mainModel.recipient.name;
|
|
|
|
|
// _recipientPhoneEditingController.text = mainModel.recipient.phoneNumber;
|
|
|
|
|
// _recipientAddressEditingController.text =
|
|
|
|
|
// mainModel.recipient.shippingAddress;
|
2020-06-03 00:42:31 +06:30
|
|
|
} else {
|
2020-10-12 08:26:27 +06:30
|
|
|
_isNew = true;
|
2020-06-25 16:19:23 +06:30
|
|
|
List<Cargo> _cargoTypes = [
|
|
|
|
|
Cargo(type: 'General Cargo', weight: 25),
|
|
|
|
|
Cargo(type: 'Medicine', weight: 20),
|
|
|
|
|
Cargo(type: 'Dangerous Cargo', weight: 30)
|
|
|
|
|
];
|
2020-10-07 14:42:07 +06:30
|
|
|
_pickUp = Shipment(cargoTypes: _cargoTypes);
|
2020-05-29 15:54:26 +06:30
|
|
|
}
|
2020-10-07 02:33:06 +06:30
|
|
|
var shipmentModel =
|
2020-10-08 15:54:43 +06:30
|
|
|
Provider.of<DeliveryAddressModel>(context, listen: false);
|
2020-10-12 08:26:27 +06:30
|
|
|
_pickupAddress = shipmentModel.defalutAddress;
|
2020-05-29 15:54:26 +06:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-10-12 08:26:27 +06:30
|
|
|
final fromTimeBox = InputTime(
|
2020-10-08 11:43:53 +06:30
|
|
|
labelTextKey: 'shipment.from',
|
|
|
|
|
iconData: Icons.timer,
|
|
|
|
|
controller: _fromTimeEditingController);
|
2020-05-29 15:54:26 +06:30
|
|
|
|
2020-10-12 08:26:27 +06:30
|
|
|
final toTimeBox = InputTime(
|
|
|
|
|
labelTextKey: 'shipment.to', controller: _toTimeEditingController);
|
2020-06-02 14:52:31 +06:30
|
|
|
|
|
|
|
|
final fromTimeBoxReadOnly = fcsInputReadOnly(
|
|
|
|
|
'From',
|
|
|
|
|
Icons.timer,
|
|
|
|
|
controller: _fromTimeEditingController,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final toTimeBoxReadOnly = fcsInputReadOnly(
|
|
|
|
|
'To',
|
|
|
|
|
null,
|
|
|
|
|
controller: _toTimeEditingController,
|
|
|
|
|
);
|
|
|
|
|
|
2020-10-12 08:26:27 +06:30
|
|
|
final pickupTimeBox = Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: fromTimeBox,
|
|
|
|
|
width: 120,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: Text('-'),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 20),
|
|
|
|
|
child: toTimeBox,
|
|
|
|
|
width: 120,
|
|
|
|
|
),
|
|
|
|
|
],
|
2020-06-01 14:42:42 +06:30
|
|
|
);
|
|
|
|
|
|
2020-06-02 14:52:31 +06:30
|
|
|
final pickupTimeReadOnly = Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 20.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SizedBox(height: 5),
|
|
|
|
|
Container(
|
|
|
|
|
child: fromTimeBoxReadOnly,
|
|
|
|
|
width: 120,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: Text('-'),
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
2020-06-02 14:52:31 +06:30
|
|
|
Container(
|
|
|
|
|
child: toTimeBoxReadOnly,
|
|
|
|
|
width: 120,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2020-05-31 15:00:11 +06:30
|
|
|
MainModel mainModel = Provider.of<MainModel>(context);
|
2020-06-26 16:17:40 +06:30
|
|
|
var boxModel = Provider.of<BoxModel>(context);
|
2020-05-31 15:00:11 +06:30
|
|
|
|
2020-05-29 15:54:26 +06:30
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
2020-05-31 15:00:11 +06:30
|
|
|
centerTitle: true,
|
|
|
|
|
leading: new IconButton(
|
|
|
|
|
icon: new Icon(Icons.close),
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
shadowColor: Colors.transparent,
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
title: LocalText(
|
|
|
|
|
context,
|
|
|
|
|
_isNew ? "shipment.new.title" : "shipment.edit.title",
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
),
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
body: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(10.0),
|
|
|
|
|
child: ListView(
|
2020-05-29 15:54:26 +06:30
|
|
|
children: <Widget>[
|
2020-10-12 08:26:27 +06:30
|
|
|
_isNew
|
|
|
|
|
? Container()
|
|
|
|
|
: Center(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 10.0, top: 8),
|
|
|
|
|
child: Text(
|
|
|
|
|
'#P200304',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black87,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
2020-06-03 00:42:31 +06:30
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
),
|
2020-06-26 16:17:40 +06:30
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
widget.shipment == null
|
|
|
|
|
? Container()
|
|
|
|
|
: widget.shipment.isCourier
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 15.0),
|
|
|
|
|
child: fcsInputReadOnly("Handling Fee/Courier Fee",
|
|
|
|
|
FontAwesomeIcons.moneyBill,
|
|
|
|
|
controller: _handlingFeeController),
|
|
|
|
|
)
|
|
|
|
|
: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 15.0),
|
|
|
|
|
child: fcsInputReadOnly("Handling Fee/Courier Fee",
|
|
|
|
|
FontAwesomeIcons.moneyBill,
|
|
|
|
|
controller: _handlingFeeController),
|
2020-06-01 14:42:42 +06:30
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
makeDropdown(),
|
|
|
|
|
makeLocation(context, _pickupAddress),
|
|
|
|
|
InputDate(
|
|
|
|
|
labelTextKey: "shipment.date",
|
|
|
|
|
iconData: Icons.date_range,
|
|
|
|
|
controller: _pickupDate,
|
|
|
|
|
),
|
|
|
|
|
pickupTimeBox,
|
|
|
|
|
_currVal == 3
|
|
|
|
|
? Container(
|
|
|
|
|
child: DeliveryAddressRow(
|
|
|
|
|
deliveryAddress: DeliveryAddress(
|
|
|
|
|
fullName: 'FCS Office',
|
|
|
|
|
addressLine1: '154-19 64th Ave.',
|
|
|
|
|
addressLine2: 'Flushing',
|
|
|
|
|
city: 'NY',
|
|
|
|
|
state: 'NY',
|
|
|
|
|
phoneNumber: '+1 (292)215-2247'),
|
2020-06-01 14:42:42 +06:30
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
)
|
|
|
|
|
: _currVal == 4
|
2020-07-01 08:12:59 +06:30
|
|
|
? Container(
|
2020-10-12 08:26:27 +06:30
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: 20, bottom: 15, right: 15),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 350,
|
|
|
|
|
height: 40,
|
|
|
|
|
child: FloatingActionButton.extended(
|
|
|
|
|
materialTapTargetSize:
|
|
|
|
|
MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
icon: Icon(Icons.arrow_right),
|
|
|
|
|
label: Text(
|
|
|
|
|
'Visit courier websie for nearest drop-off',
|
|
|
|
|
style: TextStyle(fontSize: 12),
|
2020-07-01 08:29:51 +06:30
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
backgroundColor: primaryColor,
|
2020-07-01 08:29:51 +06:30
|
|
|
),
|
|
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
: Container(),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'Boxes',
|
2020-07-02 16:16:21 +06:30
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
Spacer(),
|
|
|
|
|
IconButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
BottomUpPageRoute(PickupBoxEditor()),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.add,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: getBoxList(context, boxModel.boxes),
|
|
|
|
|
),
|
|
|
|
|
mainModel.isCustomer() || _isNew
|
|
|
|
|
? Container()
|
|
|
|
|
: ExpansionTile(
|
|
|
|
|
title: Text('For FCS'),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
widget.shipment != null
|
|
|
|
|
? widget.shipment.status == 'Pending'
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 20.0),
|
|
|
|
|
child: fcsDropDown("Assigned",
|
|
|
|
|
MaterialCommunityIcons.worker),
|
|
|
|
|
)
|
|
|
|
|
: Container()
|
|
|
|
|
: Container(),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 20),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(top: 8),
|
|
|
|
|
child: Text(
|
|
|
|
|
'Attach Courier Shiping Labels',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black, fontSize: 16),
|
|
|
|
|
),
|
2020-07-02 16:16:21 +06:30
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 10),
|
|
|
|
|
child: MultiImageFile(
|
|
|
|
|
enabled: true,
|
|
|
|
|
controller: multiImgController,
|
|
|
|
|
title: "Receipt File",
|
|
|
|
|
)),
|
|
|
|
|
],
|
2020-07-02 16:16:21 +06:30
|
|
|
),
|
|
|
|
|
),
|
2020-10-12 08:26:27 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
widget.shipment == null
|
2020-05-29 15:54:26 +06:30
|
|
|
? Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 250,
|
|
|
|
|
child: FlatButton(
|
2020-07-02 16:16:21 +06:30
|
|
|
child: Text('Create shipment'),
|
2020-05-29 15:54:26 +06:30
|
|
|
color: primaryColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)))
|
|
|
|
|
: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
2020-10-12 08:26:27 +06:30
|
|
|
widget.shipment.status == 'Confirmed'
|
2020-06-01 14:42:42 +06:30
|
|
|
? Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 250,
|
|
|
|
|
child: FlatButton(
|
2020-07-01 08:12:59 +06:30
|
|
|
child: Text('Complete Shipment'),
|
2020-06-01 14:42:42 +06:30
|
|
|
color: primaryColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)))
|
|
|
|
|
: Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 250,
|
|
|
|
|
child: FlatButton(
|
2020-07-02 16:16:21 +06:30
|
|
|
child: Text('Confirm Shipment'),
|
2020-06-01 14:42:42 +06:30
|
|
|
color: primaryColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
))),
|
2020-05-29 15:54:26 +06:30
|
|
|
Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 250,
|
|
|
|
|
child: FlatButton(
|
2020-07-01 08:12:59 +06:30
|
|
|
child: Text('Cancel Shipment'),
|
2020-05-31 15:00:11 +06:30
|
|
|
color: Colors.grey[600],
|
2020-05-29 15:54:26 +06:30
|
|
|
textColor: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)))
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-06-26 16:17:40 +06:30
|
|
|
|
2020-10-12 08:26:27 +06:30
|
|
|
Widget makeDropdown() {
|
|
|
|
|
ShipmentModel pickupModel = Provider.of<ShipmentModel>(context);
|
|
|
|
|
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 5.0, right: 0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 0, right: 10),
|
|
|
|
|
child: Icon(SimpleLineIcons.direction, color: primaryColor),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 18.0),
|
|
|
|
|
child: LocalText(
|
|
|
|
|
context,
|
|
|
|
|
"shipment.type",
|
|
|
|
|
color: Colors.black54,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
DropdownButton<String>(
|
|
|
|
|
isDense: true,
|
|
|
|
|
value: selectedPickupType,
|
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 14),
|
|
|
|
|
underline: Container(
|
|
|
|
|
height: 1,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
onChanged: (String newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedPickupType = newValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
items: pickupModel.pickupTypes
|
|
|
|
|
.map<DropdownMenuItem<String>>((String value) {
|
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
|
value: value,
|
|
|
|
|
child: Text(value ?? "",
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: TextStyle(color: primaryColor)),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget makeLocation(BuildContext context, DeliveryAddress deliveryAddress) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: DisplayText(
|
|
|
|
|
labelTextKey: "shipment.location",
|
|
|
|
|
iconData: MaterialCommunityIcons.truck_fast,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Chip(
|
|
|
|
|
label: InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
|
|
|
|
context,
|
|
|
|
|
BottomUpPageRoute(DeliveryAddressList(
|
|
|
|
|
forSelection: true,
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
setState(() {
|
|
|
|
|
this._pickupAddress = d;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: LocalText(context, "delivery_address.change_address",
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 28.0),
|
|
|
|
|
child: deliveryAddress == null
|
|
|
|
|
? Container()
|
|
|
|
|
: DeliveryAddressRow(
|
|
|
|
|
key: ValueKey(deliveryAddress.id),
|
|
|
|
|
deliveryAddress: deliveryAddress),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 16:17:40 +06:30
|
|
|
List<Widget> getBoxList(BuildContext context, List<Box> boxes) {
|
|
|
|
|
List<Box> _boxes = [boxes[0], boxes[1]];
|
|
|
|
|
|
|
|
|
|
return _boxes.asMap().entries.map((_box) {
|
2020-10-08 11:38:05 +06:30
|
|
|
DeliveryAddress shippingAddress = _box.value.shippingAddress;
|
2020-06-26 16:17:40 +06:30
|
|
|
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.push(BottomUpPageRoute(PickupBoxEditor(box: _box.value)));
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 10),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: new Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
|
|
|
|
child: new Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
new Expanded(
|
|
|
|
|
child: new Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.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),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: new Text(
|
|
|
|
|
"L${_box.value.length}xW${_box.value.weight}xH${_box.value.height}",
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.black),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: new Text(
|
|
|
|
|
_box.value.weight == null
|
|
|
|
|
? ''
|
2020-06-29 16:15:25 +06:30
|
|
|
: "Actual Weight:${_box.value.weight.toString()}lb",
|
|
|
|
|
style:
|
|
|
|
|
new TextStyle(fontSize: 14.0, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: new Text(
|
|
|
|
|
_box.value.shipmentWeight == null
|
|
|
|
|
? ''
|
|
|
|
|
: "Shipment Weight:${_box.value.shipmentWeight.toString()}lb",
|
2020-06-26 16:17:40 +06:30
|
|
|
style:
|
|
|
|
|
new TextStyle(fontSize: 14.0, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
_box.key == _boxes.length - 1
|
|
|
|
|
? Container()
|
|
|
|
|
: Divider(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
}
|
2020-05-29 15:54:26 +06:30
|
|
|
}
|