2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/domain/entities/box.dart';
|
|
|
|
|
import 'package:fcs/pages/main/util.dart';
|
2020-10-14 13:54:42 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-06-26 16:17:40 +06:30
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
2020-10-14 16:53:16 +06:30
|
|
|
import 'box_info.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
|
|
|
|
|
class BoxListRow extends StatefulWidget {
|
2020-06-26 16:17:40 +06:30
|
|
|
final Box box;
|
2020-10-15 17:33:43 +06:30
|
|
|
const BoxListRow({this.box});
|
2020-06-26 16:17:40 +06:30
|
|
|
|
|
|
|
|
@override
|
2020-10-07 02:33:06 +06:30
|
|
|
_BoxListRowState createState() => _BoxListRowState();
|
2020-06-26 16:17:40 +06:30
|
|
|
}
|
|
|
|
|
|
2020-10-07 02:33:06 +06:30
|
|
|
class _BoxListRowState extends State<BoxListRow> {
|
2020-06-26 16:17:40 +06:30
|
|
|
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: () {
|
2020-10-14 16:53:16 +06:30
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
2020-10-14 21:46:35 +06:30
|
|
|
CupertinoPageRoute(builder: (context) => BoxInfo(box: _box)),
|
2020-10-14 16:53:16 +06:30
|
|
|
);
|
2020-06-26 16:17:40 +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(
|
|
|
|
|
_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),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|