add update shipments

This commit is contained in:
Sai Naw Wun
2020-10-18 02:38:46 +06:30
parent fa9738f307
commit 4f8bde40b0
37 changed files with 596 additions and 455 deletions

View File

@@ -1,49 +1,25 @@
import 'package:fcs/domain/entities/shipment.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import '../main/util.dart';
import 'shipment_editor.dart';
import 'shipment_info.dart';
class ShipmentListRow extends StatefulWidget {
class ShipmentListRow extends StatelessWidget {
final Shipment pickUp;
const ShipmentListRow({this.pickUp});
@override
_ShipmentListRowState createState() => _ShipmentListRowState();
}
class _ShipmentListRowState extends State<ShipmentListRow> {
final double dotSize = 15.0;
Shipment _pickUp = new Shipment();
@override
void initState() {
super.initState();
// PickUpModel pickUpModel = Provider.of<PickUpModel>(context, listen: false);
if (widget.pickUp != null) {
_pickUp = widget.pickUp;
// pickUpModel.pickups.forEach((b) {
// if (widget.pickUp.id == b.id) {
// _pickUp = b;
// }
// });
}
}
const ShipmentListRow({Key key, this.pickUp}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: InkWell(
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => ShipmentInfo(shipment: _pickUp)));
},
return InkWell(
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => ShipmentInfo(shipment: pickUp)));
},
child: Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: Row(
children: <Widget>[
Expanded(
@@ -64,7 +40,7 @@ class _ShipmentListRowState extends State<ShipmentListRow> {
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
_pickUp.shipmentNumber,
pickUp.shipmentNumber,
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
@@ -72,9 +48,9 @@ class _ShipmentListRowState extends State<ShipmentListRow> {
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
_pickUp.id == null
pickUp.id == null
? ''
: "Last ${_pickUp.last} days",
: "Last ${pickUp.last} days",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
@@ -90,23 +66,23 @@ class _ShipmentListRowState extends State<ShipmentListRow> {
children: <Widget>[
Padding(
padding: const EdgeInsets.all(0),
child: getStatus(_pickUp.currentStatus),
child: getStatus(pickUp.currentStatus),
),
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
child: Row(
children: <Widget>[
new Text(
_pickUp.weight == null
pickUp.weight == null
? ''
: _pickUp.weight.toString() + 'lb - ',
: pickUp.weight.toString() + 'lb - ',
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
new Text(
_pickUp.numberOfPackage == null
pickUp.numberOfPackage == null
? ""
: _pickUp.numberOfPackage.toString() + ' packages',
: pickUp.numberOfPackage.toString() + ' packages',
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),