insert invoice pages
This commit is contained in:
158
lib/pages/invoice/invoce_list.dart
Normal file
158
lib/pages/invoice/invoce_list.dart
Normal file
@@ -0,0 +1,158 @@
|
||||
import 'package:fcs/model/invoice_model.dart';
|
||||
import 'package:fcs/model/shipment_model.dart';
|
||||
import 'package:fcs/model_fcs/package_model.dart';
|
||||
import 'package:fcs/pages_fcs/package_list_row.dart';
|
||||
import 'package:fcs/theme/theme.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:fcs/widget/local_text.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:fcs/pages/search_page.dart';
|
||||
import 'package:fcs/vo/buyer.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fcs/widget/progress.dart';
|
||||
|
||||
import '../shipment_editor.dart';
|
||||
import '../shipment_list_row.dart';
|
||||
import 'invoice_editor.dart';
|
||||
import 'invoice_list_row.dart';
|
||||
|
||||
class InvoiceList extends StatefulWidget {
|
||||
@override
|
||||
_InvoiceListState createState() => _InvoiceListState();
|
||||
}
|
||||
|
||||
class _InvoiceListState extends State<InvoiceList> {
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: DefaultTabController(
|
||||
length: 3,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
leading: new IconButton(
|
||||
icon: new Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title: LocalText(context, 'invoices.title',
|
||||
color: Colors.white, fontSize: 20),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.search,
|
||||
color: Colors.white,
|
||||
),
|
||||
iconSize: 30,
|
||||
onPressed: () => showPlacesSearch(context),
|
||||
),
|
||||
],
|
||||
bottom: TabBar(
|
||||
unselectedLabelColor: Colors.grey,
|
||||
tabs: [
|
||||
Tab(text: "Packages"),
|
||||
Tab(text: "Pending"),
|
||||
Tab(text: "Paid"),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
_newInvoice();
|
||||
},
|
||||
icon: Icon(Icons.add),
|
||||
label: Text(AppTranslations.of(context).text("invoices.add")),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: TabBarView(
|
||||
children: [_packages(), _pending(), _paided()],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_newInvoice() {
|
||||
Navigator.of(context).push(BottomUpPageRoute(InvoiceEditor()));
|
||||
}
|
||||
|
||||
Widget _packages() {
|
||||
var packageModel = Provider.of<PackageModel>(context);
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
shrinkWrap: true,
|
||||
itemCount: packageModel.completed.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return PackageListRow(
|
||||
package: packageModel.completed[index],
|
||||
isReadOnly: true,
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pending() {
|
||||
var invoiceModel = Provider.of<InvoiceModel>(context);
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
shrinkWrap: true,
|
||||
itemCount: invoiceModel.pending.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InvoiceListRow(invoice: invoiceModel.pending[index]);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _paided() {
|
||||
var invoiceModel = Provider.of<InvoiceModel>(context);
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new ListView.separated(
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Colors.black,
|
||||
),
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
shrinkWrap: true,
|
||||
itemCount: invoiceModel.paided.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InvoiceListRow(invoice: invoiceModel.paided[index]);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user