Files
fcs/lib/pages_fcs/delivery_list_row.dart
2020-09-04 15:30:10 +06:30

115 lines
3.7 KiB
Dart

import 'package:fcs/fcs/common/pages/util.dart';
import 'package:fcs/pages_fcs/box_editor.dart';
import 'package:fcs/vo/box.dart';
import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class DeliveryListRow extends StatefulWidget {
final bool isReadOnly;
final Box box;
const DeliveryListRow({this.box, this.isReadOnly});
@override
_DeliveryListRowState createState() => _DeliveryListRowState();
}
class _DeliveryListRowState extends State<DeliveryListRow> {
final double dotSize = 15.0;
Box _box = new Box();
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@override
void initState() {
super.initState();
_box = widget.box;
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: InkWell(
onTap: () {
if (widget.isReadOnly) {
// Navigator.push(
// context,
// BottomUpPageRoute(PackageInfo(package: _box)),
// );
} else {
Navigator.push(
context,
BottomUpPageRoute(BoxEditor(box: _box)),
);
}
},
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Row(
children: <Widget>[
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
_box.packageNumber == null
? ''
: _box.packageNumber,
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
dateFormat.format(_box.arrivedDate),
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
)
],
),
),
],
),
),
),
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(0),
child: getStatus(_box.status),
),
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
child: Row(
children: <Widget>[
new Text(
_box.weight == null
? ''
: _box.weight.toString() + 'lb - ',
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
new Text(
_box.price == null ? "" : "\$ " + _box.price.toString(),
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
],
),
),
],
)
],
),
),
);
}
}