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

101 lines
3.3 KiB
Dart
Raw Normal View History

2020-10-09 19:00:39 +06:30
import 'package:fcs/domain/entities/package.dart';
import 'package:fcs/domain/entities/user.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
2020-10-14 20:56:46 +06:30
import 'package:fcs/pages/invoice/invoice_shipment_list.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/pages/invoice/model/invoice_model.dart';
2020-10-09 19:00:39 +06:30
import 'package:fcs/pages/package_search/package_serach.dart';
2020-10-14 20:56:46 +06:30
import 'package:fcs/pages/shipment/shipment_list.dart';
2020-10-09 19:00:39 +06:30
import 'package:fcs/pages/user_search/user_serach.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart';
2020-10-12 03:34:05 +06:30
import 'package:flutter/cupertino.dart';
2020-06-02 14:56:51 +06:30
import 'package:provider/provider.dart';
import 'package:flutter/material.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) {
2020-10-07 02:33:06 +06:30
var owner = true;
2020-10-09 19:00:39 +06:30
var invoiceModel = Provider.of<InvoiceModel>(context);
2020-07-02 16:16:21 +06:30
2020-06-02 14:56:51 +06:30
return LocalProgress(
inAsyncCall: _isLoading,
child: DefaultTabController(
2020-07-02 16:16:21 +06:30
length: 2,
2020-06-02 14:56:51 +06:30
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
2020-10-12 03:34:05 +06:30
icon: new Icon(CupertinoIcons.back),
2020-06-02 14:56:51 +06:30
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
title: LocalText(context, 'invoices.title',
color: Colors.white, fontSize: 20),
actions: <Widget>[
IconButton(
2020-10-09 19:00:39 +06:30
icon: Icon(Icons.search, color: Colors.white),
onPressed: () {}),
2020-06-02 14:56:51 +06:30
],
),
2020-08-30 21:26:37 +06:30
floatingActionButton: owner
? FloatingActionButton.extended(
onPressed: () {
_newInvoice();
},
icon: Icon(Icons.add),
label:
2020-10-09 19:00:39 +06:30
LocalText(context, 'invoices.add', color: Colors.white),
2020-08-30 21:26:37 +06:30
backgroundColor: primaryColor,
)
: null,
2020-10-09 19:00:39 +06:30
body: 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.invoices.length,
itemBuilder: (BuildContext context, int index) {
return InvoiceListRow(
invoice: invoiceModel.invoices[index]);
}),
),
],
2020-06-02 14:56:51 +06:30
)),
),
);
}
_newInvoice() {
2020-10-14 13:54:42 +06:30
Navigator.of(context)
2020-10-14 20:56:46 +06:30
.push(CupertinoPageRoute(builder: (context) => InvoiceShipmentList()));
2020-06-02 14:56:51 +06:30
}
}