add length picker
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
"btn.select":"Select",
|
"btn.select":"Select",
|
||||||
"btn.cancel":"Cancel",
|
"btn.cancel":"Cancel",
|
||||||
"btn.ok": "Ok",
|
"btn.ok": "Ok",
|
||||||
|
"feet":"Feet",
|
||||||
|
"inch":"Inch",
|
||||||
"Buttons End ================================================================":"",
|
"Buttons End ================================================================":"",
|
||||||
|
|
||||||
"Offline Start ================================================================":"",
|
"Offline Start ================================================================":"",
|
||||||
@@ -294,23 +296,24 @@
|
|||||||
"Shipment Start ================================================================":"",
|
"Shipment Start ================================================================":"",
|
||||||
"shipment": "Shipments",
|
"shipment": "Shipments",
|
||||||
"shipment.title": "Shipments",
|
"shipment.title": "Shipments",
|
||||||
"shipment.new": "Request Shipment",
|
"shipment.new": "Request shipment",
|
||||||
"shipment.new.title": "New Shipment",
|
"shipment.new.title": "New Shipment",
|
||||||
"shipment.edit.title": "Edit Shipment",
|
"shipment.edit.title": "Edit Shipment",
|
||||||
"shipment.type": "Pickup/Drop-off",
|
"shipment.type": "Pickup/drop-off",
|
||||||
"shipment.date": "Pickup Date",
|
"shipment.date": "Pickup date",
|
||||||
"shipment.time": "Pickup Time",
|
"shipment.date.time": "Pickup date/time",
|
||||||
"shipment.location": "Pickup Location",
|
"shipment.time": "Pickup time",
|
||||||
|
"shipment.location": "Pickup address",
|
||||||
"shipment.location_time": "Pickup Location / Time",
|
"shipment.location_time": "Pickup Location / Time",
|
||||||
"shipment.information": "Pickup Informations",
|
"shipment.information": "Pickup information",
|
||||||
"shipment.recipient_information": "Recipient Informations",
|
"shipment.recipient_information": "Recipient Informations",
|
||||||
"shipment.from":"From",
|
"shipment.from":"Ready time",
|
||||||
"shipment.to":"To",
|
"shipment.to":"Latest time available",
|
||||||
"shipment.box.delivery":"Delivery Address",
|
"shipment.box.delivery":"Delivery Address",
|
||||||
"shipment.handling.fee":"Handling Fee/Courier Fee",
|
"shipment.handling.fee":"Handling Fee/Courier Fee",
|
||||||
"shipment.box.cargo.type":"Cargo Types",
|
"shipment.box.cargo.type":"Cargo Types",
|
||||||
"shipment.box.dimemsion":"Dimension",
|
"shipment.box.dimemsion":"Dimension",
|
||||||
"shipment.box.shipment.weight":"Shipment Weight",
|
"shipment.box.shipment.weight":"Shipment weight",
|
||||||
"shipment.box.length":"Length",
|
"shipment.box.length":"Length",
|
||||||
"shipment.box.width":"Width",
|
"shipment.box.width":"Width",
|
||||||
"shipment.box.height":"Height",
|
"shipment.box.height":"Height",
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
"btn.select":"ရွေးချယ်ပါ",
|
"btn.select":"ရွေးချယ်ပါ",
|
||||||
"btn.cancel":"မလုပ်နဲ့",
|
"btn.cancel":"မလုပ်နဲ့",
|
||||||
"btn.ok": "အိုကေ",
|
"btn.ok": "အိုကေ",
|
||||||
|
"feet":"ပေ",
|
||||||
|
"inch":"လက်မ",
|
||||||
"Buttons End ================================================================":"",
|
"Buttons End ================================================================":"",
|
||||||
|
|
||||||
"Offline Start ================================================================":"",
|
"Offline Start ================================================================":"",
|
||||||
@@ -298,11 +300,12 @@
|
|||||||
"shipment.new.title": "ပို့ဆောင်ခြင်း အသစ်",
|
"shipment.new.title": "ပို့ဆောင်ခြင်း အသစ်",
|
||||||
"shipment.edit.title": "ပို့ဆောင်ခြင်း ပြင်ဆင်ခြင်း",
|
"shipment.edit.title": "ပို့ဆောင်ခြင်း ပြင်ဆင်ခြင်း",
|
||||||
"shipment.type": "Pickup/Drop-off",
|
"shipment.type": "Pickup/Drop-off",
|
||||||
"shipment.date": "Pickup Date",
|
"shipment.date": "Pickup date",
|
||||||
|
"shipment.date.time": "Pickup date/time",
|
||||||
"shipment.time": "Pickup Time",
|
"shipment.time": "Pickup Time",
|
||||||
"shipment.location_time": "Pickup Location / Time",
|
"shipment.location_time": "Pickup Location / Time",
|
||||||
"shipment.location": "Pickup Location",
|
"shipment.location": "Pickup location",
|
||||||
"shipment.information": "Pickup Informations",
|
"shipment.information": "Pickup informations",
|
||||||
"shipment.recipient_information": "Recipient Informations",
|
"shipment.recipient_information": "Recipient Informations",
|
||||||
"shipment.from":"From",
|
"shipment.from":"From",
|
||||||
"shipment.to":"To",
|
"shipment.to":"To",
|
||||||
@@ -310,7 +313,7 @@
|
|||||||
"shipment.handling.fee":"Handling Fee/Courier Fee",
|
"shipment.handling.fee":"Handling Fee/Courier Fee",
|
||||||
"shipment.box.cargo.type":"Cargo Types",
|
"shipment.box.cargo.type":"Cargo Types",
|
||||||
"shipment.box.dimemsion":"Dimension",
|
"shipment.box.dimemsion":"Dimension",
|
||||||
"shipment.box.shipment.weight":"Shipment Weight",
|
"shipment.box.shipment.weight":"Shipment weight",
|
||||||
"shipment.box.length":"Length",
|
"shipment.box.length":"Length",
|
||||||
"shipment.box.width":"Width",
|
"shipment.box.width":"Width",
|
||||||
"shipment.box.height":"Height",
|
"shipment.box.height":"Height",
|
||||||
@@ -437,4 +440,6 @@
|
|||||||
"processing.edit.sub_title":"မွမ်းမံခြင်း",
|
"processing.edit.sub_title":"မွမ်းမံခြင်း",
|
||||||
"processing.edit.complete.btn":"မွမ်းမံခြင်း ပြီးဆုံးသည်",
|
"processing.edit.complete.btn":"မွမ်းမံခြင်း ပြီးဆုံးသည်",
|
||||||
"Processing End ================================================================":""
|
"Processing End ================================================================":""
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ class DeliveryAddressRow extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
line(context, deliveryAddress.fullName,
|
line(context, deliveryAddress.fullName,
|
||||||
iconData: MaterialCommunityIcons.account_arrow_left,
|
iconData: MaterialCommunityIcons.account,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
fontSize: 16),
|
fontSize: 16),
|
||||||
line(context, deliveryAddress.phoneNumber,
|
line(context, deliveryAddress.phoneNumber,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
|||||||
import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
|
import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
|
||||||
import 'package:fcs/pages/widgets/delivery_address_selection.dart';
|
import 'package:fcs/pages/widgets/delivery_address_selection.dart';
|
||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
import 'package:fcs/pages/widgets/display_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.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_controller.dart';
|
||||||
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
||||||
@@ -72,6 +73,11 @@ class _PackageInfoState extends State<PackageInfo> {
|
|||||||
labelTextKey: "package.tracking.id",
|
labelTextKey: "package.tracking.id",
|
||||||
iconData: MaterialCommunityIcons.barcode_scan,
|
iconData: MaterialCommunityIcons.barcode_scan,
|
||||||
);
|
);
|
||||||
|
var fcsIDBox = DisplayText(
|
||||||
|
text: _package.fcsID,
|
||||||
|
labelTextKey: "processing.fcs.id",
|
||||||
|
icon: FcsIDIcon(),
|
||||||
|
);
|
||||||
final customerNameBox = DisplayText(
|
final customerNameBox = DisplayText(
|
||||||
text: _package.userName,
|
text: _package.userName,
|
||||||
labelTextKey: "package.create.name",
|
labelTextKey: "package.create.name",
|
||||||
@@ -145,16 +151,19 @@ class _PackageInfoState extends State<PackageInfo> {
|
|||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: ListView(children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
trackingIdBox,
|
trackingIdBox,
|
||||||
|
widget.isSearchResult ? Container() : fcsIDBox,
|
||||||
widget.isSearchResult ? Container() : customerNameBox,
|
widget.isSearchResult ? Container() : customerNameBox,
|
||||||
widget.isSearchResult ? Container() : marketBox,
|
widget.isSearchResult ? Container() : marketBox,
|
||||||
statusBox,
|
statusBox,
|
||||||
_package.photoUrls.length == 0 ? Container() : img,
|
_package.photoUrls.length == 0 ? Container() : img,
|
||||||
widget.isSearchResult ? Container() : descBox,
|
widget.isSearchResult ? Container() : descBox,
|
||||||
remarkBox,
|
remarkBox,
|
||||||
deliveryAddressBox,
|
widget.isSearchResult ? Container() : deliveryAddressBox,
|
||||||
StatusTree(
|
widget.isSearchResult
|
||||||
shipmentHistory: _package.shipmentHistory,
|
? Container()
|
||||||
currentStatus: _package.currentStatus),
|
: StatusTree(
|
||||||
|
shipmentHistory: _package.shipmentHistory,
|
||||||
|
currentStatus: _package.currentStatus),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:fcs/pages/main/util.dart';
|
|||||||
import 'package:fcs/pages/package/model/package_model.dart';
|
import 'package:fcs/pages/package/model/package_model.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
import 'package:fcs/pages/widgets/display_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.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_controller.dart';
|
||||||
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
||||||
@@ -57,6 +58,16 @@ class _ProcessingInfoState extends State<ProcessingInfo> {
|
|||||||
labelTextKey: "processing.tracking.id",
|
labelTextKey: "processing.tracking.id",
|
||||||
iconData: MaterialCommunityIcons.barcode_scan,
|
iconData: MaterialCommunityIcons.barcode_scan,
|
||||||
);
|
);
|
||||||
|
var fcsIDBox = DisplayText(
|
||||||
|
text: _package.fcsID,
|
||||||
|
labelTextKey: "processing.fcs.id",
|
||||||
|
icon: FcsIDIcon(),
|
||||||
|
);
|
||||||
|
final phoneNumberBox = DisplayText(
|
||||||
|
text: _package.phoneNumber,
|
||||||
|
labelTextKey: "processing.phone",
|
||||||
|
iconData: Icons.phone,
|
||||||
|
);
|
||||||
final customerNameBox = DisplayText(
|
final customerNameBox = DisplayText(
|
||||||
text: _package.userName,
|
text: _package.userName,
|
||||||
labelTextKey: "processing.name",
|
labelTextKey: "processing.name",
|
||||||
@@ -119,11 +130,13 @@ class _ProcessingInfoState extends State<ProcessingInfo> {
|
|||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: ListView(children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
trackingIdBox,
|
trackingIdBox,
|
||||||
|
fcsIDBox,
|
||||||
customerNameBox,
|
customerNameBox,
|
||||||
|
phoneNumberBox,
|
||||||
marketBox,
|
marketBox,
|
||||||
_package.photoUrls.length == 0 ? Container() : img,
|
|
||||||
descBox,
|
descBox,
|
||||||
remarkBox,
|
remarkBox,
|
||||||
|
_package.photoUrls.length == 0 ? Container() : img,
|
||||||
StatusTree(
|
StatusTree(
|
||||||
shipmentHistory: _package.shipmentHistory,
|
shipmentHistory: _package.shipmentHistory,
|
||||||
currentStatus: _package.currentStatus),
|
currentStatus: _package.currentStatus),
|
||||||
|
|||||||
@@ -77,17 +77,28 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
final trackingIDBox = Container(
|
final trackingIDBox = Container(
|
||||||
padding: EdgeInsets.only(left: 6),
|
padding: EdgeInsets.only(left: 6),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: InputText(
|
child: InputText(
|
||||||
|
iconData: MaterialCommunityIcons.barcode_scan,
|
||||||
labelTextKey: "receiving.tracking.id",
|
labelTextKey: "receiving.tracking.id",
|
||||||
controller: _trackingIDCtl,
|
controller: _trackingIDCtl,
|
||||||
)),
|
)),
|
||||||
IconButton(
|
InkWell(
|
||||||
icon: Icon(MaterialCommunityIcons.barcode_scan,
|
onTap: _scan,
|
||||||
color: primaryColor),
|
child: Padding(
|
||||||
onPressed: _scan,
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
MaterialCommunityIcons.barcode_scan,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
Text("Scan")
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
@@ -106,11 +117,6 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
labelTextKey: "receiving.name",
|
labelTextKey: "receiving.name",
|
||||||
iconData: Icons.person,
|
iconData: Icons.person,
|
||||||
);
|
);
|
||||||
final phoneNumberBox = DisplayText(
|
|
||||||
text: user != null ? user.phoneNumber : "",
|
|
||||||
labelTextKey: "receiving.phone",
|
|
||||||
iconData: Icons.phone,
|
|
||||||
);
|
|
||||||
|
|
||||||
final createButton = fcsButton(
|
final createButton = fcsButton(
|
||||||
context,
|
context,
|
||||||
@@ -150,13 +156,12 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
img,
|
|
||||||
remarkBox,
|
remarkBox,
|
||||||
|
img,
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
fcsIDBox,
|
fcsIDBox,
|
||||||
phoneNumberBox,
|
|
||||||
namebox,
|
namebox,
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:fcs/pages/package/model/package_model.dart';
|
|||||||
import 'package:fcs/pages/package/package_editor.dart';
|
import 'package:fcs/pages/package/package_editor.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
import 'package:fcs/pages/widgets/display_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.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_controller.dart';
|
||||||
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
import 'package:fcs/pages/widgets/multi_img_file.dart';
|
||||||
@@ -62,6 +63,11 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
|||||||
labelTextKey: "package.tracking.id",
|
labelTextKey: "package.tracking.id",
|
||||||
iconData: MaterialCommunityIcons.barcode_scan,
|
iconData: MaterialCommunityIcons.barcode_scan,
|
||||||
);
|
);
|
||||||
|
var fcsIDBox = DisplayText(
|
||||||
|
text: _package.fcsID,
|
||||||
|
labelTextKey: "processing.fcs.id",
|
||||||
|
icon: FcsIDIcon(),
|
||||||
|
);
|
||||||
final customerNameBox = DisplayText(
|
final customerNameBox = DisplayText(
|
||||||
text: _package.userName,
|
text: _package.userName,
|
||||||
labelTextKey: "package.create.name",
|
labelTextKey: "package.create.name",
|
||||||
@@ -116,9 +122,10 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
|||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: ListView(children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
trackingIdBox,
|
trackingIdBox,
|
||||||
_package.userID != null ? customerNameBox : Container(),
|
fcsIDBox,
|
||||||
_package.photoUrls.length == 0 ? Container() : img,
|
customerNameBox,
|
||||||
remarkBox,
|
remarkBox,
|
||||||
|
_package.photoUrls.length == 0 ? Container() : img,
|
||||||
StatusTree(
|
StatusTree(
|
||||||
shipmentHistory: _package.shipmentHistory,
|
shipmentHistory: _package.shipmentHistory,
|
||||||
currentStatus: _package.currentStatus),
|
currentStatus: _package.currentStatus),
|
||||||
|
|||||||
@@ -1,23 +1,20 @@
|
|||||||
import 'package:fcs/domain/entities/box.dart';
|
import 'package:fcs/domain/entities/box.dart';
|
||||||
import 'package:fcs/domain/entities/cargo.dart';
|
import 'package:fcs/domain/entities/cargo.dart';
|
||||||
import 'package:fcs/domain/entities/package.dart';
|
|
||||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
import 'package:fcs/pages/box/cargo_type_editor.dart';
|
import 'package:fcs/pages/box/cargo_type_editor.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/delivery_address/model/delivery_address_model.dart';
|
||||||
import 'package:fcs/pages/main/model/main_model.dart';
|
import 'package:fcs/pages/main/model/main_model.dart';
|
||||||
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
||||||
import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
|
import 'package:fcs/pages/widgets/defalut_delivery_address.dart';
|
||||||
import 'package:fcs/pages/widgets/delivery_address_selection.dart';
|
import 'package:fcs/pages/widgets/delivery_address_selection.dart';
|
||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
import 'package:fcs/pages/widgets/display_text.dart';
|
||||||
import 'package:fcs/pages/widgets/input_text.dart';
|
import 'package:fcs/pages/widgets/length_picker.dart';
|
||||||
import 'package:fcs/pages/widgets/local_button.dart';
|
import 'package:fcs/pages/widgets/local_button.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_title.dart';
|
||||||
import 'package:fcs/pages/widgets/my_data_table.dart';
|
import 'package:fcs/pages/widgets/my_data_table.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:fcs/pages/widgets/title_with_add_button.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_icons/flutter_icons.dart';
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -38,11 +35,10 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
Box _box;
|
Box _box;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
bool _isNew;
|
bool _isNew;
|
||||||
bool isMixBox = false;
|
DeliveryAddress _deliveryAddress;
|
||||||
DeliveryAddress _deliveryAddress = new DeliveryAddress();
|
double volumetricRatio = 0;
|
||||||
double volumetricRatio;
|
double shipmentWeight = 0;
|
||||||
double shipmentWeight;
|
List<Cargo> cargos = [];
|
||||||
List<Cargo> cargos;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -50,13 +46,10 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
|
|
||||||
volumetricRatio =
|
volumetricRatio =
|
||||||
Provider.of<MainModel>(context, listen: false).setting.volumetricRatio;
|
Provider.of<MainModel>(context, listen: false).setting.volumetricRatio;
|
||||||
shipmentWeight = 0;
|
|
||||||
cargos = [];
|
|
||||||
|
|
||||||
if (widget.box != null) {
|
if (widget.box != null) {
|
||||||
_box = widget.box;
|
_box = widget.box;
|
||||||
_deliveryAddress = _box.shippingAddress;
|
_deliveryAddress = _box.shippingAddress;
|
||||||
|
|
||||||
_isNew = false;
|
_isNew = false;
|
||||||
} else {
|
} else {
|
||||||
var shipmentModel =
|
var shipmentModel =
|
||||||
@@ -65,6 +58,9 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
|
|
||||||
_isNew = true;
|
_isNew = true;
|
||||||
_box = Box();
|
_box = Box();
|
||||||
|
_lengthCtl.text = "0";
|
||||||
|
_widthCtl.text = "0";
|
||||||
|
_heightCtl.text = "0";
|
||||||
}
|
}
|
||||||
_lengthCtl.addListener(_calShipmentWeight);
|
_lengthCtl.addListener(_calShipmentWeight);
|
||||||
_widthCtl.addListener(_calShipmentWeight);
|
_widthCtl.addListener(_calShipmentWeight);
|
||||||
@@ -75,6 +71,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
double l = double.parse(_lengthCtl.text, (s) => 0);
|
double l = double.parse(_lengthCtl.text, (s) => 0);
|
||||||
double w = double.parse(_widthCtl.text, (s) => 0);
|
double w = double.parse(_widthCtl.text, (s) => 0);
|
||||||
double h = double.parse(_heightCtl.text, (s) => 0);
|
double h = double.parse(_heightCtl.text, (s) => 0);
|
||||||
|
print("$l $w $h");
|
||||||
setState(() {
|
setState(() {
|
||||||
shipmentWeight = l * w * h / volumetricRatio;
|
shipmentWeight = l * w * h / volumetricRatio;
|
||||||
});
|
});
|
||||||
@@ -82,30 +79,35 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
double iconSize = 32;
|
|
||||||
|
|
||||||
final shipmentWeightBox = DisplayText(
|
final shipmentWeightBox = DisplayText(
|
||||||
labelTextKey: "shipment.box.shipment.weight",
|
labelTextKey: "shipment.box.shipment.weight",
|
||||||
text: shipmentWeight == null ? "" : shipmentWeight.toStringAsFixed(0),
|
text: shipmentWeight == null ? "" : shipmentWeight.toStringAsFixed(0),
|
||||||
iconData: MaterialCommunityIcons.weight,
|
iconData: MaterialCommunityIcons.weight,
|
||||||
);
|
);
|
||||||
final lengthBox = InputText(
|
|
||||||
labelTextKey: "shipment.box.length",
|
final lengthBox = LengthPicker(
|
||||||
controller: _lengthCtl,
|
controller: _lengthCtl,
|
||||||
textInputType: TextInputType.number,
|
lableKey: "shipment.box.length",
|
||||||
iconData: FontAwesome.arrow_circle_right,
|
|
||||||
);
|
);
|
||||||
final widthBox = InputText(
|
final widthBox = LengthPicker(
|
||||||
labelTextKey: "shipment.box.width",
|
|
||||||
controller: _widthCtl,
|
controller: _widthCtl,
|
||||||
textInputType: TextInputType.number,
|
lableKey: "shipment.box.width",
|
||||||
iconData: FontAwesome.arrow_circle_left,
|
|
||||||
);
|
);
|
||||||
final heightBox = InputText(
|
final heightBox = LengthPicker(
|
||||||
labelTextKey: "shipment.box.height",
|
|
||||||
controller: _heightCtl,
|
controller: _heightCtl,
|
||||||
textInputType: TextInputType.number,
|
lableKey: "shipment.box.height",
|
||||||
iconData: FontAwesome.arrow_circle_up,
|
);
|
||||||
|
final dimBox = Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
|
child: Icon(FontAwesome.arrow_circle_right, color: primaryColor),
|
||||||
|
),
|
||||||
|
SizedBox(child: lengthBox, width: 80),
|
||||||
|
SizedBox(child: widthBox, width: 80),
|
||||||
|
SizedBox(child: heightBox, width: 80),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
final createBtn = LocalButton(
|
final createBtn = LocalButton(
|
||||||
textKey: "shipment.box.add",
|
textKey: "shipment.box.add",
|
||||||
@@ -135,18 +137,19 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
TitleWithAddButton(
|
LocalTitle(
|
||||||
iconData: MaterialCommunityIcons.briefcase_check,
|
textKey: "shipment.box.cargo.type",
|
||||||
titleKey: "shipment.box.cargo.type",
|
trailing: IconButton(
|
||||||
onTap: () async {
|
icon: Icon(
|
||||||
Cargo cargo = await Navigator.push<Cargo>(
|
Icons.add_circle,
|
||||||
context, BottomUpPageRoute(CargoTypeEditor()));
|
color: primaryColor,
|
||||||
if (cargo != null) {
|
),
|
||||||
setState(() {
|
onPressed: () async {
|
||||||
cargos.add(cargo);
|
Cargo cargo = await Navigator.push<Cargo>(
|
||||||
});
|
context, BottomUpPageRoute(CargoTypeEditor()));
|
||||||
}
|
_addCargo(cargo);
|
||||||
}),
|
}),
|
||||||
|
),
|
||||||
MyDataTable(
|
MyDataTable(
|
||||||
headingRowHeight: 40,
|
headingRowHeight: 40,
|
||||||
columns: [
|
columns: [
|
||||||
@@ -170,13 +173,10 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
TitleWithAddButton(
|
LocalTitle(textKey: "shipment.box.dimemsion"),
|
||||||
titleKey: "shipment.box.dimemsion",
|
dimBox,
|
||||||
),
|
|
||||||
shipmentWeightBox,
|
shipmentWeightBox,
|
||||||
lengthBox,
|
LocalTitle(textKey: "shipment.box.delivery"),
|
||||||
widthBox,
|
|
||||||
heightBox,
|
|
||||||
DefaultDeliveryAddress(
|
DefaultDeliveryAddress(
|
||||||
deliveryAddress: _deliveryAddress,
|
deliveryAddress: _deliveryAddress,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@@ -199,82 +199,6 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TableRow> getRows(BuildContext context) {
|
|
||||||
if (cargos == null || cargos == null) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
int total = 0;
|
|
||||||
var rows = cargos.map((c) {
|
|
||||||
total += c.weight;
|
|
||||||
return TableRow(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
c.type == null ? "" : c.type,
|
|
||||||
style: textStyle,
|
|
||||||
),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Text(c.weight == null ? "0" : c.weight.toString(),
|
|
||||||
style: textStyle)),
|
|
||||||
IconButton(icon: Icon(Icons.remove), onPressed: () => {})
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
var totalRow = TableRow(
|
|
||||||
children: [
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text("Total Weight",
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(total.toString(),
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
|
||||||
)),
|
|
||||||
Container(
|
|
||||||
width: 50,
|
|
||||||
child:
|
|
||||||
new Text(" ", style: TextStyle(fontWeight: FontWeight.bold))),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
rows.add(totalRow);
|
|
||||||
rows.insert(
|
|
||||||
0,
|
|
||||||
TableRow(children: [
|
|
||||||
Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: LocalText(
|
|
||||||
context,
|
|
||||||
"cargo.type",
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: LocalText(
|
|
||||||
context,
|
|
||||||
"cargo.weight",
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("")
|
|
||||||
]));
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MyDataRow> getCargoRows(BuildContext context) {
|
List<MyDataRow> getCargoRows(BuildContext context) {
|
||||||
if (cargos == null || cargos == null) {
|
if (cargos == null || cargos == null) {
|
||||||
return [];
|
return [];
|
||||||
@@ -283,7 +207,14 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
var rows = cargos.map((c) {
|
var rows = cargos.map((c) {
|
||||||
total += c.weight;
|
total += c.weight;
|
||||||
return MyDataRow(
|
return MyDataRow(
|
||||||
onSelectChanged: (bool selected) {},
|
onSelectChanged: (bool selected) async {
|
||||||
|
Cargo cargo = await Navigator.push<Cargo>(
|
||||||
|
context,
|
||||||
|
BottomUpPageRoute(CargoTypeEditor(
|
||||||
|
cargo: c,
|
||||||
|
)));
|
||||||
|
_addCargo(cargo);
|
||||||
|
},
|
||||||
cells: [
|
cells: [
|
||||||
MyDataCell(new Text(
|
MyDataCell(new Text(
|
||||||
c.type == null ? "" : c.type,
|
c.type == null ? "" : c.type,
|
||||||
@@ -300,7 +231,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
Icons.remove_circle,
|
Icons.remove_circle,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
onPressed: () => {},
|
onPressed: () => {_removeCargo(c)},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -314,7 +245,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
cells: [
|
cells: [
|
||||||
MyDataCell(Align(
|
MyDataCell(Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text("Total Weight",
|
child: Text("Total",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
)),
|
)),
|
||||||
@@ -333,4 +264,18 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
|||||||
rows.add(totalRow);
|
rows.add(totalRow);
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_addCargo(Cargo cargo) {
|
||||||
|
if (cargo == null) return;
|
||||||
|
setState(() {
|
||||||
|
cargos.remove(cargo);
|
||||||
|
cargos.add(cargo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_removeCargo(Cargo cargo) {
|
||||||
|
setState(() {
|
||||||
|
cargos.remove(cargo);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,11 @@ import 'package:fcs/pages/widgets/delivery_address_selection.dart';
|
|||||||
import 'package:fcs/pages/widgets/display_text.dart';
|
import 'package:fcs/pages/widgets/display_text.dart';
|
||||||
import 'package:fcs/pages/widgets/input_date.dart';
|
import 'package:fcs/pages/widgets/input_date.dart';
|
||||||
import 'package:fcs/pages/widgets/input_time.dart';
|
import 'package:fcs/pages/widgets/input_time.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_button.dart';
|
||||||
import 'package:fcs/pages/widgets/local_dropdown.dart';
|
import 'package:fcs/pages/widgets/local_dropdown.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_radio_buttons.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_title.dart';
|
||||||
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
import 'package:fcs/pages/widgets/multi_img_controller.dart';
|
||||||
import 'package:fcs/pages/widgets/progress.dart';
|
import 'package:fcs/pages/widgets/progress.dart';
|
||||||
import 'package:fcs/pages/widgets/title_with_add_button.dart';
|
import 'package:fcs/pages/widgets/title_with_add_button.dart';
|
||||||
@@ -28,6 +31,8 @@ import 'package:provider/provider.dart';
|
|||||||
import 'box_row.dart';
|
import 'box_row.dart';
|
||||||
import 'shipment_box_editor.dart';
|
import 'shipment_box_editor.dart';
|
||||||
|
|
||||||
|
enum SingingCharacter { lafayette, jefferson }
|
||||||
|
|
||||||
class ShipmentEditor extends StatefulWidget {
|
class ShipmentEditor extends StatefulWidget {
|
||||||
final Shipment shipment;
|
final Shipment shipment;
|
||||||
ShipmentEditor({this.shipment});
|
ShipmentEditor({this.shipment});
|
||||||
@@ -64,12 +69,12 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
DeliveryAddress _pickupAddress = new DeliveryAddress();
|
DeliveryAddress _pickupAddress = new DeliveryAddress();
|
||||||
|
|
||||||
int _currVal = 1;
|
int _currVal = 1;
|
||||||
String selectedPickupType;
|
String _selectedPickupType;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
selectedPickupType = shipment_local_pickup;
|
_selectedPickupType = shipment_local_pickup;
|
||||||
|
|
||||||
if (widget.shipment != null) {
|
if (widget.shipment != null) {
|
||||||
_isNew = false;
|
_isNew = false;
|
||||||
@@ -84,6 +89,9 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
_currVal = _pickUp.radioIndex;
|
_currVal = _pickUp.radioIndex;
|
||||||
} else {
|
} else {
|
||||||
_isNew = true;
|
_isNew = true;
|
||||||
|
_pickupDate.text = dateFormatter.format(now);
|
||||||
|
_fromTimeEditingController.text = "${(now.hour)}:${(now.minute)}";
|
||||||
|
_toTimeEditingController.text = "${(now.hour)}:${(now.minute)}";
|
||||||
List<Cargo> _cargoTypes = [
|
List<Cargo> _cargoTypes = [
|
||||||
Cargo(type: 'General Cargo', weight: 25),
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
Cargo(type: 'Medicine', weight: 20),
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
@@ -101,6 +109,8 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SingingCharacter _character = SingingCharacter.lafayette;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
MainModel mainModel = Provider.of<MainModel>(context);
|
MainModel mainModel = Provider.of<MainModel>(context);
|
||||||
@@ -111,29 +121,14 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
iconData: Icons.timer,
|
iconData: Icons.timer,
|
||||||
controller: _fromTimeEditingController);
|
controller: _fromTimeEditingController);
|
||||||
|
|
||||||
final toTimeBox = InputTime(
|
final toTimeBox = Container(
|
||||||
labelTextKey: 'shipment.to', controller: _toTimeEditingController);
|
width: 150,
|
||||||
|
child: InputTime(
|
||||||
|
iconData: Icons.timer_off,
|
||||||
|
labelTextKey: 'shipment.to',
|
||||||
|
controller: _toTimeEditingController));
|
||||||
|
|
||||||
final pickupTimeBox = Row(
|
final pickupDateBox = InputDate(
|
||||||
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 shipmentDateBox = InputDate(
|
|
||||||
labelTextKey: "shipment.date",
|
labelTextKey: "shipment.date",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
controller: _pickupDate,
|
controller: _pickupDate,
|
||||||
@@ -152,8 +147,9 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
);
|
);
|
||||||
var deliveryAddressBox = DefaultDeliveryAddress(
|
final pickupAddressBox = DefaultDeliveryAddress(
|
||||||
deliveryAddress: _pickupAddress,
|
deliveryAddress: _pickupAddress,
|
||||||
|
iconData: Icons.location_on,
|
||||||
labelKey: "shipment.location",
|
labelKey: "shipment.location",
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
||||||
@@ -176,13 +172,14 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
var shipmentTypeBox = LocalDropdown<String>(
|
var shipmentTypeBox = LocalDropdown<String>(
|
||||||
callback: (v) {
|
callback: (v) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedPickupType = v;
|
_selectedPickupType = v;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
iconData: SimpleLineIcons.direction,
|
iconData: SimpleLineIcons.direction,
|
||||||
selectedValue: selectedPickupType,
|
selectedValue: _selectedPickupType,
|
||||||
values: pickupModel.pickupTypes,
|
values: pickupModel.pickupTypes,
|
||||||
);
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -208,38 +205,47 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
handlingFeeBox,
|
LocalTitle(textKey: "shipment.type"),
|
||||||
shipmentTypeBox,
|
LocalRadioButtons(
|
||||||
deliveryAddressBox,
|
values: pickupModel.pickupTypes,
|
||||||
shipmentDateBox,
|
selectedValue: _selectedPickupType,
|
||||||
pickupTimeBox,
|
callback: (v) {
|
||||||
localDropoffAddress,
|
setState(() {
|
||||||
curierDropoffAddress,
|
_selectedPickupType = v;
|
||||||
TitleWithAddButton(
|
});
|
||||||
titleKey: "boxes.name",
|
}),
|
||||||
iconData: MaterialCommunityIcons.package,
|
// handlingFeeBox,
|
||||||
onTap: () => Navigator.push(
|
// shipmentTypeBox,
|
||||||
context,
|
LocalTitle(textKey: "shipment.location"),
|
||||||
BottomUpPageRoute(ShipmentBoxEditor()),
|
pickupAddressBox,
|
||||||
|
LocalTitle(textKey: "shipment.date.time"),
|
||||||
|
pickupDateBox,
|
||||||
|
fromTimeBox,
|
||||||
|
toTimeBox,
|
||||||
|
// localDropoffAddress,
|
||||||
|
// curierDropoffAddress,
|
||||||
|
LocalTitle(
|
||||||
|
textKey: "boxes.name",
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add_circle,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
BottomUpPageRoute(ShipmentBoxEditor()),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
children: getBoxList(context, boxModel.boxes),
|
children: getBoxList(context, boxModel.boxes),
|
||||||
),
|
),
|
||||||
Align(
|
LocalButton(
|
||||||
alignment: Alignment.bottomCenter,
|
textKey: "shipment.new",
|
||||||
child: Center(
|
),
|
||||||
child: Container(
|
|
||||||
width: 250,
|
|
||||||
child: FlatButton(
|
|
||||||
child: Text('Create shipment'),
|
|
||||||
color: primaryColor,
|
|
||||||
textColor: Colors.white,
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -258,4 +264,6 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
|||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_addBox() {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ class DefaultDeliveryAddress extends StatelessWidget {
|
|||||||
final DeliveryAddress deliveryAddress;
|
final DeliveryAddress deliveryAddress;
|
||||||
final String labelKey;
|
final String labelKey;
|
||||||
final OnTap onTap;
|
final OnTap onTap;
|
||||||
|
final IconData iconData;
|
||||||
|
|
||||||
const DefaultDeliveryAddress(
|
const DefaultDeliveryAddress(
|
||||||
{Key key, this.deliveryAddress, this.onTap, this.labelKey})
|
{Key key, this.deliveryAddress, this.onTap, this.labelKey, this.iconData})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -28,7 +29,7 @@ class DefaultDeliveryAddress extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: DisplayText(
|
child: DisplayText(
|
||||||
labelTextKey: this.labelKey ?? "delivery_address",
|
labelTextKey: this.labelKey ?? "delivery_address",
|
||||||
iconData: MaterialCommunityIcons.truck_fast,
|
iconData: iconData ?? MaterialCommunityIcons.truck_fast,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap == null
|
onTap == null
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ class InputText extends StatelessWidget {
|
|||||||
final Color borderColor;
|
final Color borderColor;
|
||||||
final TextInputType textInputType;
|
final TextInputType textInputType;
|
||||||
final bool autoFocus;
|
final bool autoFocus;
|
||||||
|
final TextAlign textAlign;
|
||||||
|
final bool enabled;
|
||||||
|
|
||||||
const InputText(
|
const InputText(
|
||||||
{Key key,
|
{Key key,
|
||||||
@@ -26,7 +28,9 @@ class InputText extends StatelessWidget {
|
|||||||
this.withBorder = false,
|
this.withBorder = false,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
this.autoFocus = false,
|
this.autoFocus = false,
|
||||||
this.textInputType})
|
this.textInputType,
|
||||||
|
this.enabled = true,
|
||||||
|
this.textAlign})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -35,12 +39,14 @@ class InputText extends StatelessWidget {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(top: 15.0, bottom: 5),
|
padding: const EdgeInsets.only(top: 15.0, bottom: 5),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
|
enabled: enabled,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
autofocus: autoFocus,
|
autofocus: autoFocus,
|
||||||
cursorColor: primaryColor,
|
cursorColor: primaryColor,
|
||||||
style: textStyle,
|
style: textStyle,
|
||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
keyboardType: textInputType,
|
keyboardType: textInputType,
|
||||||
|
textAlign: textAlign ?? TextAlign.start,
|
||||||
decoration: new InputDecoration(
|
decoration: new InputDecoration(
|
||||||
// hintText: '',
|
// hintText: '',
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
|
|||||||
183
lib/pages/widgets/length_picker.dart
Normal file
183
lib/pages/widgets/length_picker.dart
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'input_text.dart';
|
||||||
|
|
||||||
|
class LengthPicker extends StatefulWidget {
|
||||||
|
final TextEditingController controller;
|
||||||
|
final String lableKey;
|
||||||
|
|
||||||
|
const LengthPicker({Key key, this.controller, this.lableKey})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_LengthPickerState createState() => _LengthPickerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LengthPickerState extends State<LengthPicker> {
|
||||||
|
TextEditingController _controller = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.controller != null) {
|
||||||
|
_setText();
|
||||||
|
widget.controller.addListener(() {
|
||||||
|
_setText();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_setText() {
|
||||||
|
int v = int.parse(widget.controller.text, onError: (s) => 0);
|
||||||
|
int f = (v / 12).round();
|
||||||
|
int ins = (v % 12).round();
|
||||||
|
_controller.text = "$f' $ins\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () => _showDialog(context),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(left: 8, right: 8),
|
||||||
|
child: InputText(
|
||||||
|
enabled: false,
|
||||||
|
labelTextKey: widget.lableKey,
|
||||||
|
controller: _controller,
|
||||||
|
textInputType: TextInputType.number,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return LengthPickerDialog(
|
||||||
|
controller: widget.controller,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LengthPickerDialog extends StatefulWidget {
|
||||||
|
final TextEditingController controller;
|
||||||
|
|
||||||
|
const LengthPickerDialog({Key key, this.controller}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_LengthPickerDialogState createState() => _LengthPickerDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LengthPickerDialogState extends State<LengthPickerDialog> {
|
||||||
|
double _valueFeet;
|
||||||
|
double _valueInc;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_valueFeet = 0;
|
||||||
|
_valueInc = 0;
|
||||||
|
if (widget.controller != null) {
|
||||||
|
double v = double.parse(widget.controller.text, (s) => 0);
|
||||||
|
_valueFeet = v / 12;
|
||||||
|
_valueInc = v % 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
title: Center(
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"shipment.box.height",
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 16,
|
||||||
|
)),
|
||||||
|
children: [
|
||||||
|
Center(child: Text(_getText(_valueFeet))),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 8.0, left: 8),
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"feet",
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Slider(
|
||||||
|
activeColor: primaryColor,
|
||||||
|
value: _valueFeet,
|
||||||
|
min: 0,
|
||||||
|
max: 15,
|
||||||
|
divisions: 100,
|
||||||
|
label: (_valueFeet ?? 0).round().toString(),
|
||||||
|
onChanged: (double v) {
|
||||||
|
_updateFeet(v);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 8.0, left: 8),
|
||||||
|
child: LocalText(
|
||||||
|
context,
|
||||||
|
"inch",
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Slider(
|
||||||
|
activeColor: primaryColor,
|
||||||
|
value: _valueInc,
|
||||||
|
min: 0,
|
||||||
|
max: 11,
|
||||||
|
divisions: 100,
|
||||||
|
label: (_valueInc ?? 0).round().toString(),
|
||||||
|
onChanged: (double v) {
|
||||||
|
_updateInc(v);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateFeet(double v) {
|
||||||
|
setState(() {
|
||||||
|
_valueFeet = v;
|
||||||
|
});
|
||||||
|
if (widget.controller != null) {
|
||||||
|
int _v = _valueInc.round() + _valueFeet.round() * 12;
|
||||||
|
widget.controller.text = _v.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateInc(double v) {
|
||||||
|
setState(() {
|
||||||
|
_valueInc = v;
|
||||||
|
});
|
||||||
|
if (widget.controller != null) {
|
||||||
|
int _v = _valueInc.round() + _valueFeet.round() * 12;
|
||||||
|
widget.controller.text = _v.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _getText(double v) {
|
||||||
|
int ft = _valueFeet.round();
|
||||||
|
int ins = _valueInc.round();
|
||||||
|
return "$ft\' $ins\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
41
lib/pages/widgets/local_radio_buttons.dart
Normal file
41
lib/pages/widgets/local_radio_buttons.dart
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LocalRadioButtons<T> extends StatelessWidget {
|
||||||
|
final Function(T) callback;
|
||||||
|
final IconData iconData;
|
||||||
|
final T selectedValue;
|
||||||
|
final List<T> values;
|
||||||
|
|
||||||
|
const LocalRadioButtons(
|
||||||
|
{Key key, this.callback, this.iconData, this.selectedValue, this.values})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(children: getChildren());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> getChildren() {
|
||||||
|
return values
|
||||||
|
.toList()
|
||||||
|
.map((e) => SizedBox(
|
||||||
|
height: 30,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => callback(e),
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Radio<T>(
|
||||||
|
activeColor: primaryColor,
|
||||||
|
groupValue: selectedValue,
|
||||||
|
value: e,
|
||||||
|
onChanged: (T value) {
|
||||||
|
callback(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(e.toString()),
|
||||||
|
]),
|
||||||
|
)))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
40
lib/pages/widgets/local_title.dart
Normal file
40
lib/pages/widgets/local_title.dart
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LocalTitle extends StatelessWidget {
|
||||||
|
final String textKey;
|
||||||
|
final Widget trailing;
|
||||||
|
|
||||||
|
const LocalTitle({Key key, this.textKey, this.trailing}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 18),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
LocalText(
|
||||||
|
context,
|
||||||
|
textKey,
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
trailing != null ? Spacer() : Container(),
|
||||||
|
trailing != null ? trailing : Container()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
thickness: 2,
|
||||||
|
color: primaryColor,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,7 +38,7 @@ class TitleWithAddButton extends StatelessWidget {
|
|||||||
onTap == null
|
onTap == null
|
||||||
? Container()
|
? Container()
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: const EdgeInsets.only(right: 25.0),
|
padding: const EdgeInsets.only(right: 0),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () => onTap(),
|
onPressed: () => onTap(),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
|
|||||||
Reference in New Issue
Block a user