add shipment
This commit is contained in:
@@ -291,15 +291,20 @@
|
||||
|
||||
"Shipment Start ================================================================":"",
|
||||
"shipment": "Shipments",
|
||||
"shipment.title": "SHIPMENTS",
|
||||
"shipment.title": "Shipments",
|
||||
"shipment.new": "New Shipment",
|
||||
"shipment.edit.title": "SHIPMENT",
|
||||
"shipment.new.title": "New Shipment",
|
||||
"shipment.edit.title": "Edit Shipment",
|
||||
"shipment.type": "Pickup/Drop-off",
|
||||
"shipment.date": "Pickup Date",
|
||||
"shipment.time": "Pickup Time",
|
||||
"shipment.location": "Pickup Location",
|
||||
"shipment.location_time": "Pickup Location / Time",
|
||||
"shipment.information": "Pickup Informations",
|
||||
"shipment.recipient_information": "Recipient Informations",
|
||||
"shipment.from":"From",
|
||||
"shipment.to":"To",
|
||||
"shipment.box.delivery":"Delivery Address",
|
||||
"Shipment End ================================================================":"",
|
||||
|
||||
"Rate Start ================================================================":"",
|
||||
|
||||
@@ -293,13 +293,18 @@
|
||||
"shipment": "ပို့ဆောင်ခြင်းများ",
|
||||
"shipment.title": "ပို့ဆောင်ခြင်းများ",
|
||||
"shipment.new": "ပို့ဆောင်ခြင်း အသစ်",
|
||||
"shipment.edit.title": "PICKUP",
|
||||
"shipment.new.title": "ပို့ဆောင်ခြင်း အသစ်",
|
||||
"shipment.edit.title": "ပို့ဆောင်ခြင်း ပြင်ဆင်ခြင်း",
|
||||
"shipment.type": "Pickup/Drop-off",
|
||||
"shipment.date": "Pickup Date",
|
||||
"shipment.time": "Pickup Time",
|
||||
"shipment.location_time": "Pickup Location / Time",
|
||||
"shipment.location": "Pickup Location",
|
||||
"shipment.information": "Pickup Informations",
|
||||
"shipment.recipient_information": "Recipient Informations",
|
||||
"shipment.from":"From",
|
||||
"shipment.to":"To",
|
||||
"shipment.box.delivery":"Delivery Address",
|
||||
"Shipment End ================================================================":"",
|
||||
|
||||
"Rate Start ================================================================":"",
|
||||
|
||||
@@ -47,7 +47,7 @@ class AuthServiceImp implements AuthService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<User> joinInvite(String userName) {
|
||||
Future<void> joinInvite(String userName) {
|
||||
return authFb.joinInvite(userName);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ abstract class AuthService {
|
||||
Future<AuthResult> signInWithSmsCode(String smsCode);
|
||||
Future<void> signout();
|
||||
Future<void> signup(String userName);
|
||||
Future<User> joinInvite(String userName);
|
||||
Future<void> joinInvite(String userName);
|
||||
Future<void> updateProfileName(String newUserName);
|
||||
Future<void> updatePreferredCurrency(String currency);
|
||||
Future<bool> hasInvite();
|
||||
|
||||
@@ -48,3 +48,9 @@ const privilege_delivery = "deli";
|
||||
const privilege_invoice = "inv";
|
||||
const privilege_processing = "pr";
|
||||
const privilege_receiving = "rc";
|
||||
|
||||
// Pickup types
|
||||
const shipment_local_pickup = "Local Pickup";
|
||||
const shipment_courier_pickup = "Courier Pickup";
|
||||
const shipment_local_dropoff = "Local Drop-off";
|
||||
const shipment_courier_dropoff = "Courier Drop-off";
|
||||
|
||||
@@ -13,8 +13,11 @@ import 'delivery_address_row.dart';
|
||||
|
||||
class DeliveryAddressList extends StatefulWidget {
|
||||
final DeliveryAddress deliveryAddress;
|
||||
final bool forSelection;
|
||||
|
||||
const DeliveryAddressList({Key key, this.deliveryAddress}) : super(key: key);
|
||||
const DeliveryAddressList(
|
||||
{Key key, this.deliveryAddress, this.forSelection = false})
|
||||
: super(key: key);
|
||||
@override
|
||||
_DeliveryAddressListState createState() => _DeliveryAddressListState();
|
||||
}
|
||||
@@ -80,15 +83,18 @@ class _DeliveryAddressListState extends State<DeliveryAddressList> {
|
||||
_row(BuildContext context, DeliveryAddress deliveryAddress) {
|
||||
return Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => _select(deliveryAddress),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Icon(Icons.check,
|
||||
color:
|
||||
deliveryAddress.isDefault ? primaryColor : Colors.black26),
|
||||
),
|
||||
),
|
||||
widget.forSelection
|
||||
? Container()
|
||||
: InkWell(
|
||||
onTap: () => _select(deliveryAddress),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Icon(Icons.check,
|
||||
color: deliveryAddress.isDefault
|
||||
? primaryColor
|
||||
: Colors.black26),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: DeliveryAddressRow(
|
||||
key: ValueKey(deliveryAddress.id),
|
||||
@@ -100,6 +106,11 @@ class _DeliveryAddressListState extends State<DeliveryAddressList> {
|
||||
}
|
||||
|
||||
_edit(BuildContext context, DeliveryAddress deliveryAddress) {
|
||||
if (widget.forSelection) {
|
||||
Navigator.pop(context, deliveryAddress);
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(
|
||||
@@ -108,6 +119,10 @@ class _DeliveryAddressListState extends State<DeliveryAddressList> {
|
||||
}
|
||||
|
||||
Future<void> _select(DeliveryAddress deliveryAddress) async {
|
||||
if (widget.forSelection) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (deliveryAddress.isDefault) {
|
||||
Navigator.pop(context);
|
||||
return;
|
||||
|
||||
@@ -131,7 +131,9 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor)),
|
||||
fillColor: Colors.white,
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
labelStyle: languageModel.isEng
|
||||
? newLabelStyle(color: Colors.black54, fontSize: 20)
|
||||
: newLabelStyleMM(color: Colors.black54, fontSize: 20),
|
||||
labelText: AppTranslations.of(context)
|
||||
.text('FCSshipment.shipment_type'),
|
||||
icon: Icon(Ionicons.ios_airplane, color: primaryColor)),
|
||||
|
||||
@@ -173,6 +173,7 @@ class PackageModel extends BaseModel {
|
||||
.collection("$path")
|
||||
.where("tracking_id", isEqualTo: trackingID)
|
||||
.where("has_user_id", isEqualTo: false)
|
||||
.where("is_deleted", isEqualTo: false)
|
||||
.getDocuments(source: Source.server);
|
||||
if (qsnap.documents.length > 0) {
|
||||
var snap = qsnap.documents[0];
|
||||
@@ -186,6 +187,7 @@ class PackageModel extends BaseModel {
|
||||
.collection("$path")
|
||||
.where("tracking_id", isEqualTo: trackingID)
|
||||
.where("user_id", isEqualTo: user.id)
|
||||
.where("is_deleted", isEqualTo: false)
|
||||
.getDocuments(source: Source.server);
|
||||
if (qsnap.documents.length > 0) {
|
||||
var snap = qsnap.documents[0];
|
||||
|
||||
@@ -161,49 +161,58 @@ class _ProcessingEditorState extends State<ProcessingEditor> {
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
padding: const EdgeInsets.only(left: 5.0, right: 0),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 18.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"processing.market",
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 0, right: 10),
|
||||
child: Icon(Icons.store, color: primaryColor),
|
||||
),
|
||||
Container(
|
||||
width: 150,
|
||||
child: DropdownButton<String>(
|
||||
value: selectedMarket,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14),
|
||||
underline: Container(
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onChanged: (String newValue) {
|
||||
setState(() {
|
||||
if (newValue == MANAGE_MARKET) {
|
||||
selectedMarket = null;
|
||||
_manageMarket();
|
||||
return;
|
||||
}
|
||||
selectedMarket = newValue;
|
||||
});
|
||||
},
|
||||
isExpanded: true,
|
||||
items: markets.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value ?? "",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: value == MANAGE_MARKET
|
||||
? secondaryColor
|
||||
: primaryColor)),
|
||||
);
|
||||
}).toList(),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 18.0),
|
||||
child: LocalText(
|
||||
context,
|
||||
"processing.market",
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
DropdownButton<String>(
|
||||
isDense: true,
|
||||
value: selectedMarket,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14),
|
||||
underline: Container(
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onChanged: (String newValue) {
|
||||
setState(() {
|
||||
if (newValue == MANAGE_MARKET) {
|
||||
selectedMarket = null;
|
||||
_manageMarket();
|
||||
return;
|
||||
}
|
||||
selectedMarket = newValue;
|
||||
});
|
||||
},
|
||||
isExpanded: true,
|
||||
items: markets.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value ?? "",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: value == MANAGE_MARKET
|
||||
? secondaryColor
|
||||
: primaryColor)),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/main/model/main_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/package/model/package_model.dart';
|
||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||
@@ -14,8 +13,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
import 'processing_editor.dart';
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/cargo.dart';
|
||||
import 'package:fcs/domain/entities/pickup.dart';
|
||||
import 'package:fcs/domain/vo/radio.dart';
|
||||
@@ -31,6 +32,13 @@ class ShipmentModel extends BaseModel {
|
||||
),
|
||||
];
|
||||
|
||||
List<String> pickupTypes = [
|
||||
shipment_local_pickup,
|
||||
shipment_courier_pickup,
|
||||
shipment_local_dropoff,
|
||||
shipment_courier_dropoff
|
||||
];
|
||||
|
||||
List<RadioGroup> get radioGroups {
|
||||
List<RadioGroup> radioGroups = [
|
||||
RadioGroup(
|
||||
|
||||
@@ -4,13 +4,16 @@ import 'package:fcs/domain/entities/package.dart';
|
||||
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/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/widgets/bottom_up_page_route.dart';
|
||||
import 'package:fcs/pages/widgets/display_text.dart';
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:fcs/pages/widgets/my_data_table.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../main/util.dart';
|
||||
@@ -30,14 +33,14 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||
bool isNew;
|
||||
|
||||
bool isMixBox = false;
|
||||
DeliveryAddress _shippingAddress = new DeliveryAddress();
|
||||
DeliveryAddress _deliveryAddress = new DeliveryAddress();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.box != null) {
|
||||
_box = widget.box;
|
||||
_shippingAddress = _box.shippingAddress;
|
||||
_deliveryAddress = _box.shippingAddress;
|
||||
|
||||
isNew = false;
|
||||
} else {
|
||||
@@ -55,7 +58,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||
|
||||
var shipmentModel =
|
||||
Provider.of<DeliveryAddressModel>(context, listen: false);
|
||||
_shippingAddress = shipmentModel.deliveryAddresses[1];
|
||||
_deliveryAddress = shipmentModel.deliveryAddresses[1];
|
||||
|
||||
isNew = true;
|
||||
_box = Box(
|
||||
@@ -111,7 +114,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Actual Weight',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.weightHanging,
|
||||
icon: Icon(MaterialCommunityIcons.weight,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
@@ -170,7 +173,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: fcsInputReadOnly(
|
||||
"Shipment Weight", FontAwesomeIcons.weightHanging,
|
||||
"Shipment Weight", MaterialCommunityIcons.weight,
|
||||
value: _box.shipmentWeight.toString()),
|
||||
),
|
||||
Padding(
|
||||
@@ -182,7 +185,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Width',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowCircleRight,
|
||||
icon: Icon(FontAwesome.arrow_circle_right,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
@@ -195,7 +198,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Height',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowAltCircleUp,
|
||||
icon: Icon(FontAwesome.arrow_circle_up,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
@@ -208,46 +211,14 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Length',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.arrowCircleUp,
|
||||
icon: Icon(FontAwesome.arrow_circle_left,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
ExpansionTile(
|
||||
title: Text(
|
||||
'Shipment Address',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: [
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
makeLocation(context, _deliveryAddress),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -292,6 +263,48 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget makeLocation(BuildContext context, DeliveryAddress deliveryAddress) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
labelTextKey: "shipment.box.delivery",
|
||||
iconData: MaterialCommunityIcons.truck_fast,
|
||||
),
|
||||
),
|
||||
Chip(
|
||||
label: InkWell(
|
||||
onTap: () async {
|
||||
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
||||
context,
|
||||
BottomUpPageRoute(DeliveryAddressList(
|
||||
forSelection: true,
|
||||
)),
|
||||
);
|
||||
setState(() {
|
||||
this._deliveryAddress = 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<MyDataRow> getCargoRows(BuildContext context) {
|
||||
if (_box == null || _box.cargoTypes == null) {
|
||||
return [];
|
||||
|
||||
@@ -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]];
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class _ShipmentListRowState extends State<ShipmentListRow> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.push(BottomUpPageRoute(ShipmentEditor(pickUp: _pickUp)));
|
||||
.push(BottomUpPageRoute(ShipmentEditor(shipment: _pickUp)));
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
|
||||
@@ -73,7 +73,9 @@ class InputDate extends StatelessWidget {
|
||||
labelText: labelTextKey == null
|
||||
? null
|
||||
: AppTranslations.of(context).text(labelTextKey),
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
labelStyle: languageModel.isEng
|
||||
? newLabelStyle(color: Colors.black54, fontSize: 20)
|
||||
: newLabelStyleMM(color: Colors.black54, fontSize: 20),
|
||||
icon: iconData == null
|
||||
? null
|
||||
: Icon(
|
||||
|
||||
@@ -49,7 +49,9 @@ class InputText extends StatelessWidget {
|
||||
labelText: labelTextKey == null
|
||||
? null
|
||||
: AppTranslations.of(context).text(labelTextKey),
|
||||
labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
labelStyle: languageModel.isEng
|
||||
? newLabelStyle(color: Colors.black54, fontSize: 20)
|
||||
: newLabelStyleMM(color: Colors.black54, fontSize: 20),
|
||||
icon: iconData == null
|
||||
? null
|
||||
: Icon(
|
||||
|
||||
98
lib/pages/widgets/input_time.dart
Normal file
98
lib/pages/widgets/input_time.dart
Normal file
@@ -0,0 +1,98 @@
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class InputTime extends StatelessWidget {
|
||||
final String labelTextKey;
|
||||
final IconData iconData;
|
||||
final TextEditingController controller;
|
||||
final FormFieldValidator<String> validator;
|
||||
final int maxLines;
|
||||
final bool withBorder;
|
||||
final Color borderColor;
|
||||
final TextInputType textInputType;
|
||||
final bool autoFocus;
|
||||
|
||||
const InputTime(
|
||||
{Key key,
|
||||
this.labelTextKey,
|
||||
this.iconData,
|
||||
this.controller,
|
||||
this.validator,
|
||||
this.maxLines = 1,
|
||||
this.withBorder = false,
|
||||
this.borderColor,
|
||||
this.autoFocus = false,
|
||||
this.textInputType})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 15.0, bottom: 5),
|
||||
child: TextFormField(
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
FocusScope.of(context).unfocus();
|
||||
var initialDate = TimeOfDay.now();
|
||||
if (controller != null) {
|
||||
try {
|
||||
var values = controller.text.split(":");
|
||||
initialDate = TimeOfDay(
|
||||
hour: int.parse(values[0]), minute: int.parse(values[1]));
|
||||
} catch (e) {} // ignore error
|
||||
}
|
||||
|
||||
var t = await showTimePicker(
|
||||
initialTime: initialDate,
|
||||
context: context,
|
||||
);
|
||||
if (t != null && controller != null) {
|
||||
controller.text = "${t.hour} : ${t.minute}";
|
||||
}
|
||||
},
|
||||
controller: controller,
|
||||
autofocus: autoFocus,
|
||||
cursorColor: primaryColor,
|
||||
style: textStyle,
|
||||
maxLines: maxLines,
|
||||
keyboardType: textInputType,
|
||||
decoration: new InputDecoration(
|
||||
// hintText: '',
|
||||
hintStyle: TextStyle(
|
||||
height: 1.5,
|
||||
),
|
||||
labelText: labelTextKey == null
|
||||
? null
|
||||
: AppTranslations.of(context).text(labelTextKey),
|
||||
labelStyle: languageModel.isEng
|
||||
? newLabelStyle(color: Colors.black54, fontSize: 20)
|
||||
: newLabelStyleMM(color: Colors.black54, fontSize: 20),
|
||||
icon: iconData == null
|
||||
? null
|
||||
: Icon(
|
||||
iconData,
|
||||
color: primaryColor,
|
||||
),
|
||||
enabledBorder: withBorder
|
||||
? OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0),
|
||||
)
|
||||
: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: withBorder
|
||||
? OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0),
|
||||
)
|
||||
: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
validator: validator),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ name: fcs
|
||||
description: FCS Logistics
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 1.0.0+1
|
||||
version: 1.0.0+2
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
||||
Reference in New Issue
Block a user