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-14 13:54:42 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-10-08 14:40:18 +06:30
|
|
|
import 'package:flutter/material.dart';
|
2021-09-10 12:00:08 +06:30
|
|
|
import 'package:flutter_vector_icons/flutter_vector_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';
|
|
|
|
|
|
2025-03-12 17:49:27 +06:30
|
|
|
typedef CallbackPackageSelect = Function(Package package);
|
2020-10-08 14:40:18 +06:30
|
|
|
|
|
|
|
|
class ReceivingListRow extends StatelessWidget {
|
2024-02-28 17:47:47 +06:30
|
|
|
final Package package;
|
2021-09-10 12:00:08 +06:30
|
|
|
final CallbackPackageSelect? callbackPackageSelect;
|
2020-10-08 14:40:18 +06:30
|
|
|
final double dotSize = 15.0;
|
2025-03-12 17:49:27 +06:30
|
|
|
final DateFormat dateFormat = DateFormat("dd MMM yyyy");
|
2020-10-08 14:40:18 +06:30
|
|
|
|
2024-02-28 17:47:47 +06:30
|
|
|
ReceivingListRow(
|
2025-03-12 17:49:27 +06:30
|
|
|
{super.key, required this.package, this.callbackPackageSelect});
|
2020-10-08 14:40:18 +06:30
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-10-19 05:13:49 +06:30
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (callbackPackageSelect != null) {
|
2024-02-28 17:47:47 +06:30
|
|
|
callbackPackageSelect!(package);
|
2020-10-19 05:13:49 +06:30
|
|
|
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(
|
2025-03-12 17:49:27 +06:30
|
|
|
child: Padding(
|
2024-02-28 17:47:47 +06:30
|
|
|
padding: const EdgeInsets.symmetric(vertical: 13.0),
|
2025-03-12 17:49:27 +06:30
|
|
|
child: Row(
|
2020-10-08 14:40:18 +06:30
|
|
|
children: <Widget>[
|
2024-02-28 17:47:47 +06:30
|
|
|
Icon(MaterialCommunityIcons.inbox_arrow_down,
|
|
|
|
|
color: primaryColor),
|
2025-03-12 17:49:27 +06:30
|
|
|
Expanded(
|
2024-02-28 17:47:47 +06:30
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 15),
|
2025-03-12 17:49:27 +06:30
|
|
|
child: Column(
|
2024-02-28 17:47:47 +06:30
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
2025-03-12 17:49:27 +06:30
|
|
|
Text(
|
2024-02-28 17:47:47 +06:30
|
|
|
package.id == null ? '' : package.trackingID!,
|
2025-03-12 17:49:27 +06:30
|
|
|
style: TextStyle(
|
2020-10-08 14:40:18 +06:30
|
|
|
fontSize: 15.0, color: Colors.black),
|
|
|
|
|
),
|
2024-02-28 17:47:47 +06:30
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 5),
|
2025-03-12 17:49:27 +06:30
|
|
|
child: Text(
|
2024-02-28 17:47:47 +06:30
|
|
|
package.market == null ? '' : package.market!,
|
2025-03-12 17:49:27 +06:30
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.grey),
|
2024-02-28 17:47:47 +06:30
|
|
|
),
|
2020-10-08 14:40:18 +06:30
|
|
|
),
|
2024-02-28 17:47:47 +06:30
|
|
|
],
|
|
|
|
|
),
|
2020-10-08 14:40:18 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
2024-02-28 17:47:47 +06:30
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
2020-10-08 14:40:18 +06:30
|
|
|
children: <Widget>[
|
2024-02-28 17:47:47 +06:30
|
|
|
Text(package.status ?? "",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
fontWeight: FontWeight.bold)),
|
2020-10-08 14:40:18 +06:30
|
|
|
Padding(
|
2024-02-28 17:47:47 +06:30
|
|
|
padding: const EdgeInsets.only(top: 5),
|
2025-03-12 17:49:27 +06:30
|
|
|
child: Text(
|
2024-02-28 17:47:47 +06:30
|
|
|
package.currentStatusDate != null
|
|
|
|
|
? dateFormat.format(package.currentStatusDate!)
|
2021-09-10 16:48:21 +06:30
|
|
|
: '',
|
2025-03-12 17:49:27 +06:30
|
|
|
style: TextStyle(fontSize: 14.0, color: Colors.grey),
|
2020-10-08 14:40:18 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|