add length picker
This commit is contained in:
@@ -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/input_date.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_radio_buttons.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/progress.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 'shipment_box_editor.dart';
|
||||
|
||||
enum SingingCharacter { lafayette, jefferson }
|
||||
|
||||
class ShipmentEditor extends StatefulWidget {
|
||||
final Shipment shipment;
|
||||
ShipmentEditor({this.shipment});
|
||||
@@ -64,12 +69,12 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
DeliveryAddress _pickupAddress = new DeliveryAddress();
|
||||
|
||||
int _currVal = 1;
|
||||
String selectedPickupType;
|
||||
String _selectedPickupType;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
selectedPickupType = shipment_local_pickup;
|
||||
_selectedPickupType = shipment_local_pickup;
|
||||
|
||||
if (widget.shipment != null) {
|
||||
_isNew = false;
|
||||
@@ -84,6 +89,9 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
_currVal = _pickUp.radioIndex;
|
||||
} else {
|
||||
_isNew = true;
|
||||
_pickupDate.text = dateFormatter.format(now);
|
||||
_fromTimeEditingController.text = "${(now.hour)}:${(now.minute)}";
|
||||
_toTimeEditingController.text = "${(now.hour)}:${(now.minute)}";
|
||||
List<Cargo> _cargoTypes = [
|
||||
Cargo(type: 'General Cargo', weight: 25),
|
||||
Cargo(type: 'Medicine', weight: 20),
|
||||
@@ -101,6 +109,8 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
SingingCharacter _character = SingingCharacter.lafayette;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
@@ -111,29 +121,14 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
iconData: Icons.timer,
|
||||
controller: _fromTimeEditingController);
|
||||
|
||||
final toTimeBox = InputTime(
|
||||
labelTextKey: 'shipment.to', controller: _toTimeEditingController);
|
||||
final toTimeBox = Container(
|
||||
width: 150,
|
||||
child: InputTime(
|
||||
iconData: Icons.timer_off,
|
||||
labelTextKey: 'shipment.to',
|
||||
controller: _toTimeEditingController));
|
||||
|
||||
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 shipmentDateBox = InputDate(
|
||||
final pickupDateBox = InputDate(
|
||||
labelTextKey: "shipment.date",
|
||||
iconData: Icons.date_range,
|
||||
controller: _pickupDate,
|
||||
@@ -152,8 +147,9 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
);
|
||||
var deliveryAddressBox = DefaultDeliveryAddress(
|
||||
final pickupAddressBox = DefaultDeliveryAddress(
|
||||
deliveryAddress: _pickupAddress,
|
||||
iconData: Icons.location_on,
|
||||
labelKey: "shipment.location",
|
||||
onTap: () async {
|
||||
DeliveryAddress d = await Navigator.push<DeliveryAddress>(
|
||||
@@ -176,13 +172,14 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
var shipmentTypeBox = LocalDropdown<String>(
|
||||
callback: (v) {
|
||||
setState(() {
|
||||
selectedPickupType = v;
|
||||
_selectedPickupType = v;
|
||||
});
|
||||
},
|
||||
iconData: SimpleLineIcons.direction,
|
||||
selectedValue: selectedPickupType,
|
||||
selectedValue: _selectedPickupType,
|
||||
values: pickupModel.pickupTypes,
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -208,38 +205,47 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
handlingFeeBox,
|
||||
shipmentTypeBox,
|
||||
deliveryAddressBox,
|
||||
shipmentDateBox,
|
||||
pickupTimeBox,
|
||||
localDropoffAddress,
|
||||
curierDropoffAddress,
|
||||
TitleWithAddButton(
|
||||
titleKey: "boxes.name",
|
||||
iconData: MaterialCommunityIcons.package,
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
BottomUpPageRoute(ShipmentBoxEditor()),
|
||||
LocalTitle(textKey: "shipment.type"),
|
||||
LocalRadioButtons(
|
||||
values: pickupModel.pickupTypes,
|
||||
selectedValue: _selectedPickupType,
|
||||
callback: (v) {
|
||||
setState(() {
|
||||
_selectedPickupType = v;
|
||||
});
|
||||
}),
|
||||
// handlingFeeBox,
|
||||
// shipmentTypeBox,
|
||||
LocalTitle(textKey: "shipment.location"),
|
||||
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(
|
||||
children: getBoxList(context, boxModel.boxes),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Create shipment'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
LocalButton(
|
||||
textKey: "shipment.new",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -258,4 +264,6 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
_addBox() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user