import 'package:fcs/theme/theme.dart'; import 'package:fcs/vo/invoice.dart'; import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; import '../util.dart'; import 'invoice_editor.dart'; class InvoiceListRow extends StatefulWidget { final Invoice invoice; const InvoiceListRow({this.invoice}); @override _InvoiceListRowState createState() => _InvoiceListRowState(); } class _InvoiceListRowState extends State { var dateFormatter = new DateFormat('dd MMM yyyy'); final double dotSize = 15.0; Invoice _invoice = new Invoice(); @override void initState() { super.initState(); if (widget.invoice != null) { _invoice = widget.invoice; } } @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.only(left: 15, right: 15), child: InkWell( onTap: () { Navigator.of(context) .push(BottomUpPageRoute(InvoiceEditor(invoice: _invoice))); }, 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( FontAwesomeIcons.fileInvoice, color: primaryColor, size: 30, ), ), new Expanded( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8.0), child: new Text( _invoice.invoiceNumber == null ? '' : _invoice.invoiceNumber, style: new TextStyle( fontSize: 15.0, color: Colors.black), ), ), Padding( padding: const EdgeInsets.only(left: 10.0, top: 10), child: new Text( dateFormatter.format(_invoice.invoiceDate), style: new TextStyle( fontSize: 15.0, color: Colors.grey), ), ) ], ), ), ], ), ), ), Padding( padding: const EdgeInsets.all(0), child: getStatus(_invoice.status), ), ], ), ), ); } }