show static method
Implementation
static Future<Map<String, dynamic>?> show(BuildContext context, String code) {
final action =
session.profile.actions.firstWhere((element) => element.name == code);
var appState = Provider.of<BizDocAppState>(context, listen: false);
var args = <String, dynamic>{};
return showDialog<Map<String, dynamic>>(
context: context,
builder: (context) {
return AlertDialog(
title: Text(action.title),
content: action.template != null
? appState.resolve(action.template!, context)
: Fields(
fields: action.arguments,
onChanged: (values) => args.addAll(values)),
actions: [
TextButton(
child: Text(AppLocalizations.of(context)!.cancel),
onPressed: () => Navigator.pop(context),
),
TextButton(
child: Text(AppLocalizations.of(context)!.ok),
onPressed: () => Navigator.pop(context, args),
)
],
);
},
);
}