update pickup

This commit is contained in:
Thinzar Win
2020-06-30 16:27:56 +06:30
parent 9fc7ef5381
commit a8caaf6073
8 changed files with 250 additions and 166 deletions

View File

@@ -4,6 +4,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fcs/vo/cargo.dart';
import 'package:fcs/vo/fcs_profile.dart';
import 'package:fcs/vo/pickup.dart';
import 'package:fcs/vo/radio.dart';
import 'package:logging/logging.dart';
import 'base_model.dart';
@@ -22,6 +23,25 @@ class PickUpModel extends BaseModel {
mail: 'admin@fcs.com',
facebook: 'https://facebook.com/fcs');
List<RadioGroup> radioGroups = [
RadioGroup(
text: "FCS Pickup",
index: 1,
),
RadioGroup(
text: "Courier Pickup",
index: 2,
),
RadioGroup(
text: "FCS Drop-off",
index: 3,
),
RadioGroup(
text: "Courier Drop-off",
index: 4,
),
];
List<PickUp> pickups = [
PickUp(
id: "P200412 - 12 Apr 2020",
@@ -35,6 +55,7 @@ class PickUpModel extends BaseModel {
date: DateTime(2020, 5, 1),
address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000,
isCourier: true,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),

View File

@@ -108,7 +108,10 @@ class _NotificationListState extends State<NotificationList> {
),
msg.fromToday()
? Container()
: Text(dateFormatter.format(msg.date),style: TextStyle(color: Colors.grey),),
: Text(
dateFormatter.format(msg.date),
style: TextStyle(color: Colors.grey),
),
],
),
)

View File

@@ -90,7 +90,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("box.edit.title")),
title: Text(AppTranslations.of(context).text("package.edit.title")),
),
body: Card(
child: Column(
@@ -220,7 +220,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
),
ExpansionTile(
title: Text(
'Shipping Address',
'Address',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
@@ -232,7 +232,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
child: Align(
alignment: Alignment.bottomRight,
child: Container(
width: 130,
width: 120,
height: 40,
child: FloatingActionButton.extended(
materialTapTargetSize:
@@ -240,7 +240,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
onPressed: () {},
icon: Icon(Icons.add),
label: Text(
'Add Shipping\nAddress',
'Select\nAddress',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
@@ -261,7 +261,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
child: Container(
width: 250,
child: FlatButton(
child: Text('Create New Box'),
child: Text('Create New Package'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
@@ -278,7 +278,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
child: Container(
width: 250,
child: FlatButton(
child: Text('Update Box'),
child: Text('Update Package'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {

View File

@@ -58,6 +58,9 @@ class _PickUpEditorState extends State<PickUpEditor> {
bool isNew;
ShippingAddress _shippingAddress = new ShippingAddress();
dynamic _currVal = 1;
String _currText = '';
@override
void initState() {
super.initState();
@@ -265,134 +268,53 @@ class _PickUpEditorState extends State<PickUpEditor> {
),
widget.pickUp == null
? Container()
: Padding(
padding: const EdgeInsets.only(left: 15.0),
child: fcsInputReadOnly(
"Handling Fee", FontAwesomeIcons.moneyBill,
controller: _handlingFeeController),
// child: widget.pickUp == null
// ? fcsInput(
// "Handling Fee", FontAwesomeIcons.moneyBill,
// controller: _handlingFeeController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput(
// "Handling Fee", FontAwesomeIcons.moneyBill,
// controller: _handlingFeeController)
// : fcsInputReadOnly(
// "Handling Fee", FontAwesomeIcons.moneyBill,
// controller: _handlingFeeController),
),
: widget.pickUp.isCourier
? Padding(
padding: const EdgeInsets.only(left: 15.0),
child: fcsInputReadOnly(
"Courier Fee", FontAwesomeIcons.moneyBill,
controller: _handlingFeeController),
)
: Padding(
padding: const EdgeInsets.only(left: 15.0),
child: fcsInputReadOnly(
"Handling Fee", FontAwesomeIcons.moneyBill,
controller: _handlingFeeController),
),
ExpansionTile(
title: Text(
'Pickup Location / Time',
'Shipment Type',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? pickUpAddress
: widget.pickUp.status == 'Pending'
? pickUpAddress
: pickUpAddressReadOnly,
),
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)
],
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(),
),
),
],
),
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),
],
),
ExpansionTile(
title: Text(
'Box Information',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Column(
children: getBoxList(context, boxModel.boxes),
@@ -416,7 +338,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
);
},
label: Text(
'Add Box',
'Add Package',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
@@ -427,53 +349,184 @@ class _PickUpEditorState extends State<PickUpEditor> {
SizedBox(height: 10.0),
],
),
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: 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,
),
),
),
),
],
),
// 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(
// 'Shipping Address',
// 'Package Information',
// style: TextStyle(
// color: primaryColor, fontWeight: FontWeight.bold),
// ),
// 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)),
// 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("Phone Number", Icons.phone,
// controller: _recipientPhoneEditingController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput("Phone Number", Icons.phone,
// controller:
// _recipientPhoneEditingController)
// : fcsInputReadOnly(
// "Phone Number", Icons.phone,
// controller:
// _recipientPhoneEditingController)),
// 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: 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)),
// 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()

View File

@@ -13,6 +13,7 @@ class PickUp {
String status;
DateTime date;
List<Cargo> cargoTypes;
bool isCourier;
PickUp(
{this.id,
@@ -26,7 +27,8 @@ class PickUp {
this.address,
this.status,
this.date,
this.cargoTypes});
this.cargoTypes,
this.isCourier=false});
int get last => DateTime.now().difference(date).inDays;

5
lib/vo/radio.dart Normal file
View File

@@ -0,0 +1,5 @@
class RadioGroup {
String text;
dynamic index;
RadioGroup({this.text, this.index});
}