showColumn<T> method

Future<T?> showColumn<T>({
  1. required UpdableBuilder onContent,
  2. UpdableBuilder? onTitle,
  3. UpdableBuilder? onActions,
  4. bool onOK(
    1. UpdatableContext
    )?,
  5. String? title,
  6. bool ok = false,
  7. bool cancel = false,
  8. bool isContentScrollable = false,
  9. EdgeInsets padding = const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
  10. List<Widget>? aboveWidgets,
  11. List<Widget>? belowWidgets,
})

Implementation

Future<T?> showColumn<T>({
  required UpdableBuilder onContent,
  UpdableBuilder? onTitle,
  UpdableBuilder? onActions,
  bool Function(UpdatableContext)? onOK,
  String? title,
  bool ok = false,
  bool cancel = false,
  bool isContentScrollable = false,
  EdgeInsets padding = const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
  List<Widget>? aboveWidgets,
  List<Widget>? belowWidgets,
}) {
  return showBuilder((uc) {
    uc.onValidate = () {
      return onOK?.call(uc) ?? true;
    };
    Widget c = onContent(uc).padded(padding).constrainedBox(minWidth: CONTENT_MIN_WIDTH, minHeight: CONTENT_MIN_HEIGHT);
    return ColumnMinStretch([
      if (onTitle != null) onTitle(uc),
      if (onTitle == null && title != null) titlePanel(uc, title: title.text()),
      ...?aboveWidgets,
      if (isContentScrollable) c.flexible() else c,
      ...?belowWidgets,
      if (onActions != null) onActions(uc),
      if (onActions == null && (ok || cancel)) actionPanel(uc, [if (cancel) cancelAction("取消"), if (ok) okAction(uc, "确定")]),
    ]).constrainedBox(minHeight: 80);
  });
}