Modal<T extends InputBase>.ok constructor
Modal<T extends InputBase>.ok (})
Creates a simple modal with "OK" (enter key) and optionally "Cancel" (esc key) actions. The modal panel will be rendered in the center of the Terminal that is used to render the modal's Layer.
Implementation
factory Modal.ok(String panelText,
{bool showCancel = false,
PanelBorder borderType = PanelBorder.single,
int? padding,
Color? panelTextColor,
Color? actionTextColor,
Color? backgroundColor,
Color? borderColor,
Object? okResult,
Object? cancelResult}) {
var actionText = showCancel ? _okCancelText : _okText;
var modal = Modal<T>.builder(panelText, actionText,
borderType: borderType,
padding: padding ?? 1,
panelTextColor: panelTextColor,
actionTextColor: actionTextColor,
backgroundColor: backgroundColor,
borderColor: borderColor);
modal.onOk = () {
modal.ui.pop(okResult);
};
if (showCancel) {
modal.onCancel = () {
modal.ui.pop(cancelResult);
};
}
return modal;
}