2020-12-03 08:26:58 +06:30
|
|
|
import 'package:fcs/domain/entities/package.dart';
|
|
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:fcs/pages/main/util.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
2021-09-10 16:48:21 +06:30
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
2020-12-03 08:26:58 +06:30
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
import 'processing_info.dart';
|
|
|
|
|
|
|
|
|
|
typedef CallbackPackageSelect(Package package);
|
|
|
|
|
|
|
|
|
|
class ProcessingListRow extends StatelessWidget {
|
2021-09-10 16:48:21 +06:30
|
|
|
final Package? package;
|
|
|
|
|
final CallbackPackageSelect? callbackPackageSelect;
|
2020-12-03 08:26:58 +06:30
|
|
|
final double dotSize = 15.0;
|
|
|
|
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
|
|
|
|
|
2021-09-10 16:48:21 +06:30
|
|
|
ProcessingListRow({Key? key, this.package, this.callbackPackageSelect})
|
2020-12-03 08:26:58 +06:30
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (callbackPackageSelect != null) {
|
2021-09-10 16:48:21 +06:30
|
|
|
callbackPackageSelect!(package!);
|
2020-12-03 08:26:58 +06:30
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
CupertinoPageRoute(
|
|
|
|
|
builder: (context) => ProcessingInfo(package: package)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 15, right: 15),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: new Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
|
|
|
|
child: new Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 5, right: 10),
|
|
|
|
|
child: Icon(
|
2021-09-10 16:48:21 +06:30
|
|
|
FontAwesomeIcons.dropbox,
|
2020-12-03 08:26:58 +06:30
|
|
|
color: primaryColor,
|
|
|
|
|
size: 30,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
new Expanded(
|
|
|
|
|
child: new Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: new Text(
|
2021-09-10 16:48:21 +06:30
|
|
|
package!.id == null ? '' : package!.trackingID!,
|
2020-12-03 08:26:58 +06:30
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.black),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0),
|
|
|
|
|
child: new Text(
|
2021-09-10 16:48:21 +06:30
|
|
|
package!.market == null ? '' : package!.market!,
|
2020-12-03 08:26:58 +06:30
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.black),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(3.0),
|
2021-09-10 16:48:21 +06:30
|
|
|
child: getStatus(package!.status ?? ""),
|
2020-12-03 08:26:58 +06:30
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(0),
|
|
|
|
|
child: new Text(
|
2021-09-10 16:48:21 +06:30
|
|
|
package!.currentStatusDate != null
|
|
|
|
|
? dateFormat.format(package!.currentStatusDate!)
|
|
|
|
|
: '',
|
2020-12-03 08:26:58 +06:30
|
|
|
style: new TextStyle(fontSize: 15.0, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|