import 'package:fcs/domain/entities/package.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 'receiving_info.dart'; typedef CallbackPackageSelect(Package package); class ReceivingListRow extends StatelessWidget { final Package package; final CallbackPackageSelect? callbackPackageSelect; final double dotSize = 15.0; final DateFormat dateFormat = new DateFormat("dd MMM yyyy"); ReceivingListRow( {Key? key, required this.package, this.callbackPackageSelect}) : super(key: key); @override Widget build(BuildContext context) { return InkWell( onTap: () { if (callbackPackageSelect != null) { callbackPackageSelect!(package); return; } Navigator.push( context, CupertinoPageRoute( builder: (context) => ReceivingInfo(package: package)), ); }, child: Container( padding: EdgeInsets.only(left: 15, right: 15), child: Row( children: [ Expanded( child: new Padding( padding: const EdgeInsets.symmetric(vertical: 13.0), child: new Row( children: [ Icon(MaterialCommunityIcons.inbox_arrow_down, color: primaryColor), new Expanded( child: Padding( padding: const EdgeInsets.only(left: 15), child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ new Text( package.id == null ? '' : package.trackingID!, style: new TextStyle( fontSize: 15.0, color: Colors.black), ), Padding( padding: const EdgeInsets.only(top: 5), child: new Text( package.market == null ? '' : package.market!, style: new TextStyle( fontSize: 15.0, color: Colors.black), ), ), ], ), ), ), ], ), ), ), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ Text(package.status ?? "", style: TextStyle( color: primaryColor, fontSize: 15, fontWeight: FontWeight.bold)), Padding( padding: const EdgeInsets.only(top: 5), child: new Text( package.currentStatusDate != null ? dateFormat.format(package.currentStatusDate!) : '', style: new TextStyle(fontSize: 14.0, color: Colors.grey), ), ), ], ) ], ), ), ); } }