add shipment
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/box.dart';
|
||||
import 'package:fcs/domain/entities/cargo.dart';
|
||||
import 'package:fcs/domain/entities/pickup.dart';
|
||||
@@ -5,13 +6,17 @@ import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/box/model/box_model.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_list.dart';
|
||||
import 'package:fcs/pages/delivery_address/delivery_address_row.dart';
|
||||
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/shipment/model/shipment_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/input_date.dart';
|
||||
import 'package:fcs/pages/widgets/input_text.dart';
|
||||
import 'package:fcs/pages/widgets/input_time.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
||||
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
||||
@@ -27,8 +32,8 @@ import 'package:flutter/material.dart';
|
||||
import 'pickup_box_editor.dart';
|
||||
|
||||
class ShipmentEditor extends StatefulWidget {
|
||||
final Shipment pickUp;
|
||||
ShipmentEditor({this.pickUp});
|
||||
final Shipment shipment;
|
||||
ShipmentEditor({this.shipment});
|
||||
|
||||
@override
|
||||
_ShipmentEditorState createState() => _ShipmentEditorState();
|
||||
@@ -58,17 +63,20 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
Shipment _pickUp;
|
||||
bool _isLoading = false;
|
||||
var now = new DateTime.now();
|
||||
bool isNew;
|
||||
DeliveryAddress _shippingAddress = new DeliveryAddress();
|
||||
bool _isNew;
|
||||
DeliveryAddress _pickupAddress = new DeliveryAddress();
|
||||
|
||||
int _currVal = 1;
|
||||
String selectedPickupType;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.pickUp != null) {
|
||||
isNew = false;
|
||||
_pickUp = widget.pickUp;
|
||||
selectedPickupType = shipment_local_pickup;
|
||||
|
||||
if (widget.shipment != null) {
|
||||
_isNew = false;
|
||||
_pickUp = widget.shipment;
|
||||
_addressEditingController.text = _pickUp.address;
|
||||
_fromTimeEditingController.text = _pickUp.fromTime;
|
||||
_toTimeEditingController.text = _pickUp.toTime;
|
||||
@@ -84,7 +92,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
// _recipientAddressEditingController.text =
|
||||
// mainModel.recipient.shippingAddress;
|
||||
} else {
|
||||
isNew = true;
|
||||
_isNew = true;
|
||||
List<Cargo> _cargoTypes = [
|
||||
Cargo(type: 'General Cargo', weight: 25),
|
||||
Cargo(type: 'Medicine', weight: 20),
|
||||
@@ -94,7 +102,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
}
|
||||
var shipmentModel =
|
||||
Provider.of<DeliveryAddressModel>(context, listen: false);
|
||||
_shippingAddress = shipmentModel.deliveryAddresses[1];
|
||||
_pickupAddress = shipmentModel.defalutAddress;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -104,17 +112,13 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var pickupModel = Provider.of<ShipmentModel>(context);
|
||||
|
||||
final fromTimeBox = InputText(
|
||||
final fromTimeBox = InputTime(
|
||||
labelTextKey: 'shipment.from',
|
||||
iconData: Icons.timer,
|
||||
controller: _fromTimeEditingController);
|
||||
|
||||
final toTimeBox = InputText(
|
||||
labelTextKey: 'shipment.to',
|
||||
iconData: null,
|
||||
controller: _toTimeEditingController);
|
||||
final toTimeBox = InputTime(
|
||||
labelTextKey: 'shipment.to', controller: _toTimeEditingController);
|
||||
|
||||
final fromTimeBoxReadOnly = fcsInputReadOnly(
|
||||
'From',
|
||||
@@ -128,25 +132,23 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
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(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: toTimeBox,
|
||||
width: 120,
|
||||
),
|
||||
],
|
||||
),
|
||||
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,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
final pickupTimeReadOnly = Padding(
|
||||
@@ -170,54 +172,6 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
),
|
||||
);
|
||||
|
||||
final noOfPackageBoxReadonly = fcsInputReadOnly(
|
||||
'Number of Packages',
|
||||
Octicons.package,
|
||||
controller: _noOfPackageEditingController,
|
||||
);
|
||||
|
||||
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,
|
||||
labelText: AppTranslations.of(context).text("shipment.date"),
|
||||
// labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0),
|
||||
icon: Icon(
|
||||
Icons.date_range,
|
||||
color: primaryColor,
|
||||
)),
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return AppTranslations.of(context).text("do.form.date");
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
));
|
||||
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
var boxModel = Provider.of<BoxModel>(context);
|
||||
|
||||
@@ -230,386 +184,165 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(context, "shipment.edit.title",
|
||||
fontSize: 18, color: Colors.white),
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
title: LocalText(
|
||||
context,
|
||||
_isNew ? "shipment.new.title" : "shipment.edit.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
body: Card(
|
||||
child: Column(
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(children: <Widget>[
|
||||
Center(child: nameWidget("mainModel.customer.name")),
|
||||
Center(child: nameWidget("mainModel.customer.phoneNumber")),
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
widget.pickUp == null
|
||||
? Container()
|
||||
: widget.pickUp.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),
|
||||
),
|
||||
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Pickup/Drop-off',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: <Widget>[
|
||||
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(),
|
||||
_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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_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'),
|
||||
),
|
||||
),
|
||||
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),
|
||||
)
|
||||
: _currVal == 4
|
||||
? Container(
|
||||
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),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(left: 15.0),
|
||||
child: fcsInputReadOnly("Handling Fee/Courier Fee",
|
||||
FontAwesomeIcons.moneyBill,
|
||||
controller: _handlingFeeController),
|
||||
),
|
||||
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'),
|
||||
),
|
||||
)
|
||||
: _currVal == 4
|
||||
? Container(
|
||||
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),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
: Container(),
|
||||
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Package Information',
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
: Container(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Boxes',
|
||||
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),
|
||||
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),
|
||||
),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: MultiImageFile(
|
||||
enabled: true,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.0),
|
||||
],
|
||||
),
|
||||
_currVal == 3 || _currVal == 4
|
||||
? Container()
|
||||
: ExpansionTile(
|
||||
title: Text(
|
||||
'Pickup Location / Time',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: <Widget>[
|
||||
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),
|
||||
child: DeliveryAddressRow(
|
||||
deliveryAddress: _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),
|
||||
],
|
||||
),
|
||||
// ExpansionTile(
|
||||
// title: Text(
|
||||
// 'Package Information',
|
||||
// style: TextStyle(
|
||||
// color: primaryColor, fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// children: <Widget>[
|
||||
// Padding(
|
||||
// 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),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 20.0),
|
||||
// child: fcsInput("Remark", MaterialCommunityIcons.note),
|
||||
// ),
|
||||
// Padding(
|
||||
// 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),
|
||||
// ],
|
||||
// ),
|
||||
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(),
|
||||
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",
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]),
|
||||
)),
|
||||
widget.pickUp == null
|
||||
],
|
||||
),
|
||||
widget.shipment == null
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
@@ -627,7 +360,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
widget.pickUp.status == 'Confirmed'
|
||||
widget.shipment.status == 'Confirmed'
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
@@ -679,6 +412,104 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
);
|
||||
}
|
||||
|
||||
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),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> getBoxList(BuildContext context, List<Box> boxes) {
|
||||
List<Box> _boxes = [boxes[0], boxes[1]];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user