v3
This commit is contained in:
@@ -60,43 +60,6 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -116,12 +79,13 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
body: Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
widget.package == null
|
||||
isNew ? Container() : Center(child: nameWidget(_package.market)),
|
||||
isNew
|
||||
? Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Text("New Package")))
|
||||
: Center(child: nameWidget(_package.packageNumber)),
|
||||
: Center(child: nameWidget(_package.trackingID)),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
@@ -134,26 +98,49 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: DropdownButtonFormField(
|
||||
value: _package.shipmentNumber,
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "PKG2039",
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Shipment Number',
|
||||
icon: Icon(Ionicons.ios_airplane,
|
||||
color: primaryColor)
|
||||
// prefixIcon: Icon(Icons.play_arrow)
|
||||
),
|
||||
items: ["A102", "A103", "A201", "A202"]
|
||||
.map((e) =>
|
||||
DropdownMenuItem(child: Text(e), value: e))
|
||||
.toList(),
|
||||
onChanged: (map) => {},
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Package ID',
|
||||
hintText: 'Package ID',
|
||||
filled: true,
|
||||
icon: Icon(MaterialCommunityIcons.id_card,
|
||||
color: primaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "FCS383-283-1",
|
||||
initialValue: isNew ? "" : "Amazon",
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Market',
|
||||
hintText: 'FCS_ID',
|
||||
filled: true,
|
||||
icon: Icon(MaterialCommunityIcons.cart_outline,
|
||||
color: primaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Tracking ID',
|
||||
hintText: 'Tracking ID',
|
||||
filled: true,
|
||||
icon: Icon(Octicons.package, color: primaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "FCS-0203-390-2",
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'FCS_ID',
|
||||
@@ -182,7 +169,7 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: isNew ? "" : "P0203",
|
||||
initialValue: isNew ? "" : "",
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Pickup ID',
|
||||
@@ -196,154 +183,90 @@ class _PackageEditorState extends State<PackageEditor> {
|
||||
),
|
||||
],
|
||||
),
|
||||
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(Entypo.box, color: primaryColor)),
|
||||
items: ["General", "Medicine", "Dangerous"]
|
||||
.map((e) =>
|
||||
DropdownMenuItem(child: Text(e), value: e))
|
||||
.toList(),
|
||||
onChanged: (map) => {},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
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,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Weight',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.weightHanging,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _package.rate.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Rate',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.tag,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||
child: TextFormField(
|
||||
initialValue: _package.amount.toString(),
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
labelText: 'Amount',
|
||||
filled: true,
|
||||
icon: Icon(FontAwesomeIcons.moneyBill,
|
||||
color: primaryColor),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
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,
|
||||
isNew
|
||||
? Container()
|
||||
: ExpansionTile(
|
||||
title: Text(
|
||||
'Processing',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
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),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
children: [
|
||||
Padding(
|
||||
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),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
isNew
|
||||
? Container()
|
||||
: 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(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 500,
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: isNew
|
||||
? Container()
|
||||
: Timeline(
|
||||
children: _models(),
|
||||
position: TimelinePosition.Left),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user