modfiy
This commit is contained in:
@@ -2,8 +2,12 @@ import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/model/pickup_model.dart';
|
||||
import 'package:fcs/pages/util.dart';
|
||||
import 'package:fcs/vo/pickup.dart';
|
||||
import 'package:fcs/widget/fcs_text_field.dart';
|
||||
import 'package:fcs/widget/fcs_text_field_readonly.dart';
|
||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
|
||||
@@ -21,6 +25,8 @@ class PickUpEditor extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PickUpEditorState extends State<PickUpEditor> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
|
||||
TextEditingController _addressEditingController = new TextEditingController();
|
||||
TextEditingController _fromTimeEditingController =
|
||||
new TextEditingController();
|
||||
@@ -28,9 +34,17 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
||||
TextEditingController _noOfPackageEditingController =
|
||||
new TextEditingController();
|
||||
TextEditingController _weightEditingController = new TextEditingController();
|
||||
TextEditingController _recipientNameEditingController =
|
||||
new TextEditingController();
|
||||
TextEditingController _recipientPhoneEditingController =
|
||||
new TextEditingController();
|
||||
TextEditingController _recipientAddressEditingController =
|
||||
new TextEditingController();
|
||||
TextEditingController _pickupDate = new TextEditingController();
|
||||
|
||||
PickUp _pickUp;
|
||||
bool _isLoading = false;
|
||||
var now = new DateTime.now();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -42,6 +56,13 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
||||
_toTimeEditingController.text = _pickUp.toTime;
|
||||
_noOfPackageEditingController.text = _pickUp.numberOfPackage.toString();
|
||||
_weightEditingController.text = _pickUp.weight.toString();
|
||||
_pickupDate.text = dateFormatter.format(now);
|
||||
|
||||
var mainModel = Provider.of<MainModel>(context, listen: false);
|
||||
_recipientNameEditingController.text = mainModel.recipient.name;
|
||||
_recipientPhoneEditingController.text = mainModel.recipient.phoneNumber;
|
||||
_recipientAddressEditingController.text =
|
||||
mainModel.recipient.shippingAddress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +84,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
||||
minLines: 2,
|
||||
decoration: new InputDecoration(
|
||||
labelText: 'Pickup Address',
|
||||
disabledBorder: InputBorder.none,
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
@@ -70,6 +92,12 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
||||
),
|
||||
));
|
||||
|
||||
final pickUpAddressReadOnly = Container(
|
||||
child: FCSTextFieldReadOnly(
|
||||
controller: _addressEditingController,
|
||||
label: 'Pickup Address',
|
||||
));
|
||||
|
||||
final pickupTime = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
@@ -106,6 +134,24 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
||||
]),
|
||||
);
|
||||
|
||||
final pickupTimeReadOnly = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
Container(
|
||||
width: 70.0,
|
||||
child: FCSTextFieldReadOnly(
|
||||
controller: _fromTimeEditingController, label: 'From')),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(' - '),
|
||||
),
|
||||
Container(
|
||||
width: 70.0,
|
||||
child: FCSTextFieldReadOnly(
|
||||
controller: _toTimeEditingController, label: 'To')),
|
||||
]),
|
||||
);
|
||||
|
||||
final noOfPackageBox = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
@@ -125,25 +171,58 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
||||
]),
|
||||
);
|
||||
|
||||
final weightBox = Container(
|
||||
final noOfPackageBoxReadonly = Container(
|
||||
height: 50.0,
|
||||
child: Row(children: <Widget>[
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
controller: _weightEditingController,
|
||||
cursorColor: primaryColor,
|
||||
textAlign: TextAlign.left,
|
||||
decoration: new InputDecoration(
|
||||
labelText: 'Total Weight (lb)',
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
),
|
||||
)),
|
||||
child: FCSTextFieldReadOnly(
|
||||
controller: _noOfPackageEditingController,
|
||||
label: 'Number of Packages')),
|
||||
]),
|
||||
);
|
||||
|
||||
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("pickup.date"),
|
||||
// labelStyle: languageModel.isEng ? labelStyle : labelStyleMM,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0),
|
||||
icon: Icon(
|
||||
Icons.date_range,
|
||||
color: Colors.black87,
|
||||
)),
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return AppTranslations.of(context).text("do.form.date");
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
));
|
||||
|
||||
MainModel mainModel = Provider.of<MainModel>(context);
|
||||
|
||||
return LocalProgress(
|
||||
@@ -166,53 +245,198 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(children: <Widget>[
|
||||
Center(child: nameWidget(mainModel.customer.name)),
|
||||
phoneWidget(context, mainModel.customer.phoneNumber),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(Icons.location_on),
|
||||
Center(child: nameWidget(mainModel.customer.phoneNumber)),
|
||||
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),
|
||||
),
|
||||
Expanded(child: pickUpAddress),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(Icons.timer),
|
||||
),
|
||||
Text('Pickup Time',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 18)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 33),
|
||||
child: pickupTime,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Row(
|
||||
ExpansionTile(
|
||||
title: Text('Pickup Location / Time'),
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(Octicons.package),
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(Icons.location_on),
|
||||
),
|
||||
Expanded(
|
||||
child: widget.pickUp == null
|
||||
? pickUpAddress
|
||||
: widget.pickUp.status == 'Pending'
|
||||
? pickUpAddress
|
||||
: pickUpAddressReadOnly),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: noOfPackageBox),
|
||||
SizedBox(height: 15),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(Icons.timer),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: Text('Pickup Time',
|
||||
style: TextStyle(
|
||||
color: Colors.grey, fontSize: 14)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 5),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 33),
|
||||
child: widget.pickUp == null
|
||||
? pickupTime
|
||||
: widget.pickUp.status == 'Pending'
|
||||
? pickupTime
|
||||
: pickupTimeReadOnly,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 5),
|
||||
Container(height: 50.0, child: requestDateBox)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
ExpansionTile(
|
||||
title: Text('Package Informations'),
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(Octicons.package),
|
||||
),
|
||||
Expanded(
|
||||
child: widget.pickUp == null
|
||||
? noOfPackageBox
|
||||
: widget.pickUp.status == 'Pending'
|
||||
? noOfPackageBox
|
||||
: noOfPackageBoxReadonly),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
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),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: fcsInput("Remark", MaterialCommunityIcons.note),
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
fcsInput("Total Weight (lb)", FontAwesomeIcons.weightHanging),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
ExpansionTile(
|
||||
title: Text('Recipient Informations'),
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: widget.pickUp == null
|
||||
? fcsInput("Name", FontAwesomeIcons.user,
|
||||
controller: _recipientNameEditingController)
|
||||
: widget.pickUp.status == 'Pending'
|
||||
? fcsInput("Name", FontAwesomeIcons.user,
|
||||
controller:
|
||||
_recipientNameEditingController)
|
||||
: fcsInputReadOnly(
|
||||
"Name", FontAwesomeIcons.user,
|
||||
controller:
|
||||
_recipientNameEditingController)),
|
||||
SizedBox(height: 25),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: widget.pickUp == null
|
||||
? fcsInput("Phone Number", FontAwesomeIcons.phone,
|
||||
controller: _recipientPhoneEditingController)
|
||||
: widget.pickUp.status == 'Pending'
|
||||
? fcsInput(
|
||||
"Phone Number", FontAwesomeIcons.phone,
|
||||
controller:
|
||||
_recipientPhoneEditingController)
|
||||
: fcsInputReadOnly(
|
||||
"Phone Number", FontAwesomeIcons.phone,
|
||||
controller:
|
||||
_recipientPhoneEditingController)),
|
||||
SizedBox(height: 25),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0),
|
||||
child: widget.pickUp == null
|
||||
? fcsInput("Address", Icons.location_on,
|
||||
controller:
|
||||
_recipientAddressEditingController)
|
||||
: widget.pickUp.status == 'Pending'
|
||||
? fcsInput("Address", Icons.location_on,
|
||||
controller:
|
||||
_recipientAddressEditingController)
|
||||
: fcsInputReadOnly(
|
||||
"Address", Icons.location_on,
|
||||
controller:
|
||||
_recipientAddressEditingController)),
|
||||
SizedBox(height: 25),
|
||||
],
|
||||
),
|
||||
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(),
|
||||
SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
],
|
||||
),
|
||||
widget.pickUp != null
|
||||
? fcsDropDown("Assigned", MaterialCommunityIcons.worker)
|
||||
: Container(),
|
||||
fcsInput("Remark", MaterialCommunityIcons.note)
|
||||
]),
|
||||
)),
|
||||
widget.pickUp == null
|
||||
@@ -233,20 +457,35 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Update'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
widget.pickUp.status == 'Assigned'
|
||||
? Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Complete'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)))
|
||||
: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
child: FlatButton(
|
||||
child: Text('Update'),
|
||||
color: primaryColor,
|
||||
textColor: Colors.white,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
))),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Center(
|
||||
|
||||
Reference in New Issue
Block a user