add shipment
This commit is contained in:
@@ -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 [];
|
||||
|
||||
Reference in New Issue
Block a user