Web
This commit is contained in:
parent
0513072753
commit
b206abf7b3
|
|
@ -75,6 +75,7 @@
|
||||||
#.android/
|
#.android/
|
||||||
#.ios/
|
#.ios/
|
||||||
|
|
||||||
|
.flutter-plugins-dependencies
|
||||||
.env.dart
|
.env.dart
|
||||||
key.properties
|
key.properties
|
||||||
google-services.json
|
google-services.json
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/product/product_actions.dart';
|
import 'package:invoiceninja_flutter/redux/product/product_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/help_text.dart';
|
import 'package:invoiceninja_flutter/ui/app/help_text.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
||||||
|
|
@ -15,6 +16,7 @@ import 'package:invoiceninja_flutter/ui/product/product_list_item.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/product/product_list_vm.dart';
|
import 'package:invoiceninja_flutter/ui/product/product_list_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
|
import 'package:local_auth/error_codes.dart';
|
||||||
|
|
||||||
class ProductList extends StatefulWidget {
|
class ProductList extends StatefulWidget {
|
||||||
const ProductList({
|
const ProductList({
|
||||||
|
|
@ -104,11 +106,10 @@ class _ProductListState extends State<ProductList> {
|
||||||
} else {
|
} else {
|
||||||
final sortFn = (String field) => store.dispatch(SortProducts(field));
|
final sortFn = (String field) => store.dispatch(SortProducts(field));
|
||||||
|
|
||||||
return Padding(
|
return SingleChildScrollView(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
child: Padding(
|
||||||
child: Scrollbar(
|
padding: const EdgeInsets.all(12),
|
||||||
child: ListView(scrollDirection: Axis.vertical, children: [
|
child: PaginatedDataTable(
|
||||||
PaginatedDataTable(
|
|
||||||
columns: [
|
columns: [
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(localization.name),
|
label: Text(localization.name),
|
||||||
|
|
@ -129,12 +130,12 @@ class _ProductListState extends State<ProductList> {
|
||||||
numeric: true,
|
numeric: true,
|
||||||
onSort: (int columnIndex, bool ascending) =>
|
onSort: (int columnIndex, bool ascending) =>
|
||||||
sortFn(ProductFields.quantity)),
|
sortFn(ProductFields.quantity)),
|
||||||
|
DataColumn(label: SizedBox()),
|
||||||
],
|
],
|
||||||
source: dataTableSource,
|
source: dataTableSource,
|
||||||
header: Container(),
|
header: SizedBox(),
|
||||||
)
|
),
|
||||||
])),
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -157,6 +158,7 @@ class _ProductListState extends State<ProductList> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
dataTableSource = ProductDataTableSource(
|
dataTableSource = ProductDataTableSource(
|
||||||
|
context: context,
|
||||||
productList: widget.viewModel.productList,
|
productList: widget.viewModel.productList,
|
||||||
productMap: widget.viewModel.productMap,
|
productMap: widget.viewModel.productMap,
|
||||||
onTap: (ProductEntity product) =>
|
onTap: (ProductEntity product) =>
|
||||||
|
|
@ -178,6 +180,14 @@ class _ProductListState extends State<ProductList> {
|
||||||
DataCell(Text(product.price.toString()), onTap: onTap),
|
DataCell(Text(product.price.toString()), onTap: onTap),
|
||||||
DataCell(Text(product.cost.toString()), onTap: onTap),
|
DataCell(Text(product.cost.toString()), onTap: onTap),
|
||||||
DataCell(Text(product.quantity.toString()), onTap: onTap),
|
DataCell(Text(product.quantity.toString()), onTap: onTap),
|
||||||
|
DataCell(FlatButton(
|
||||||
|
child: Text(
|
||||||
|
AppLocalization.of(context).edit,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
editEntity(context: context, entity: product);
|
||||||
|
},
|
||||||
|
)),
|
||||||
]);
|
]);
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
@ -187,18 +197,39 @@ class _ProductListState extends State<ProductList> {
|
||||||
|
|
||||||
class ProductDataTableSource extends DataTableSource {
|
class ProductDataTableSource extends DataTableSource {
|
||||||
ProductDataTableSource(
|
ProductDataTableSource(
|
||||||
{@required this.productList,
|
{@required this.context,
|
||||||
|
@required this.productList,
|
||||||
@required this.productMap,
|
@required this.productMap,
|
||||||
@required this.onTap});
|
@required this.onTap});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DataRow getRow(int index) {
|
DataRow getRow(int index) {
|
||||||
|
final state = StoreProvider.of<AppState>(context).state;
|
||||||
final product = productMap[productList[index]];
|
final product = productMap[productList[index]];
|
||||||
return DataRow(cells: [
|
return DataRow(cells: [
|
||||||
DataCell(Text(product.productKey), onTap: () => onTap(product)),
|
DataCell(Text(product.productKey), onTap: () => onTap(product)),
|
||||||
DataCell(Text(product.price.toString()), onTap: () => onTap(product)),
|
DataCell(Text(product.price.toString()), onTap: () => onTap(product)),
|
||||||
DataCell(Text(product.cost.toString()), onTap: () => onTap(product)),
|
DataCell(Text(product.cost.toString()), onTap: () => onTap(product)),
|
||||||
DataCell(Text(product.quantity.toString()), onTap: () => onTap(product)),
|
DataCell(Text(product.quantity.toString()), onTap: () => onTap(product)),
|
||||||
|
DataCell(Row(
|
||||||
|
children: <Widget>[
|
||||||
|
FlatButton(
|
||||||
|
child: Text(
|
||||||
|
AppLocalization.of(context).edit,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
editEntity(context: context, entity: product);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ActionMenuButton(
|
||||||
|
entityActions: product.getActions(userCompany: state.userCompany),
|
||||||
|
isSaving: false,
|
||||||
|
entity: product,
|
||||||
|
onSelected: (context, action) =>
|
||||||
|
handleProductAction(context, [product], action),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,6 +242,7 @@ class ProductDataTableSource extends DataTableSource {
|
||||||
@override
|
@override
|
||||||
int get rowCount => productList.length;
|
int get rowCount => productList.length;
|
||||||
|
|
||||||
|
BuildContext context;
|
||||||
List<String> productList;
|
List<String> productList;
|
||||||
BuiltMap<String, ProductEntity> productMap;
|
BuiltMap<String, ProductEntity> productMap;
|
||||||
final Function(ProductEntity product) onTap;
|
final Function(ProductEntity product) onTap;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue