Files
fcs/lib/pages/shipment/shipment_list_row.dart

124 lines
4.1 KiB
Dart
Raw Normal View History

2020-10-15 03:06:13 +06:30
import 'package:fcs/domain/entities/shipment.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
2020-10-14 13:54:42 +06:30
import 'package:flutter/cupertino.dart';
2020-05-29 15:54:26 +06:30
import 'package:flutter/material.dart';
2020-06-01 14:42:42 +06:30
import 'package:flutter_icons/flutter_icons.dart';
2020-05-29 15:54:26 +06:30
2020-10-07 02:33:06 +06:30
import '../main/util.dart';
2020-10-07 14:42:07 +06:30
import 'shipment_editor.dart';
2020-10-16 10:58:31 +06:30
import 'shipment_info.dart';
2020-05-29 15:54:26 +06:30
2020-10-07 14:42:07 +06:30
class ShipmentListRow extends StatefulWidget {
final Shipment pickUp;
const ShipmentListRow({this.pickUp});
2020-05-29 15:54:26 +06:30
@override
2020-10-07 14:42:07 +06:30
_ShipmentListRowState createState() => _ShipmentListRowState();
2020-05-29 15:54:26 +06:30
}
2020-10-07 14:42:07 +06:30
class _ShipmentListRowState extends State<ShipmentListRow> {
2020-05-29 15:54:26 +06:30
final double dotSize = 15.0;
2020-10-07 14:42:07 +06:30
Shipment _pickUp = new Shipment();
2020-05-29 15:54:26 +06:30
@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;
// }
// });
}
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 15, right: 15),
2020-05-31 15:00:11 +06:30
child: InkWell(
onTap: () {
2020-10-15 03:06:13 +06:30
Navigator.of(context).push(CupertinoPageRoute(
2020-10-16 10:58:31 +06:30
builder: (context) => ShipmentInfo(shipment: _pickUp)));
2020-05-31 15:00:11 +06:30
},
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Row(
children: <Widget>[
2020-06-01 14:42:42 +06:30
Padding(
padding: EdgeInsets.all(5.0),
child: Icon(
2020-06-03 00:42:31 +06:30
SimpleLineIcons.direction,
2020-06-01 14:42:42 +06:30
color: primaryColor,
)),
2020-05-31 15:00:11 +06:30
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
2020-10-16 10:58:31 +06:30
_pickUp.shipmentNumber,
2020-05-31 15:00:11 +06:30
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
2020-05-29 15:54:26 +06:30
),
2020-05-31 15:00:11 +06:30
),
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
2020-06-01 14:42:42 +06:30
_pickUp.id == null
? ''
: "Last ${_pickUp.last} days",
2020-05-31 15:00:11 +06:30
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
2020-05-29 15:54:26 +06:30
),
2020-05-31 15:00:11 +06:30
)
],
2020-05-29 15:54:26 +06:30
),
2020-05-31 15:00:11 +06:30
),
],
2020-05-29 15:54:26 +06:30
),
),
2020-05-31 15:00:11 +06:30
),
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(0),
2020-10-16 10:58:31 +06:30
child: getStatus(_pickUp.currentStatus),
2020-05-31 15:00:11 +06:30
),
Padding(
2020-06-01 14:42:42 +06:30
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
2020-05-31 15:00:11 +06:30
child: Row(
children: <Widget>[
new Text(
_pickUp.weight == null
? ''
: _pickUp.weight.toString() + 'lb - ',
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
new Text(
_pickUp.numberOfPackage == null
? ""
: _pickUp.numberOfPackage.toString() + ' packages',
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
],
2020-05-29 15:54:26 +06:30
),
2020-05-31 15:00:11 +06:30
),
],
)
],
2020-05-29 15:54:26 +06:30
),
),
);
}
}