Files
fcs/lib/pages_fcs/package_list_row.dart

133 lines
4.6 KiB
Dart
Raw Normal View History

2020-06-02 14:56:51 +06:30
import 'package:fcs/pages/invoice/package_info.dart';
2020-06-01 11:52:12 +06:30
import 'package:fcs/pages/util.dart';
import 'package:fcs/pages_fcs/package_editor.dart';
import 'package:fcs/vo/package.dart';
2020-06-02 14:56:51 +06:30
import 'package:fcs/widget/bottom_up_page_route.dart';
2020-06-01 11:52:12 +06:30
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class PackageListRow extends StatefulWidget {
2020-06-02 14:56:51 +06:30
final bool isReadOnly;
2020-06-01 11:52:12 +06:30
final Package package;
2020-06-02 14:56:51 +06:30
const PackageListRow({this.package, this.isReadOnly});
2020-06-01 11:52:12 +06:30
@override
_PackageListRowtate createState() => _PackageListRowtate();
}
class _PackageListRowtate extends State<PackageListRow> {
final double dotSize = 15.0;
Package _package = new Package();
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@override
void initState() {
super.initState();
_package = widget.package;
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: InkWell(
onTap: () {
2020-06-02 14:56:51 +06:30
if (widget.isReadOnly) {
Navigator.push(
context,
BottomUpPageRoute(PackageInfo(package: _package)),
);
} else {
Navigator.push(
context,
BottomUpPageRoute(PackageEditor(package: _package)),
);
}
2020-06-01 11:52:12 +06:30
},
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(
2020-07-02 16:16:21 +06:30
_package.id == null ? '' : _package.trackingID,
2020-06-04 01:36:49 +06:30
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
_package.market == null ? '' : _package.market,
2020-06-01 11:52:12 +06:30
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
2020-07-02 16:16:21 +06:30
// Padding(
// padding: const EdgeInsets.only(left: 8.0),
// child: new Text(
// _package.trackingID == null
// ? ''
// : _package.trackingID,
// style: new TextStyle(
// fontSize: 15.0, color: Colors.grey),
// ),
// ),
2020-06-01 11:52:12 +06:30
],
),
),
],
),
),
),
Column(
children: <Widget>[
2020-06-24 16:06:15 +06:30
Padding(
padding: const EdgeInsets.all(3.0),
child: getStatus(_package.status),
),
2020-06-01 11:52:12 +06:30
Padding(
padding: const EdgeInsets.all(0),
2020-06-04 01:36:49 +06:30
child: new Text(
dateFormat.format(_package.arrivedDate),
style: new TextStyle(fontSize: 15.0, color: Colors.grey),
),
2020-06-01 11:52:12 +06:30
),
2020-06-24 16:06:15 +06:30
// Padding(
// padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
// child: Row(
// children: <Widget>[
// new Text(
// _package.weight == null
// ? ''
// : _package.weight.toString() + 'lb - ',
// style:
// new TextStyle(fontSize: 15.0, color: Colors.grey),
// ),
// new Text(
// _package.price == null
// ? ""
// : "\$ " + _package.price.toString(),
// style:
// new TextStyle(fontSize: 15.0, color: Colors.grey),
// ),
// ],
// ),
// ),
2020-06-01 11:52:12 +06:30
],
)
],
),
),
);
}
}