import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/helpers/theme.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'; import '../main/util.dart'; import 'invoice_customer_list.dart'; typedef OnSelect(FcsShipment fcsShipment); class InvoiceShipmentListRow extends StatefulWidget { final OnSelect? onSelect; final FcsShipment? fcsShipment; const InvoiceShipmentListRow({this.fcsShipment, this.onSelect}); @override _InvoiceShipmentListRowState createState() => _InvoiceShipmentListRowState(); } class _InvoiceShipmentListRowState extends State { final double dotSize = 15.0; final dateFormatter = new DateFormat('dd MMM yyyy'); FcsShipment _fcsShipment = new FcsShipment(); @override void initState() { super.initState(); if (widget.fcsShipment != null) { _fcsShipment = widget.fcsShipment!; } } @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.only(left: 15, right: 15), child: InkWell( onTap: () { if (widget.onSelect != null) widget.onSelect!(widget.fcsShipment!); }, child: Row( children: [ Expanded( child: new Padding( padding: const EdgeInsets.symmetric(vertical: 10.0), child: new Row( children: [ Container( padding: EdgeInsets.only(left: 5, right: 10), child: Icon( Ionicons.ios_airplane, color: primaryColor, size: 30, ), ), new Expanded( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8.0), child: new Text( _fcsShipment.shipmentNumber == null ? '' : _fcsShipment.shipmentNumber!, style: new TextStyle( fontSize: 15.0, color: Colors.black), ), ), Padding( padding: const EdgeInsets.only(left: 10.0, top: 10), child: new Text( dateFormatter.format(_fcsShipment.cutoffDate!), style: new TextStyle( fontSize: 15.0, color: Colors.grey), ), ) ], ), ), ], ), ), ), Padding( padding: const EdgeInsets.all(0), child: getStatus(_fcsShipment.status??"") ), ], ), ), ); } }