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