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-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-08 11:43:53 +06:30
|
|
|
import 'package:fcs/pages/widgets/input_text.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 {
|
|
|
|
|
final Shipment pickUp;
|
|
|
|
|
ShipmentEditor({this.pickUp});
|
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-06-03 00:42:31 +06:30
|
|
|
bool isNew;
|
2020-10-08 11:38:05 +06:30
|
|
|
DeliveryAddress _shippingAddress = new DeliveryAddress();
|
2020-05-29 15:54:26 +06:30
|
|
|
|
2020-07-01 08:12:59 +06:30
|
|
|
int _currVal = 1;
|
2020-06-30 16:27:56 +06:30
|
|
|
|
2020-05-29 15:54:26 +06:30
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
if (widget.pickUp != null) {
|
2020-06-03 00:42:31 +06:30
|
|
|
isNew = false;
|
2020-05-29 15:54:26 +06:30
|
|
|
_pickUp = widget.pickUp;
|
|
|
|
|
_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 {
|
|
|
|
|
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);
|
|
|
|
|
_shippingAddress = shipmentModel.deliveryAddresses[1];
|
2020-05-29 15:54:26 +06:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-10-07 14:42:07 +06:30
|
|
|
var pickupModel = Provider.of<ShipmentModel>(context);
|
2020-05-29 15:54:26 +06:30
|
|
|
|
2020-10-08 11:43:53 +06:30
|
|
|
final fromTimeBox = InputText(
|
|
|
|
|
labelTextKey: 'shipment.from',
|
|
|
|
|
iconData: Icons.timer,
|
|
|
|
|
controller: _fromTimeEditingController);
|
2020-05-29 15:54:26 +06:30
|
|
|
|
2020-10-08 11:43:53 +06:30
|
|
|
final toTimeBox = InputText(
|
|
|
|
|
labelTextKey: 'shipment.to',
|
|
|
|
|
iconData: null,
|
|
|
|
|
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,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final pickupTime = Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 20.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: fromTimeBox,
|
|
|
|
|
width: 120,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: Text('-'),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
2020-10-08 11:43:53 +06:30
|
|
|
padding: EdgeInsets.only(left: 20),
|
2020-06-02 14:52:31 +06:30
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final noOfPackageBoxReadonly = fcsInputReadOnly(
|
|
|
|
|
'Number of Packages',
|
|
|
|
|
Octicons.package,
|
|
|
|
|
controller: _noOfPackageEditingController,
|
2020-05-29 15:54:26 +06:30
|
|
|
);
|
|
|
|
|
|
2020-06-01 14:42:42 +06:30
|
|
|
final requestDateBox = Container(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showDatePicker(
|
|
|
|
|
context,
|
|
|
|
|
showTitleActions: true,
|
|
|
|
|
currentTime: _pickupDate.text == ""
|
|
|
|
|
? null
|
|
|
|
|
: dateFormatter.parse(_pickupDate.text),
|
|
|
|
|
minTime: DateTime.now(),
|
|
|
|
|
maxTime: DateTime(2030, 12, 31),
|
|
|
|
|
onConfirm: (date) {},
|
|
|
|
|
locale: LocaleType.en,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
controller: _pickupDate,
|
|
|
|
|
autofocus: false,
|
|
|
|
|
cursorColor: primaryColor,
|
|
|
|
|
style: textStyle,
|
|
|
|
|
enabled: false,
|
|
|
|
|
keyboardType: TextInputType.datetime,
|
|
|
|
|
decoration: new InputDecoration(
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
2020-10-07 19:53:47 +06:30
|
|
|
labelText: AppTranslations.of(context).text("shipment.date"),
|
2020-06-01 14:42:42 +06:30
|
|
|
// labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
|
|
|
|
contentPadding:
|
|
|
|
|
EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0),
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.date_range,
|
2020-06-03 00:42:31 +06:30
|
|
|
color: primaryColor,
|
2020-06-01 14:42:42 +06:30
|
|
|
)),
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return AppTranslations.of(context).text("do.form.date");
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
|
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-05-29 15:54:26 +06:30
|
|
|
backgroundColor: primaryColor,
|
2020-10-07 19:53:47 +06:30
|
|
|
title: LocalText(context, "shipment.edit.title",
|
2020-10-08 11:38:05 +06:30
|
|
|
fontSize: 18, color: Colors.white),
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
|
|
|
|
body: Card(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
2020-06-01 08:12:04 +06:30
|
|
|
padding: const EdgeInsets.all(10.0),
|
2020-05-29 15:54:26 +06:30
|
|
|
child: ListView(children: <Widget>[
|
2020-10-07 02:33:06 +06:30
|
|
|
Center(child: nameWidget("mainModel.customer.name")),
|
|
|
|
|
Center(child: nameWidget("mainModel.customer.phoneNumber")),
|
2020-06-03 00:42:31 +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-29 16:15:25 +06:30
|
|
|
widget.pickUp == null
|
|
|
|
|
? Container()
|
2020-06-30 16:27:56 +06:30
|
|
|
: widget.pickUp.isCourier
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 15.0),
|
|
|
|
|
child: fcsInputReadOnly(
|
2020-07-02 16:16:21 +06:30
|
|
|
"Handling Fee/Courier Fee",
|
|
|
|
|
FontAwesomeIcons.moneyBill,
|
2020-06-30 16:27:56 +06:30
|
|
|
controller: _handlingFeeController),
|
|
|
|
|
)
|
|
|
|
|
: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 15.0),
|
|
|
|
|
child: fcsInputReadOnly(
|
2020-07-02 16:16:21 +06:30
|
|
|
"Handling Fee/Courier Fee",
|
|
|
|
|
FontAwesomeIcons.moneyBill,
|
2020-06-30 16:27:56 +06:30
|
|
|
controller: _handlingFeeController),
|
|
|
|
|
),
|
|
|
|
|
|
2020-06-01 14:42:42 +06:30
|
|
|
ExpansionTile(
|
2020-06-26 16:17:40 +06:30
|
|
|
title: Text(
|
2020-07-02 16:16:21 +06:30
|
|
|
'Pickup/Drop-off',
|
2020-06-26 16:17:40 +06:30
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
children: <Widget>[
|
2020-06-30 16:27:56 +06:30
|
|
|
Container(
|
|
|
|
|
child: Wrap(
|
|
|
|
|
children: pickupModel.radioGroups
|
|
|
|
|
.map((t) => RadioListTile(
|
|
|
|
|
title: Text("${t.text}"),
|
|
|
|
|
groupValue: _currVal,
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
|
value: t.index,
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_currVal = val;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
.toList(),
|
2020-06-01 14:42:42 +06:30
|
|
|
),
|
|
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
],
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
2020-07-01 08:12:59 +06:30
|
|
|
_currVal == 3
|
|
|
|
|
? Container(
|
2020-10-08 15:54:43 +06:30
|
|
|
child: DeliveryAddressRow(
|
2020-10-08 11:38:05 +06:30
|
|
|
shippingAddress: DeliveryAddress(
|
2020-07-02 16:16:21 +06:30
|
|
|
fullName: 'FCS Office',
|
2020-07-01 08:12:59 +06:30
|
|
|
addressLine1: '154-19 64th Ave.',
|
|
|
|
|
addressLine2: 'Flushing',
|
|
|
|
|
city: 'NY',
|
|
|
|
|
state: 'NY',
|
|
|
|
|
phoneNumber: '+1 (292)215-2247'),
|
|
|
|
|
),
|
|
|
|
|
)
|
2020-07-01 08:29:51 +06:30
|
|
|
: _currVal == 4
|
|
|
|
|
? Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: 20, bottom: 15, right: 15),
|
|
|
|
|
child: Align(
|
2020-07-02 16:16:21 +06:30
|
|
|
alignment: Alignment.center,
|
2020-07-01 08:29:51 +06:30
|
|
|
child: Container(
|
2020-07-02 16:16:21 +06:30
|
|
|
width: 350,
|
2020-07-01 08:29:51 +06:30
|
|
|
height: 40,
|
|
|
|
|
child: FloatingActionButton.extended(
|
|
|
|
|
materialTapTargetSize:
|
|
|
|
|
MaterialTapTargetSize.shrinkWrap,
|
2020-07-02 16:16:21 +06:30
|
|
|
onPressed: () {},
|
|
|
|
|
icon: Icon(Icons.arrow_right),
|
2020-07-01 08:29:51 +06:30
|
|
|
label: Text(
|
2020-07-02 16:16:21 +06:30
|
|
|
'Visit courier websie for nearest drop-off',
|
2020-07-01 08:29:51 +06:30
|
|
|
style: TextStyle(fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
2020-07-02 16:16:21 +06:30
|
|
|
))
|
|
|
|
|
: Container(),
|
|
|
|
|
|
|
|
|
|
ExpansionTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
'Package Information',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Column(
|
|
|
|
|
children: getBoxList(context, boxModel.boxes),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.bottomRight,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 120,
|
|
|
|
|
height: 40,
|
|
|
|
|
child: FloatingActionButton.extended(
|
|
|
|
|
materialTapTargetSize:
|
|
|
|
|
MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
icon: Icon(Icons.add),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
BottomUpPageRoute(PickupBoxEditor()),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
label: Text(
|
|
|
|
|
'Add Package',
|
|
|
|
|
style: TextStyle(fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: primaryColor,
|
2020-06-30 16:27:56 +06:30
|
|
|
),
|
2020-07-02 16:16:21 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 10.0),
|
|
|
|
|
],
|
|
|
|
|
),
|
2020-07-01 08:29:51 +06:30
|
|
|
_currVal == 3 || _currVal == 4
|
2020-07-01 08:12:59 +06:30
|
|
|
? Container()
|
|
|
|
|
: ExpansionTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
'Pickup Location / Time',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
2020-06-30 16:27:56 +06:30
|
|
|
children: <Widget>[
|
2020-07-01 08:12:59 +06:30
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 20.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.location_on,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Text('Pickup Address'),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 10.0),
|
2020-10-08 15:54:43 +06:30
|
|
|
child: DeliveryAddressRow(
|
2020-07-01 08:12:59 +06:30
|
|
|
shippingAddress: _shippingAddress),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
top: 20, bottom: 15, right: 15),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.bottomRight,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 120,
|
|
|
|
|
height: 40,
|
|
|
|
|
child: FloatingActionButton.extended(
|
|
|
|
|
materialTapTargetSize:
|
|
|
|
|
MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
icon: Icon(Icons.add),
|
|
|
|
|
label: Text(
|
|
|
|
|
'Select\nAddress',
|
|
|
|
|
style: TextStyle(fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
// child: ExpansionTile(
|
|
|
|
|
// leading: Icon(
|
|
|
|
|
// Icons.location_on,
|
|
|
|
|
// color: primaryColor,
|
|
|
|
|
// ),
|
|
|
|
|
// title: Text('My Address'),
|
|
|
|
|
// children: [
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.only(left: 10.0),
|
|
|
|
|
// child: ShippingAddressRow(
|
|
|
|
|
// shippingAddress: _shippingAddress),
|
|
|
|
|
// ),
|
|
|
|
|
// Container(
|
|
|
|
|
// padding: EdgeInsets.only(
|
|
|
|
|
// top: 20, bottom: 15, right: 15),
|
|
|
|
|
// child: Align(
|
|
|
|
|
// alignment: Alignment.bottomRight,
|
|
|
|
|
// child: Container(
|
|
|
|
|
// width: 120,
|
|
|
|
|
// height: 40,
|
|
|
|
|
// child: FloatingActionButton.extended(
|
|
|
|
|
// materialTapTargetSize:
|
|
|
|
|
// MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
// onPressed: () {},
|
|
|
|
|
// icon: Icon(Icons.add),
|
|
|
|
|
// label: Text(
|
|
|
|
|
// 'Select\nAddress',
|
|
|
|
|
// style: TextStyle(fontSize: 12),
|
|
|
|
|
// ),
|
|
|
|
|
// backgroundColor: primaryColor,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
),
|
|
|
|
|
widget.pickUp == null
|
|
|
|
|
? pickupTime
|
|
|
|
|
: widget.pickUp.status == 'Pending'
|
|
|
|
|
? pickupTime
|
|
|
|
|
: pickupTimeReadOnly,
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 20.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SizedBox(height: 5),
|
|
|
|
|
Container(height: 50.0, child: requestDateBox)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 15.0),
|
2020-06-30 16:27:56 +06:30
|
|
|
],
|
|
|
|
|
),
|
2020-06-26 16:17:40 +06:30
|
|
|
// ExpansionTile(
|
|
|
|
|
// title: Text(
|
2020-06-30 16:27:56 +06:30
|
|
|
// 'Package Information',
|
2020-06-26 16:17:40 +06:30
|
|
|
// style: TextStyle(
|
|
|
|
|
// color: primaryColor, fontWeight: FontWeight.bold),
|
|
|
|
|
// ),
|
|
|
|
|
// children: <Widget>[
|
|
|
|
|
// Padding(
|
2020-06-30 16:27:56 +06:30
|
|
|
// padding: const EdgeInsets.only(left: 20.0),
|
|
|
|
|
// child: widget.pickUp == null
|
|
|
|
|
// ? noOfPackageBox
|
|
|
|
|
// : widget.pickUp.status == 'Pending'
|
|
|
|
|
// ? noOfPackageBox
|
|
|
|
|
// : noOfPackageBoxReadonly,
|
|
|
|
|
// ),
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.only(left: 20.0),
|
|
|
|
|
// child: widget.pickUp == null
|
|
|
|
|
// ? fcsInput("Total Weight (lb)",
|
|
|
|
|
// FontAwesomeIcons.weightHanging,
|
|
|
|
|
// controller: _weightEditingController)
|
|
|
|
|
// : widget.pickUp.status == 'Pending'
|
|
|
|
|
// ? fcsInput("Total Weight (lb)",
|
|
|
|
|
// FontAwesomeIcons.weightHanging,
|
|
|
|
|
// controller: _weightEditingController)
|
|
|
|
|
// : fcsInputReadOnly("Total Weight (lb)",
|
|
|
|
|
// FontAwesomeIcons.weightHanging,
|
|
|
|
|
// controller: _weightEditingController),
|
|
|
|
|
// ),
|
2020-06-26 16:17:40 +06:30
|
|
|
// Padding(
|
2020-06-30 16:27:56 +06:30
|
|
|
// padding: const EdgeInsets.only(left: 20.0),
|
|
|
|
|
// child: fcsInput("Remark", MaterialCommunityIcons.note),
|
|
|
|
|
// ),
|
2020-06-26 16:17:40 +06:30
|
|
|
// Padding(
|
2020-06-30 16:27:56 +06:30
|
|
|
// padding: const EdgeInsets.only(left: 3.0),
|
|
|
|
|
// child: ExpansionTile(
|
|
|
|
|
// leading: Icon(
|
|
|
|
|
// SimpleLineIcons.location_pin,
|
|
|
|
|
// color: primaryColor,
|
|
|
|
|
// ),
|
|
|
|
|
// title: Text(
|
|
|
|
|
// 'Shipping Address',
|
|
|
|
|
// ),
|
|
|
|
|
// children: [
|
|
|
|
|
// ShippingAddressRow(
|
|
|
|
|
// shippingAddress: _shippingAddress),
|
|
|
|
|
// 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: () {},
|
|
|
|
|
// icon: Icon(Icons.add),
|
|
|
|
|
// label: Text(
|
|
|
|
|
// 'Add Shipping\nAddress',
|
|
|
|
|
// style: TextStyle(fontSize: 12),
|
|
|
|
|
// ),
|
|
|
|
|
// backgroundColor: primaryColor,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(height: 10.0),
|
2020-06-26 16:17:40 +06:30
|
|
|
// ],
|
|
|
|
|
// ),
|
2020-06-24 16:06:40 +06:30
|
|
|
mainModel.isCustomer()
|
|
|
|
|
? Container()
|
|
|
|
|
: ExpansionTile(
|
|
|
|
|
title: Text('For FCS'),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
widget.pickUp != null
|
|
|
|
|
? widget.pickUp.status == 'Pending'
|
|
|
|
|
? Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(left: 20.0),
|
|
|
|
|
child: fcsDropDown("Assigned",
|
|
|
|
|
MaterialCommunityIcons.worker),
|
|
|
|
|
)
|
|
|
|
|
: Container()
|
|
|
|
|
: Container(),
|
2020-07-02 16:16:21 +06:30
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 10),
|
|
|
|
|
child: MultiImageFile(
|
|
|
|
|
enabled: true,
|
|
|
|
|
controller: multiImgController,
|
|
|
|
|
title: "Receipt File",
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2020-06-24 16:06:40 +06:30
|
|
|
],
|
|
|
|
|
),
|
2020-05-29 15:54:26 +06:30
|
|
|
]),
|
|
|
|
|
)),
|
|
|
|
|
widget.pickUp == null
|
|
|
|
|
? 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-06-26 16:17:40 +06:30
|
|
|
widget.pickUp.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
|
|
|
|
|
|
|
|
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
|
|
|
}
|