Files
fcs/lib/pages/invoice/invoice_shipment_list_row.dart

95 lines
3.1 KiB
Dart
Raw Permalink Normal View History

2020-10-16 21:38:39 +06:30
import 'package:fcs/domain/entities/fcs_shipment.dart';
2020-10-14 20:56:46 +06:30
import 'package:fcs/helpers/theme.dart';
import 'package:flutter/material.dart';
2021-09-10 12:00:08 +06:30
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
2020-10-16 21:38:39 +06:30
import 'package:intl/intl.dart';
2020-10-14 20:56:46 +06:30
import '../main/util.dart';
2020-10-26 04:41:24 +06:30
typedef OnSelect(FcsShipment fcsShipment);
2020-10-14 20:56:46 +06:30
class InvoiceShipmentListRow extends StatefulWidget {
2021-09-10 12:00:08 +06:30
final OnSelect? onSelect;
final FcsShipment? fcsShipment;
2020-10-26 04:41:24 +06:30
const InvoiceShipmentListRow({this.fcsShipment, this.onSelect});
2020-10-14 20:56:46 +06:30
@override
_InvoiceShipmentListRowState createState() => _InvoiceShipmentListRowState();
}
class _InvoiceShipmentListRowState extends State<InvoiceShipmentListRow> {
final double dotSize = 15.0;
2020-10-16 21:38:39 +06:30
final dateFormatter = new DateFormat('dd MMM yyyy');
FcsShipment _fcsShipment = new FcsShipment();
2020-10-14 20:56:46 +06:30
@override
void initState() {
super.initState();
2020-10-16 21:38:39 +06:30
if (widget.fcsShipment != null) {
2021-09-10 12:00:08 +06:30
_fcsShipment = widget.fcsShipment!;
2020-10-14 20:56:46 +06:30
}
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: InkWell(
onTap: () {
2021-09-10 12:00:08 +06:30
if (widget.onSelect != null) widget.onSelect!(widget.fcsShipment!);
2020-10-14 20:56:46 +06:30
},
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
2020-10-16 21:38:39 +06:30
padding: const EdgeInsets.symmetric(vertical: 10.0),
2020-10-14 20:56:46 +06:30
child: new Row(
children: <Widget>[
2020-10-16 21:38:39 +06:30
Container(
padding: EdgeInsets.only(left: 5, right: 10),
child: Icon(
Ionicons.ios_airplane,
color: primaryColor,
size: 30,
),
),
2020-10-14 20:56:46 +06:30
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
2020-10-16 21:38:39 +06:30
_fcsShipment.shipmentNumber == null
? ''
2021-09-10 15:22:11 +06:30
: _fcsShipment.shipmentNumber!,
2020-10-14 20:56:46 +06:30
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
2021-09-10 15:22:11 +06:30
dateFormatter.format(_fcsShipment.cutoffDate!),
2020-10-14 20:56:46 +06:30
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
)
],
),
),
],
),
),
),
2020-10-16 21:38:39 +06:30
Padding(
padding: const EdgeInsets.all(0),
2021-09-10 16:48:21 +06:30
child: getStatus(_fcsShipment.status??"")
2020-10-16 21:38:39 +06:30
),
2020-10-14 20:56:46 +06:30
],
),
),
);
}
}