add packages

This commit is contained in:
Sai Naw Wun
2020-06-03 00:42:31 +06:30
parent d41d48b405
commit c84e1beb9d
22 changed files with 439 additions and 265 deletions

View File

@@ -104,7 +104,7 @@
"reg.confirm":"Submit Registration?",
"reg.date":"Registeration Date",
"profile.title": "FCS Profile",
"profile.title": "Profile",
"profile.edit_title": "Edit FCS Profile",
"profile.name": "Name",
"profile.phone": "Phone",
@@ -552,7 +552,8 @@
"contact": "CONTACTS",
"fcs.profile": "PROFILE",
"fcs.btn": "FCS Profile",
"fcs.profile": "FCS PROFILE",
"contact.usa.phone": "USA Phone",
"contact.mm.phone": "Myanmar Phone"

BIN
assets/photos/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/photos/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
assets/photos/3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -60,7 +60,9 @@ class MainModel extends ChangeNotifier {
shippingAddress: '154-19 64th Ave.Flushing, \nNY 11367',
deliveryAddress: '39 42th St. Kyaut Ta Thar Township Yangon');
Setting setting = Setting(terms: '[{"insert":"* Minimum shipping weight is 1lbs.\n* Oversized goods, Light weight/Large volume items, laptops, phones, tablets may incur extra charges based on pecifications.Please contact us for pricing.\n* Goods with lithium battary needs extra packaging and declaration. Please inform us ahead of time so that we can process your package accordingly.\n* Loose Batteries, Drones, and Prescription medicines are not allowed on aircraft.\n* Payment: We accept money orders, any US bank transfers via Zelle, AYA, KBZ and CB. No COD except for pick-ups.\n*Payments made in Myanmar will incur 2% tranfer fee\n"}]');
Setting setting = Setting(
terms:
'[{"insert":"* Minimum shipping weight is 1lbs.\n* Oversized goods, Light weight/Large volume items, laptops, phones, tablets may incur extra charges based on pecifications.Please contact us for pricing.\n* Goods with lithium battary needs extra packaging and declaration. Please inform us ahead of time so that we can process your package accordingly.\n* Loose Batteries, Drones, and Prescription medicines are not allowed on aircraft.\n* Payment: We accept money orders, any US bank transfers via Zelle, AYA, KBZ and CB. No COD except for pick-ups.\n*Payments made in Myanmar will incur 2% tranfer fee\n"}]');
PackageInfo packageInfo;
bool isLoaded = true;
bool isOnline = true;
@@ -109,6 +111,14 @@ class MainModel extends ChangeNotifier {
return this.user != null;
}
bool isCustomer() {
return user != null && user.name != "Owner";
}
bool isOwner() {
return user != null && user.name == "Owner";
}
bool hasEmail() {
return this.user != null && this.user.isEmail();
}

View File

