2025-03-12 17:49:27 +06:30
|
|
|
import 'package:fcs/domain/entities/package.dart';
|
|
|
|
|
import 'package:fcs/helpers/theme.dart';
|
2025-03-25 17:38:51 +06:30
|
|
|
import 'package:fcs/pages/carton/model/package_selection_model.dart';
|
2025-03-12 17:49:27 +06:30
|
|
|
import 'package:fcs/pages/package/package_info.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
2025-03-25 17:38:51 +06:30
|
|
|
import 'package:provider/provider.dart';
|
2025-03-12 17:49:27 +06:30
|
|
|
|
2025-03-25 17:38:51 +06:30
|
|
|
import '../../pagination/paginator_listview.dart';
|
2025-03-12 17:49:27 +06:30
|
|
|
import '../widgets/local_text.dart';
|
|
|
|
|
|
2025-03-25 17:38:51 +06:30
|
|
|
class PackageDetailList extends StatefulWidget {
|
2025-03-12 17:49:27 +06:30
|
|
|
final String cartonNumber;
|
2025-03-25 17:38:51 +06:30
|
|
|
final int packageCount;
|
|
|
|
|
final String senderID;
|
|
|
|
|
final String consingeeID;
|
|
|
|
|
final String fcsShipmentID;
|
|
|
|
|
const PackageDetailList(
|
|
|
|
|
{super.key,
|
|
|
|
|
required this.cartonNumber,
|
|
|
|
|
required this.packageCount,
|
|
|
|
|
required this.senderID,
|
|
|
|
|
required this.consingeeID,
|
|
|
|
|
required this.fcsShipmentID});
|
2025-03-12 17:49:27 +06:30
|
|
|
|
2025-03-25 17:38:51 +06:30
|
|
|
@override
|
|
|
|
|
State<PackageDetailList> createState() => _PackageDetailListState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _PackageDetailListState extends State<PackageDetailList> {
|
2025-03-12 17:49:27 +06:30
|
|
|
final NumberFormat numberFormatter = NumberFormat("#,###");
|
|
|
|
|
|
2025-03-25 17:38:51 +06:30
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
_init();
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_init() {
|
|
|
|
|
context.read<PackageSelectionModel>().loadPackages(
|
|
|
|
|
senderId: widget.senderID,
|
|
|
|
|
consigneeId: widget.consingeeID,
|
|
|
|
|
shipmentId: widget.fcsShipmentID);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 17:49:27 +06:30
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2025-03-25 17:38:51 +06:30
|
|
|
var packageModel = context.watch<PackageSelectionModel>();
|
2025-03-12 17:49:27 +06:30
|
|
|
return Scaffold(
|
|
|
|
|
appBar: LocalAppBar(
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
arrowColor: primaryColor,
|
|
|
|
|
labelColor: primaryColor,
|
|
|
|
|
titleWidget: Column(
|
|
|
|
|
children: [
|
|
|
|
|
LocalText(
|
|
|
|
|
context,
|
|
|
|
|
"box.package.count",
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
color: primaryColor,
|
2025-03-25 17:38:51 +06:30
|
|
|
translationVariables: [
|
|
|
|
|
numberFormatter.format(widget.packageCount)
|
|
|
|
|
],
|
2025-03-12 17:49:27 +06:30
|
|
|
),
|
2025-03-25 17:38:51 +06:30
|
|
|
Text(widget.cartonNumber,
|
2025-03-12 17:49:27 +06:30
|
|
|
style: TextStyle(fontSize: 15, color: Colors.black))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
2025-03-25 17:38:51 +06:30
|
|
|
body: PaginatorListView<Package>(
|
|
|
|
|
paginatorListener: packageModel.getPackages!,
|
|
|
|
|
rowBuilder: (p) {
|
|
|
|
|
Package package = p;
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
CupertinoPageRoute(
|
|
|
|
|
builder: (context) => PackageInfo(package: package)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 15, right: 15),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Icon(Octicons.package, color: primaryColor),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 15),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
package.id == null
|
2025-03-12 17:49:27 +06:30
|
|
|
? ''
|
2025-03-25 17:38:51 +06:30
|
|
|
: package.trackingID!,
|
2025-03-12 17:49:27 +06:30
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
2025-03-25 17:38:51 +06:30
|
|
|
color: Colors.black),
|
2025-03-12 17:49:27 +06:30
|
|
|
),
|
2025-03-25 17:38:51 +06:30
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(top: 5),
|
|
|
|
|
child: Text(
|
|
|
|
|
package.market == null
|
|
|
|
|
? ''
|
|
|
|
|
: package.market!,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2025-03-12 17:49:27 +06:30
|
|
|
),
|
|
|
|
|
),
|
2025-03-25 17:38:51 +06:30
|
|
|
],
|
|
|
|
|
),
|
2025-03-12 17:49:27 +06:30
|
|
|
),
|
|
|
|
|
),
|
2025-03-25 17:38:51 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2025-03-12 17:49:27 +06:30
|
|
|
),
|
2025-03-25 17:38:51 +06:30
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
color: primaryColor));
|
2025-03-12 17:49:27 +06:30
|
|
|
}
|
|
|
|
|
}
|