Files
fcs/lib/pages/package/package_list_row.dart

104 lines
3.6 KiB
Dart
Raw Normal View History

2020-10-07 02:33:06 +06:30
import 'package:fcs/domain/entities/package.dart';
2020-10-18 02:38:46 +06:30
import 'package:fcs/helpers/theme.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/pages/main/util.dart';
2020-10-18 02:38:46 +06:30
import 'package:fcs/pages/package/package_info.dart';
2020-10-14 13:54:42 +06:30
import 'package:flutter/cupertino.dart';
2020-09-15 07:13:41 +06:30
import 'package:flutter/material.dart';
2020-10-18 02:38:46 +06:30
import 'package:flutter_icons/flutter_icons.dart';
2020-09-15 07:13:41 +06:30
import 'package:intl/intl.dart';
2020-09-18 21:33:41 +06:30
typedef CallbackPackageSelect(Package package);
2020-09-15 07:13:41 +06:30
2020-09-18 21:33:41 +06:30
class PackageListRow extends StatelessWidget {
2020-10-22 04:14:53 +06:30
final bool isCustomer;
2020-09-18 21:33:41 +06:30
final Package package;
final CallbackPackageSelect callbackPackageSelect;
2020-09-15 07:13:41 +06:30
final double dotSize = 15.0;
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
2020-10-22 04:14:53 +06:30
PackageListRow(
{Key key, this.package, this.callbackPackageSelect, this.isCustomer})
2020-09-18 21:33:41 +06:30
: super(key: key);
2020-09-15 07:13:41 +06:30
@override
Widget build(BuildContext context) {
2020-10-18 02:38:46 +06:30
return InkWell(
2021-01-10 15:56:27 +06:30
onTap: () {
2020-10-18 02:38:46 +06:30
if (callbackPackageSelect != null) {
callbackPackageSelect(package);
return;
}
Navigator.push(
context,
CupertinoPageRoute(
2020-10-22 04:14:53 +06:30
builder: (context) => PackageInfo(
package: package,
isCustomer: isCustomer,
)),
2020-10-18 02:38:46 +06:30
);
},
child: Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: Column(
children: [
Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Row(
children: <Widget>[
Icon(Octicons.package, color: primaryColor),
SizedBox(width: 8),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
package.id == null ? '' : package.trackingID,
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,
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
],
2020-09-15 07:13:41 +06:30
),
2020-10-18 02:38:46 +06:30
),
],
2020-09-15 07:13:41 +06:30
),
),
),
2020-10-18 02:38:46 +06:30
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(3.0),
2020-10-20 08:02:29 +06:30
child: getStatus(package.status),
2020-10-18 02:38:46 +06:30
),
Padding(
padding: const EdgeInsets.all(0),
child: new Text(
dateFormat.format(package.currentStatusDate),
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
),
],
)
2020-09-15 07:13:41 +06:30
],
2020-10-18 02:38:46 +06:30
),
2020-09-15 07:13:41 +06:30
],
),
),
);
}
}