@@ -8,19 +8,19 @@ class ShipmentModel extends BaseModel {
Shipment(
shipDate: DateTime(2020, 4, 23),
shipmentNumber: 'A103B',
status: 'Pending',
status: 'In Progress',
arrivalDate: DateTime(2020, 4, 30),
departureDate: DateTime(2020, 4, 23)),
Shipment(
shipDate: DateTime(2020, 4, 2),
shipmentNumber: 'A100A',
status: 'Delivered',
status: 'Ready to ship',
arrivalDate: DateTime(2020, 4, 28),
departureDate: DateTime(2020, 4, 15)),
Shipment(
shipDate: DateTime(2020, 4, 2),
shipmentNumber: 'A100B',
status: 'Delivered',
status: 'Arrived',
arrivalDate: DateTime(2020, 4, 28),
departureDate: DateTime(2020, 4, 15)),
Shipment(
@@ -38,7 +38,7 @@ class ShipmentModel extends BaseModel {
Shipment(
shipDate: DateTime(2020, 4, 10),
shipmentNumber: 'A102B',
status: 'Assigned',
status: 'Arrived',
arrivalDate: DateTime(2020, 4, 30),
departureDate: DateTime(2020, 4, 20),
)
@@ -47,29 +47,31 @@ class ShipmentModel extends BaseModel {
List<Shipment> get canceled {
List<Shipment> _p = shipments.where((e) => e.status == "Canceled").toList()
..sort((e1, e2) {
return e2.shipDate.compareTo(e1.shipDate);
return e1.shipDate.compareTo(e2.shipDate);
});
return _p;
}
List<Shipment> get completed {
return shipments.where((e) => e.status == "Delivered").toList()
return shipments.where((e) => e.status == "Arrived").toList()
..sort((e1, e2) {
return e2.shipDate.compareTo(e1.shipDate);
return e1.shipDate.compareTo(e2.shipDate);
});
}
List<Shipment> get upcoming {
return shipments
List<Shipment> _shipments = shipments
.where((e) =>
e.status == "Pending" ||
e.status == "Assigned" ||
e.status == "In Progress" ||
e.status == "Ready to ship" ||
e.status == "Processed" ||
e.status == "Rescheduled")
.toList()
..sort((e1, e2) {
return e2.shipDate.compareTo(e1.shipDate);
.toList();
_shipments.sort((e1, e2) {
return e1.shipDate.compareTo(e2.shipDate);
});
return _shipments;
}
void initUser(user) {

View File

@@ -14,51 +14,51 @@ class MessageModel extends BaseModel {
List<Message> messages = [
Message(
senderName: "FCS System",
receiverName: "Online Buyer",
receiverName: "Ko Myo Min",
date: DateTime(2020, 6, 1, 1, 1, 1),
message:
"Hi Online Buyer, we received your goods. Please see the following link",
"Hi Ko Myo Min, we received your goods. Please see the following link",
),
Message(
senderName: "FCS System",
receiverName: "Online Buyer",
receiverName: "Ko Myo Min",
date: DateTime(2020, 6, 1, 1, 1, 1),
message:
"'A202-3 #1'",
),
Message(
senderName: "FCS System",
receiverName: "Online Buyer",
receiverName: "Ko Myo Min",
date: DateTime(2020, 6, 1, 1, 5, 1),
message: "Thank you. Will check the photos.",
isMe: false),
Message(
senderName: "FCS System",
receiverName: "Online Buyer",
receiverName: "Ko Myo Min",
date: DateTime(2020, 6, 1, 2, 1, 1),
message:
"Hi Online Buyer, we successfully processed your goods and ready for payment. Please see in the following link.",
"Hi Ko Myo Min, we successfully processed your goods and ready for payment. Please see in the following link.",
),
Message(
senderName: "FCS System",
receiverName: "Online Buyer",
receiverName: "Ko Myo Min",
date: DateTime(2020, 6, 1, 2, 1, 1),
message:
"'INV202005010387'",
),
Message(
senderName: "FCS System",
receiverName: "Online Buyer",
receiverName: "Ko Myo Min",
date: DateTime(2020, 6, 1, 2, 10, 1),
message:
"Hi Online Buyer, we have confirmed your payment and ready to ship your packages.",
"Hi Ko Myo Min, we have confirmed your payment and ready to ship your packages.",
),
Message(
senderName: "FCS System",
receiverName: "Shipper",
date: DateTime(2020, 6, 1, 1, 1, 1),
message:
"Hi Online Buyer, we received your goods. Please see in the following link.",
"Hi Ko Myo Min, we received your goods. Please see in the following link.",
),
Message(
senderName: "FCS System",
@@ -72,7 +72,7 @@ class MessageModel extends BaseModel {
receiverName: "Shipper",
date: DateTime(2020, 6, 1, 2, 1, 1),
message:
"Hi Online Buyer, we successfully processed your goods and ready for payment. Please see in the following link.",
"Hi FCS Team, we successfully processed your goods and ready for payment. Please see in the following link.",
),
Message(
senderName: "FCS System",
@@ -86,7 +86,14 @@ class MessageModel extends BaseModel {
receiverName: "Shipper",
date: DateTime(2020, 6, 1, 2, 10, 1),
message:
"Hi Online Buyer, we have confirmed your payment and ready to ship your packages.",
"Hi FCS Team, we have confirmed your payment and ready to ship your packages.",
),
Message(
senderName: "Ko Myo Min",
receiverName: "FCS Team",
date: DateTime(2020, 6, 1, 2, 10, 1),
message:
"Hi Ko Myo Min, we have recevied your pickup request. We will arrange the pickup soon. Thank you.",
),
];

View File

@@ -9,78 +9,103 @@ class PackageModel extends BaseModel {
final log = Logger('PackageModel');
StreamSubscription<QuerySnapshot> listener;
static List<Status> statusHistory = [
Status(status: "Received", date: DateTime(2020, 6, 1), done: true),
Status(status: "Processed", date: DateTime(2020, 6, 1), done: true),
Status(status: "Shipped", date: DateTime(2020, 6, 5), done: false),
Status(status: "Delivered", date: DateTime(2020, 6, 15), done: false)
];
List<Package> packages = [
Package(
shipmentNumber: "A202",
receiverNumber: "3",
receiverName: "Ko Oo",
boxNumber: "1",
rate: 7,
packageType: "General",
weight: 25,
status: "Received",
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
cargoDesc: "Clothes",
arrivedDate: DateTime(2020, 6, 1),
),
statusHistory: statusHistory),
Package(
shipmentNumber: "A202",
receiverNumber: "3",
receiverName: "Ko Oo",
boxNumber: "2",
rate: 7,
packageType: "General",
weight: 20,
status: "Received",
cargoDesc: "Clothes",
arrivedDate: DateTime(2020, 6, 1),
statusHistory: statusHistory,
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
Package(
shipmentNumber: "A202",
receiverNumber: "3",
receiverName: "Ko Oo",
boxNumber: "3",
rate: 7,
packageType: "General",
weight: 15,
status: "Waiting for payment",
cargoDesc: "Shoes",
status: "Processed",
arrivedDate: DateTime(2020, 6, 1),
statusHistory: statusHistory,
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
Package(
shipmentNumber: "A202",
receiverNumber: "2",
receiverName: "Ma Aye",
boxNumber: "1",
rate: 8,
packageType: "Medicine",
weight: 15,
status: "Processing",
status: "Processed",
cargoDesc: "Dietary supplement",
arrivedDate: DateTime(2020, 6, 1),
statusHistory: statusHistory,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'),
Package(
shipmentNumber: "A202",
receiverNumber: "2",
receiverName: "Ma Aye",
boxNumber: "2",
rate: 7,
packageType: "General",
cargoDesc: "Handbags",
weight: 55,
status: "Ready to ship",
arrivedDate: DateTime(2020, 6, 1),
statusHistory: statusHistory,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'),
Package(
shipmentNumber: "A201",
receiverNumber: "1",
receiverName: "Ko Wai",
boxNumber: "1",
rate: 9,
packageType: "Dangerous",
cargoDesc: "Phones and Scooters",
weight: 25,
status: "Delivered",
arrivedDate: DateTime(2020, 5, 21),
statusHistory: statusHistory,
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'),
Package(
shipmentNumber: "A201",
receiverNumber: "1",
receiverName: "Ko Wai",
boxNumber: "2",
rate: 7,
packageType: "General",
cargoDesc: "Construction tools",
weight: 5,
status: "Delivered",
arrivedDate: DateTime(2020, 5, 21),
statusHistory: statusHistory,
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'),
];
@@ -94,7 +119,7 @@ class PackageModel extends BaseModel {
List<Package> get upcoming {
return packages
.where((e) =>
e.status == "Processing" ||
e.status == "Processed" ||
e.status == "Received" ||
e.status == "Ready to ship")
.toList()

View File

@@ -83,7 +83,7 @@ class _CustomerListState extends State<CustomerList> {
padding: new EdgeInsets.symmetric(
horizontal: 32.0 - dotSize / 2),
child: Icon(
Feather.users,
Feather.user,
color: primaryColor,
size: 40,
),

View File

@@ -103,13 +103,16 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
login = Provider.of<MainModel>(context).isLogin();
var owner = Provider.of<MainModel>(context).isOwner();
var customer = Provider.of<MainModel>(context).isCustomer();
final packagesBtn = _buildBtn2("package.name",
icon: Octicons.package,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(PackageList())));
final pickUpBtn = _buildBtn2("pickup",
icon: MaterialCommunityIcons.directions,
icon: SimpleLineIcons.direction,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(PickUpList())));
@@ -118,7 +121,7 @@ class _HomePageState extends State<HomePage> {
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(ShipmentRates())));
final fcsProfileBtn = _buildBtn2("profile.title",
final fcsProfileBtn = _buildBtn2("fcs.btn",
// imgIcon: Image.asset("assets/logo_btn.png", height: 25,color:Colors.white),
icon: MaterialCommunityIcons.home_city,
btnCallback: () =>
@@ -171,16 +174,16 @@ class _HomePageState extends State<HomePage> {
Navigator.of(context).push(BottomUpPageRoute(Term())));
List<Widget> widgets = [];
widgets.add(buyingBtn);
widgets.add(pickUpBtn);
widgets.add(shipmentBtn);
widgets.add(notiBtn);
widgets.add(staffBtn);
widgets.add(fcsProfileBtn);
customer ? widgets.add(buyingBtn) : "";
customer || owner ? widgets.add(pickUpBtn) : "";
owner ? widgets.add(shipmentBtn) : "";
customer || owner ? widgets.add(notiBtn) : "";
owner ? widgets.add(staffBtn) : "";
owner ? widgets.add(fcsProfileBtn) : "";
widgets.add(shipmentCostBtn);
widgets.add(packagesBtn);
widgets.add(customersBtn);
widgets.add(invoicesBtn);
customer || owner ? widgets.add(packagesBtn) : "";
owner ? widgets.add(customersBtn) : "";
customer || owner ? widgets.add(invoicesBtn) : "";
widgets.add(termBtn);
return OfflineRedirect(

View File

@@ -10,6 +10,7 @@ import 'package:fcs/widget/multi_img_file.dart';
import 'package:fcs/widget/my_data_table.dart';
import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.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';
@@ -48,7 +49,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
_dateController.text = dateFormatter.format(_invoice.invoiceDate);
_nameController.text = _invoice.customerName;
_phoneController.text = _invoice.customerPhoneNumber;
_amountController.text = _invoice.amount.toString();
_amountController.text = _invoice.getAmount.toString();
_statusController.text = _invoice.status.toString();
_packages = _invoice.packages;
} else {
@@ -123,8 +124,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.pages,
color: Colors.grey,
FontAwesomeIcons.fileInvoice,
color: primaryColor,
),
)),
),
@@ -132,7 +133,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
? Container(
padding: EdgeInsets.only(top: 5),
child: TextFormField(
initialValue: "U Nyi",
initialValue: "Ko Myo Min",
cursorColor: primaryColor,
decoration: InputDecoration(
fillColor: Colors.white,
@@ -144,8 +145,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
borderSide: BorderSide(
color: Colors.grey, width: 1.0)),
icon: Icon(
Icons.account_box,
color: Colors.grey,
FontAwesomeIcons.fileInvoice,
color: primaryColor,
),
suffixIcon: IconButton(
icon: Icon(
@@ -167,34 +168,34 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white,
labelText: 'Customer Name',
labelStyle:
TextStyle(fontSize: 16, color: Colors.grey),
TextStyle(fontSize: 16, color: primaryColor),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.account_box,
color: Colors.grey,
Feather.user,
color: primaryColor,
),
)),
),
widget.invoice == null
? Container()
: TextFormField(
controller: _phoneController,
readOnly: true,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Customer Phone Number',
labelStyle:
TextStyle(fontSize: 16, color: Colors.grey),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.phone,
color: Colors.grey,
),
)),
// widget.invoice == null
// ? Container()
// : TextFormField(
// controller: _phoneController,
// readOnly: true,
// decoration: InputDecoration(
// fillColor: Colors.white,
// labelText: 'Customer Phone Number',
// labelStyle:
// TextStyle(fontSize: 16, color: Colors.grey),
// filled: true,
// enabledBorder: InputBorder.none,
// focusedBorder: InputBorder.none,
// icon: Icon(
// Icons.phone,
// color: Colors.grey,
// ),
// )),
Container(
padding: EdgeInsets.only(top: 0),
child: fcsInput('Amount', FontAwesomeIcons.moneyBill,
@@ -215,12 +216,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white,
labelText: 'Status',
filled: true,
icon: Image.asset(
'assets/status.png',
width: 24,
height: 24,
color: Colors.grey[700],
),
icon: Icon(Icons.av_timer,color: primaryColor,),
)),
),
SizedBox(

View File

@@ -90,7 +90,7 @@ class MessageDetail extends StatelessWidget {
message: e.message,
time: dateFormat.format(e.date),
delivered: true,
isMe: e.isMe != null ? e.isMe : true))
isMe: !(e.isMe != null ? e.isMe : true)))
.toList();
return Scaffold(

View File

@@ -45,11 +45,13 @@ class _PickUpEditorState extends State<PickUpEditor> {
PickUp _pickUp;
bool _isLoading = false;
var now = new DateTime.now();
bool isNew;
@override
void initState() {
super.initState();
if (widget.pickUp != null) {
isNew = false;
_pickUp = widget.pickUp;
_addressEditingController.text = _pickUp.address;
_fromTimeEditingController.text = _pickUp.fromTime;
@@ -63,6 +65,8 @@ class _PickUpEditorState extends State<PickUpEditor> {
_recipientPhoneEditingController.text = mainModel.recipient.phoneNumber;
_recipientAddressEditingController.text =
mainModel.recipient.shippingAddress;
} else {
isNew = true;
}
}
@@ -190,7 +194,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0),
icon: Icon(
Icons.date_range,
color: Colors.grey,
color: primaryColor,
)),
validator: (value) {
if (value.isEmpty) {
@@ -224,7 +228,9 @@ class _PickUpEditorState extends State<PickUpEditor> {
child: ListView(children: <Widget>[
Center(child: nameWidget(mainModel.customer.name)),
Center(child: nameWidget(mainModel.customer.phoneNumber)),
Center(
isNew
? Container()
: Center(
child: Padding(
padding: const EdgeInsets.only(left: 10.0, top: 8),
child: Text(

View File

@@ -58,7 +58,7 @@ class _PickupListRowState extends State<PickupListRow> {
Padding(
padding: EdgeInsets.all(5.0),
child: Icon(
MaterialCommunityIcons.directions,
SimpleLineIcons.direction,
color: primaryColor,
)),
new Expanded(

View File

@@ -254,27 +254,6 @@ class _ProfileState extends State<Profile> {
),
),
));
Future<String> getVersionNumber() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String version = packageInfo.version + "+" + packageInfo.buildNumber;
return version;
}
final versionbox = Container(
padding: EdgeInsets.only(top: 15),
child: Container(
child: Center(
child: FutureBuilder(
future: getVersionNumber(),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) =>
Text(
snapshot.hasData ? "v${snapshot.data}" : "Loading ...",
style: TextStyle(fontSize: 16.0, fontStyle: FontStyle.normal),
),
)),
));
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(

View File

@@ -266,7 +266,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
child: ListView(children: <Widget>[
// _showCustomerData(mainModel.customer),
widget.shipment == null
? fcsInput('Shipment Number', Icons.text_rotation_none,
? fcsInput('Shipment Number', Ionicons.ios_airplane,
controller: _shipmentNumberController)
: Container(
child: TextFormField(
@@ -281,8 +281,8 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.text_rotation_none,
color: Colors.grey,
Ionicons.ios_airplane,
color: primaryColor,
),
)),
),
@@ -293,26 +293,6 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
controller: _cutoffDateController),
)
: Container(),
widget.shipment == null
? Container(
padding: EdgeInsets.only(top: 5),
child: DropdownButtonFormField(
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Shipment Type',
icon: Icon(Icons.pages)),
items: shipmentModel.shipmentType
.map((e) =>
DropdownMenuItem(child: Text(e), value: e))
.toList(),
onChanged: (selected) => {
setState(() {
_currentShipment = selected;
})
},
),
)
: Container(),
Container(
padding:
EdgeInsets.only(top: widget.shipment == null ? 5 : 0),
@@ -324,6 +304,28 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
child: fcsInput('Departure Date', Icons.date_range,
controller: _departureDateControler),
),
widget.shipment == null
? Container(
padding: EdgeInsets.only(top: 5),
child: DropdownButtonFormField(
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Shipment Type',
icon: Icon(Ionicons.ios_airplane,
color: primaryColor)),
items: shipmentModel.shipmentType
.map((e) =>
DropdownMenuItem(child: Text(e), value: e))
.toList(),
onChanged: (selected) => {
setState(() {
_currentShipment = selected;
})
},
),
)
: Container(),
widget.shipment == null
? Container(
padding: EdgeInsets.only(top: 5),
@@ -358,18 +360,13 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
fillColor: Colors.white,
labelText: 'Status',
filled: true,
labelStyle:
TextStyle(fontSize: 16, color: Colors.grey),
labelStyle: TextStyle(
fontSize: 16, color: Colors.grey),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.grey, width: 1.0)),
icon: Image.asset(
'assets/status.png',
width: 24,
height: 24,
color: Colors.grey[700],
),
)),
icon: Icon(Icons.av_timer,
color: primaryColor))),
),
widget.shipment == null
? Container()

View File

@@ -417,7 +417,7 @@ Widget fcsInput(String label, IconData iconData,
filled: true,
icon: Icon(
iconData,
color: Colors.grey,
color: primaryColor,
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1.0)),

View File

@@ -1,12 +1,13 @@
import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/package.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:intl/intl.dart';
import 'package:timeline_list/timeline.dart';
import 'package:timeline_list/timeline_model.dart';
import '../theme/theme.dart';
@@ -29,18 +30,26 @@ class _PackageEditorState extends State<PackageEditor> {
Package _package;
bool _isLoading = false;
List<String> _images = [
"assets/photos/1.jpg",
"assets/photos/2.jpg",
"assets/photos/3.jpg"
];
bool isNew;
@override
void initState() {
super.initState();
if (widget.package != null) {
_package = widget.package;
isNew = false;
// _addressEditingController.text = _pickUp.address;
// _fromTimeEditingController.text = _pickUp.fromTime;
// _toTimeEditingController.text = _pickUp.toTime;
// _noOfPackageEditingController.text = _pickUp.numberOfPackage.toString();
// _weightEditingController.text = _pickUp.weight.toString();
} else {
isNew = true;
_package = Package(rate: 0, weight: 0);
}
}
@@ -50,8 +59,48 @@ class _PackageEditorState extends State<PackageEditor> {
super.dispose();
}
final DateFormat dateFormat = DateFormat("d MMM yyyy");
List<TimelineModel> _models() {
return _package.statusHistory
.map((e) => TimelineModel(
Padding(
padding: const EdgeInsets.all(18.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(e.status,
style: TextStyle(
color: e.done ? primaryColor : Colors.grey,
fontSize: 16,
fontWeight: FontWeight.bold)),
e.status == "Processed"
? Text("(Waiting for payment)",
style: TextStyle(
color: e.done ? primaryColor : Colors.grey,
fontSize: 14,
fontWeight: FontWeight.bold))
: Container(),
Text(dateFormat.format(e.date)),
],
),
),
iconBackground: e.done ? primaryColor : Colors.grey,
icon: Icon(
e.status == "Shipped"
? Ionicons.ios_airplane
: e.status == "Delivered"
? MaterialCommunityIcons.truck_fast
: e.status == "Processed"
? MaterialIcons.check
: Octicons.package,
color: Colors.white,
)))
.toList();
}
@override
Widget build(BuildContext context) {
var images = isNew ? [] : _images;
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
@@ -67,26 +116,31 @@ class _PackageEditorState extends State<PackageEditor> {
body: Card(
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: [
widget.package == null
? Center(
child: Container(
padding: EdgeInsets.all(8),
child: Text("New Package")))
: Center(child: nameWidget(_package.packageNumber)),
Expanded(
child: ListView(
children: [
ExpansionTile(
title: Text('Package Information'),
title: Text(
'Receiving',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0),
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: DropdownButtonFormField(
value: _package.shipmentNumber,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Shipment Number',
icon: Icon(Icons.pages)
icon: Icon(Ionicons.ios_airplane,
color: primaryColor)
// prefixIcon: Icon(Icons.play_arrow)
),
items: ["A102", "A103", "A201", "A202"]
@@ -97,32 +151,66 @@ class _PackageEditorState extends State<PackageEditor> {
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: "FCS383-283-1",
initialValue: isNew ? "" : "FCS383-283-1",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'FCS_ID',
hintText: 'FCS_ID',
filled: true,
icon: Icon(
Icons.account_box,
),
icon: Icon(Feather.user, color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _package.receiverName,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Customer Name',
filled: true,
icon: Icon(Feather.user, color: Colors.white),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "P0203",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Pickup ID',
filled: true,
icon: Icon(MaterialCommunityIcons.directions,
color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
],
),
ExpansionTile(
title: Text(
'Processing',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: DropdownButtonFormField(
value: _package.packageType,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Cargo Type',
icon: Icon(Icons.pages)
// prefixIcon: Icon(Icons.play_arrow)
),
icon: Icon(Entypo.box, color: primaryColor)),
items: ["General", "Medicine", "Dangerous"]
.map((e) =>
DropdownMenuItem(child: Text(e), value: e))
@@ -131,7 +219,20 @@ class _PackageEditorState extends State<PackageEditor> {
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue:
isNew ? "" : _package.cargoDesc.toString(),
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Description',
filled: true,
icon: Icon(MaterialIcons.description,
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _package.weight.toString(),
textAlign: TextAlign.end,
@@ -139,13 +240,12 @@ class _PackageEditorState extends State<PackageEditor> {
fillColor: Colors.white,
labelText: 'Weight',
filled: true,
icon: Icon(
FontAwesomeIcons.weightHanging,
),
icon: Icon(FontAwesomeIcons.weightHanging,
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _package.rate.toString(),
textAlign: TextAlign.end,
@@ -153,13 +253,12 @@ class _PackageEditorState extends State<PackageEditor> {
fillColor: Colors.white,
labelText: 'Rate',
filled: true,
icon: Icon(
FontAwesomeIcons.tag,
),
icon: Icon(FontAwesomeIcons.tag,
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _package.amount.toString(),
textAlign: TextAlign.end,
@@ -167,57 +266,81 @@ class _PackageEditorState extends State<PackageEditor> {
fillColor: Colors.white,
labelText: 'Amount',
filled: true,
icon: Icon(
FontAwesomeIcons.moneyBill,
),
icon: Icon(FontAwesomeIcons.moneyBill,
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: TextFormField(
initialValue: "P0203",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Pickup ID',
filled: true,
icon: Icon(
Icons.account_box,
],
),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
ExpansionTile(
title: Text(
'Photos',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Container(
height: 130,
width: 500,
child: ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
itemCount: images.length + 1,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
if (index == images.length) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: 200,
height: 70,
decoration: BoxDecoration(
border: Border.all(
color: primaryColor,
width: 2.0,
),
),
child: Icon(SimpleLineIcons.plus),
),
);
} else {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: 200,
height: 70,
decoration: BoxDecoration(
border: Border.all(
color: primaryColor,
width: 2.0,
),
),
child: Image.asset(images[index],
width: 50, height: 50),
),
);
}
},
),
),
],
),
ExpansionTile(
title: Text('Photos'),
title: Text(
'Status',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Container(
height: 130,
width: 500,
child: ListView(
// scrollDirection: Axis.horizontal,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: DropdownButtonFormField(
value: _package.shipmentNumber,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Shipment Number',
icon: Icon(Icons.pages)
// prefixIcon: Icon(Icons.play_arrow)
),
items: ["A102", "A103", "A201", "A202"]
.map((e) => DropdownMenuItem(
child: Text(e), value: e))
.toList(),
onChanged: (map) => {},
),
),
],
),
height: 500,
padding: EdgeInsets.only(left: 20),
child: isNew
? Container()
: Timeline(
children: _models(),
position: TimelinePosition.Left),
),
],
)
@@ -231,7 +354,7 @@ class _PackageEditorState extends State<PackageEditor> {
child: Container(
width: 250,
child: FlatButton(
child: Text('Create package'),
child: Text('Complete receiving'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
@@ -248,7 +371,7 @@ class _PackageEditorState extends State<PackageEditor> {
child: Container(
width: 250,
child: FlatButton(
child: Text('Save package'),
child: Text('Complete processing'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {

View File

@@ -21,4 +21,6 @@ class Invoice {
this.status,
this.paymentAttachment,
this.packages});
double get getAmount => packages.fold(0, (p, e) => (e.rate * e.weight) + p);
}

View File

@@ -1,3 +1,10 @@
class Status {
String status;
DateTime date;
bool done;
Status({this.status, this.date, this.done});
}
class Package {
String id;
String shipmentNumber;
@@ -9,6 +16,7 @@ class Package {
String receiverNumber;
String boxNumber;
String status;
String cargoDesc;
int rate;
int weight;
@@ -24,6 +32,8 @@ class Package {
shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
double get price => rate.toDouble() * weight;
List<Status> statusHistory;
Package(
{this.id,
this.shipmentNumber,
@@ -40,5 +50,7 @@ class Package {
this.pickUpID,
this.remark,
this.status,
this.arrivedDate});
this.arrivedDate,
this.cargoDesc,
this.statusHistory});
}

View File

@@ -693,6 +693,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
timeline_list:
dependency: "direct main"
description:
name: timeline_list
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.5"
typed_data:
dependency: transitive
description:

View File

@@ -66,6 +66,9 @@ dependencies:
pin_input_text_field:
flutter_icons: ^1.1.0
country_icons: ^1.1.1
timeline_list: ^0.0.5
dev_dependencies:
flutter_test:
@@ -76,6 +79,7 @@ flutter:
assets:
- assets/
- assets/local/
- assets/photos/
fonts: