Modal<T extends InputBase>.yesNo constructor

Modal<T extends InputBase>.yesNo(
  1. String panelText, {
  2. PanelBorder borderType = PanelBorder.single,
  3. int? padding,
  4. Color? panelTextColor,
  5. Color? actionTextColor,
  6. Color? backgroundColor,
  7. Color? borderColor,
  8. Object? yesResult,
  9. Object? noResult,
})

Creates a simple modal with "Yes" (y key) and "No" (n 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.yesNo(String panelText,
    {PanelBorder borderType = PanelBorder.single,
    int? padding,
    Color? panelTextColor,
    Color? actionTextColor,
    Color? backgroundColor,
    Color? borderColor,
    Object? yesResult,
    Object? noResult}) {
  var modal = Modal<T>.builder(panelText, _yesNoText,
      borderType: borderType,
      padding: padding ?? 1,
      panelTextColor: panelTextColor,
      actionTextColor: actionTextColor,
      backgroundColor: backgroundColor,
      borderColor: borderColor);

  modal.onYes = () {
    modal.ui.pop(yesResult);
  };

  modal.onNo = () {
    modal.ui.pop(noResult);
  };

  return modal;
}