Files
fcs/lib/pages/receiving/receiving_list_row.dart

99 lines
3.3 KiB
Dart
Raw Normal View History

2020-10-08 14:40:18 +06:30
import 'package:fcs/domain/entities/package.dart';
2020-10-19 05:13:49 +06:30
import 'package:fcs/helpers/theme.dart';
2020-10-08 14:40:18 +06:30
import 'package:fcs/pages/main/util.dart';
2020-10-14 13:54:42 +06:30
import 'package:flutter/cupertino.dart';
2020-10-08 14:40:18 +06:30
import 'package:flutter/material.dart';
2020-10-19 05:13:49 +06:30
import 'package:flutter_icons/flutter_icons.dart';
2020-10-08 14:40:18 +06:30
import 'package:intl/intl.dart';
2020-10-11 02:17:23 +06:30
import 'receiving_info.dart';
2020-10-08 14:40:18 +06:30
typedef CallbackPackageSelect(Package package);
class ReceivingListRow extends StatelessWidget {
final Package package;
final CallbackPackageSelect callbackPackageSelect;
final double dotSize = 15.0;
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
ReceivingListRow({Key key, this.package, this.callbackPackageSelect})
: super(key: key);
@override
Widget build(BuildContext context) {
2020-10-19 05:13:49 +06:30
return InkWell(
onTap: () {
if (callbackPackageSelect != null) {
callbackPackageSelect(package);
return;
}
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => ReceivingInfo(package: package)),
);
},
child: Container(
padding: EdgeInsets.only(left: 15, right: 15),
2020-10-08 14:40:18 +06:30
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Row(
children: <Widget>[
2020-10-19 05:13:49 +06:30
Padding(
padding: EdgeInsets.all(5.0),
child: Icon(
MaterialCommunityIcons.inbox_arrow_down,
color: primaryColor,
)),
2020-10-08 14:40:18 +06:30
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),
),
),
],
),
),
],
),
),
),
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(3.0),
child: getStatus(package.currentStatus),
),
Padding(
padding: const EdgeInsets.all(0),
child: new Text(
dateFormat.format(package.currentStatusDate),
style: new TextStyle(fontSize: 15.0, color: Colors.grey),
),
),
],
)
],
),
),
);
}
}