Datatables

This commit is contained in:
Hillel Coren 2020-01-16 19:00:14 +02:00
parent 240b775916
commit ce5a5d1aea
2 changed files with 22 additions and 8 deletions

View File

@ -92,9 +92,10 @@ class EntityDataTableSource extends DataTableSource {
}
class DatatableHeader extends StatelessWidget {
const DatatableHeader({this.entityType});
const DatatableHeader({this.entityType, this.onClearPressed});
final EntityType entityType;
final Function() onClearPressed;
@override
Widget build(BuildContext context) {
@ -113,14 +114,26 @@ class DatatableHeader extends StatelessWidget {
return Row(
children: <Widget>[
if (listUIState.filterEntityId != null)
Text(
message,
style: Theme.of(context)
.textTheme
.subhead
.copyWith(color: Colors.orangeAccent),
if (listUIState.filterEntityId != null) ...[
FlatButton(
child: Text(
message,
style: Theme.of(context)
.textTheme
.subhead
.copyWith(color: Colors.orangeAccent),
),
onPressed: () => viewEntityById(
context: context,
entityId: listUIState.filterEntityId,
entityType: listUIState.filterEntityType,
),
),
IconButton(
onPressed: onClearPressed,
icon: Icon(Icons.clear),
)
]
],
);
}

View File

@ -194,6 +194,7 @@ class _EntityListState extends State<InvoiceList> {
source: dataTableSource,
header: DatatableHeader(
entityType: EntityType.invoice,
onClearPressed: viewModel.onClearEntityFilterPressed,
)),
));
}