import 'package:fcs/pages/invoice/package_info.dart'; import 'package:fcs/pages/util.dart'; import 'package:fcs/pages_fcs/package_editor.dart'; import 'package:fcs/vo/package.dart'; import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; class PackageListRow extends StatefulWidget { final bool isReadOnly; final Package package; const PackageListRow({this.package, this.isReadOnly}); @override _PackageListRowtate createState() => _PackageListRowtate(); } class _PackageListRowtate extends State { final double dotSize = 15.0; Package _package = new Package(); final DateFormat dateFormat = new DateFormat("dd MMM yyyy"); @override void initState() { super.initState(); _package = widget.package; } @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.only(left: 15, right: 15), child: InkWell( onTap: () { if (widget.isReadOnly) { Navigator.push( context, BottomUpPageRoute(PackageInfo(package: _package)), ); } else { Navigator.push( context, BottomUpPageRoute(PackageEditor(package: _package)), ); } }, child: Row( children: [ Expanded( child: new Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: new Row( children: [ new Expanded( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8.0), child: new Text( _package.id == null ? '' : _package.trackingID, style: new TextStyle( fontSize: 15.0, color: Colors.black), ), ), Padding( padding: const EdgeInsets.only(left: 8.0), child: new Text( _package.market == null ? '' : _package.market, style: new TextStyle( fontSize: 15.0, color: Colors.black), ), ), // Padding( // padding: const EdgeInsets.only(left: 8.0), // child: new Text( // _package.trackingID == null // ? '' // : _package.trackingID, // style: new TextStyle( // fontSize: 15.0, color: Colors.grey), // ), // ), ], ), ), ], ), ), ), Column( children: [ Padding( padding: const EdgeInsets.all(3.0), child: getStatus(_package.status), ), Padding( padding: const EdgeInsets.all(0), child: new Text( dateFormat.format(_package.arrivedDate), style: new TextStyle(fontSize: 15.0, color: Colors.grey), ), ), // Padding( // padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5), // child: Row( // children: [ // new Text( // _package.weight == null // ? '' // : _package.weight.toString() + 'lb - ', // style: // new TextStyle(fontSize: 15.0, color: Colors.grey), // ), // new Text( // _package.price == null // ? "" // : "\$ " + _package.price.toString(), // style: // new TextStyle(fontSize: 15.0, color: Colors.grey), // ), // ], // ), // ), ], ) ], ), ), ); } }