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

148 lines
5.0 KiB
Dart
Raw Normal View History

2020-10-26 04:41:24 +06:30
import 'package:fcs/domain/constants.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/domain/entities/invoice.dart';
import 'package:fcs/helpers/theme.dart';
2020-10-14 20:56:46 +06:30
import 'package:fcs/pages/invoice/invoice_info.dart';
2020-06-24 16:06:15 +06:30
import 'package:flutter/cupertino.dart';
2020-06-02 14:56:51 +06:30
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
2020-10-28 05:11:06 +06:30
import 'payment/payment_page.dart';
import '../widgets/pdf_screen.dart';
2020-06-02 14:56:51 +06:30
2020-10-28 05:11:06 +06:30
class InvoiceListRow extends StatelessWidget {
final dateFormatter = new DateFormat('dd MMM yyyy');
2020-06-02 14:56:51 +06:30
final Invoice invoice;
2020-10-28 06:23:04 +06:30
final bool forCustomer;
InvoiceListRow({Key key, this.invoice, this.forCustomer}) : super(key: key);
2020-06-02 14:56:51 +06:30
@override
Widget build(BuildContext context) {
2020-10-28 05:11:06 +06:30
return InkWell(
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => PDFScreen(
title: invoice.invoiceNumber,
url: invoice.invoiceURL,
)));
},
2020-06-29 16:03:41 +06:30
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
2020-10-28 05:11:06 +06:30
child: new Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 5, right: 10),
child: Icon(
FontAwesomeIcons.fileInvoice,
color: primaryColor,
size: 30,
2020-06-02 14:56:51 +06:30
),
2020-10-28 05:11:06 +06:30
),
new Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 0),
2020-06-02 14:56:51 +06:30
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
2020-10-28 05:11:06 +06:30
new Text(
invoice.invoiceNumber ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
new Text(
invoice.status ?? "",
style: new TextStyle(
fontSize: 13.0, color: primaryColor),
2020-06-02 14:56:51 +06:30
),
2020-10-28 05:11:06 +06:30
new Text(
dateFormatter.format(invoice.invoiceDate),
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
2020-06-02 14:56:51 +06:30
)
],
),
),
2020-10-28 05:11:06 +06:30
),
],
2020-06-02 14:56:51 +06:30
),
),
2020-06-29 16:03:41 +06:30
),
2020-10-28 05:11:06 +06:30
invoice.status == invoice_issued_status
2020-08-30 21:26:37 +06:30
? Padding(
padding: const EdgeInsets.only(left: 10.0),
child: InkWell(
child: RaisedButton(
child: Row(
children: <Widget>[
Icon(
Icons.payment,
color: primaryColor,
),
Padding(
2020-10-28 05:11:06 +06:30
padding: const EdgeInsets.only(left: 3.0),
child: Text(
"Payment",
style: TextStyle(fontSize: 12, color: Colors.black),
),
2020-08-30 21:26:37 +06:30
)
],
),
onPressed: () {
2020-10-14 13:54:42 +06:30
Navigator.of(context).push(CupertinoPageRoute(
2020-10-28 06:23:04 +06:30
builder: (context) => PaymentPage(
invoice: invoice,
forCustomer: forCustomer,
)));
2020-08-30 21:26:37 +06:30
},
)),
)
: Container(),
2020-06-29 16:03:41 +06:30
Padding(
padding: const EdgeInsets.only(left: 8.0),
2020-10-28 05:11:06 +06:30
child: IconButton(
icon: Icon(
2020-06-29 16:03:41 +06:30
Icons.more_vert,
color: primaryColor,
2020-06-24 16:06:15 +06:30
),
2020-10-28 05:11:06 +06:30
onPressed: () {
2020-06-29 16:03:41 +06:30
var act = actionSheet(context);
showCupertinoModalPopup(
context: context, builder: (BuildContext context) => act);
},
2020-06-24 16:06:15 +06:30
),
2020-06-29 16:03:41 +06:30
),
],
2020-06-02 14:56:51 +06:30
),
);
}
2020-06-24 16:06:15 +06:30
actionSheet(BuildContext context) {
return CupertinoActionSheet(
actions: <Widget>[
CupertinoActionSheetAction(
2020-06-25 09:06:01 +06:30
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
2020-10-14 20:56:46 +06:30
'See detail',
2020-06-25 09:06:01 +06:30
style: TextStyle(fontSize: 16, color: Colors.black),
),
),
],
),
2020-10-26 04:41:24 +06:30
onPressed: () async {
2020-10-14 20:56:46 +06:30
//to go invoice info page
2020-10-26 04:41:24 +06:30
Navigator.pop(context);
2020-10-14 20:56:46 +06:30
Navigator.of(context).push(CupertinoPageRoute(
2020-10-28 05:11:06 +06:30
builder: (context) => InvoiceInfo(invoice: invoice)));
2020-06-24 16:06:15 +06:30
},
)
],
);
}
2020-06-02 14:56:51 +06:30
}