Invoices
This commit is contained in:
parent
d56bfa8578
commit
3d85fd8873
|
|
@ -17,17 +17,30 @@ class ActionMenuButton extends StatelessWidget {
|
|||
final BaseEntity entity;
|
||||
final List<ActionMenuChoice> customActions;
|
||||
final Function(BuildContext, EntityAction) onSelected;
|
||||
final bool isLoading;
|
||||
|
||||
ActionMenuButton({
|
||||
@required this.entity,
|
||||
@required this.onSelected,
|
||||
@required this.isLoading,
|
||||
this.customActions,
|
||||
this.entity,
|
||||
this.onSelected,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<PopupMenuEntry<EntityAction>> actions = [];
|
||||
|
||||
if (isLoading) {
|
||||
return IconButton(
|
||||
onPressed: null,
|
||||
icon: SizedBox(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
customActions?.forEach((action) {
|
||||
if (action != null) {
|
||||
actions.add(PopupMenuItem<EntityAction>(
|
||||
|
|
|
|||
|
|
@ -42,11 +42,12 @@ class _ClientViewState extends State<ClientView>
|
|||
Widget build(BuildContext context) {
|
||||
var localization = AppLocalization.of(context);
|
||||
var store = StoreProvider.of<AppState>(context);
|
||||
var client = widget.viewModel.client;
|
||||
var viewModel = widget.viewModel;
|
||||
var client = viewModel.client;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.viewModel.client.displayName ??
|
||||
title: Text(client.displayName ??
|
||||
''), // Text(localizations.clientDetails),
|
||||
bottom: TabBar(
|
||||
controller: _controller,
|
||||
|
|
@ -60,26 +61,27 @@ class _ClientViewState extends State<ClientView>
|
|||
),
|
||||
],
|
||||
),
|
||||
actions: widget.viewModel.client.isNew()
|
||||
actions: client.isNew()
|
||||
? []
|
||||
: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
widget.viewModel.onEditPressed(context);
|
||||
viewModel.onEditPressed(context);
|
||||
},
|
||||
),
|
||||
ActionMenuButton(
|
||||
entity: widget.viewModel.client,
|
||||
onSelected: widget.viewModel.onActionSelected,
|
||||
isLoading: viewModel.isLoading,
|
||||
entity: client,
|
||||
onSelected: viewModel.onActionSelected,
|
||||
)
|
||||
],
|
||||
),
|
||||
body: TabBarView(
|
||||
controller: _controller,
|
||||
children: <Widget>[
|
||||
ClientOverview(client: widget.viewModel.client),
|
||||
ClientViewDetails(client: widget.viewModel.client),
|
||||
ClientOverview(client: client),
|
||||
ClientViewDetails(client: client),
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ class _InvoiceViewState extends State<InvoiceView>
|
|||
label: AppLocalization.of(context).pdf,
|
||||
),
|
||||
],
|
||||
isLoading: viewModel.isLoading,
|
||||
entity: invoice,
|
||||
onSelected: viewModel.onActionSelected,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ class _ProductEditState extends State<ProductEdit> {
|
|||
viewModel.product.isNew()
|
||||
? Container()
|
||||
: ActionMenuButton(
|
||||
isLoading: viewModel.isLoading,
|
||||
entity: viewModel.product,
|
||||
onSelected: viewModel.onActionSelected,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue