This commit is contained in:
PhyoThandar
2020-10-16 13:46:02 +06:30
parent ff12b2c24b
commit 0e9e3da0c4
7 changed files with 154 additions and 21 deletions

View File

@@ -20,16 +20,29 @@ import 'invoice_editor.dart';
import 'invoice_list_row.dart';
class InvoiceList extends StatefulWidget {
final bool onlyFcs;
const InvoiceList({Key key, this.onlyFcs}) : super(key: key);
@override
_InvoiceListState createState() => _InvoiceListState();
}
class _InvoiceListState extends State<InvoiceList> {
bool _isLoading = false;
bool _showPaid = false;
var _controller = ScrollController();
@override
void initState() {
super.initState();
// Provider.of<InvoiceModel>(context, listen: false).initPaidInvoice(true);
// _controller.addListener(() {
// if (_showPaid &&
// _controller.position.pixels == _controller.position.maxScrollExtent) {
// Provider.of<InvoiceModel>(context, listen: false)
// .loadMorePaidInvoices();
// }
// });
}
@override
@@ -41,6 +54,9 @@ class _InvoiceListState extends State<InvoiceList> {
Widget build(BuildContext context) {
var owner = true;
var invoiceModel = Provider.of<InvoiceModel>(context);
bool onlyFcs = widget.onlyFcs;
var invoices =
_showPaid ? invoiceModel.paidInvoices : invoiceModel.invoices;
final popupMenu = LocalPopupMenuButton(
popmenus: [
@@ -49,7 +65,7 @@ class _InvoiceListState extends State<InvoiceList> {
LocalPopupMenu(id: 2, textKey: "invoice.popupmenu.paid")
],
popupMenuCallback: (p) => this.setState(() {
// _showDelivered = p.id == 2;
_showPaid = p.id == 2;
}),
);
@@ -95,10 +111,9 @@ class _InvoiceListState extends State<InvoiceList> {
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: invoiceModel.invoices.length,
itemCount: invoices.length,
itemBuilder: (BuildContext context, int index) {
return InvoiceListRow(
invoice: invoiceModel.invoices[index]);
return InvoiceListRow(invoice: invoices[index]);
}),
),
],