FDialog constructor

FDialog({
  1. required List<Widget> actions,
  2. FDialogStyle? style,
  3. Duration insetAnimationDuration = _defaultDuration,
  4. Curve insetAnimationCurve = Curves.decelerate,
  5. String? semanticLabel,
  6. Widget? title,
  7. Widget? body,
  8. Axis direction = Axis.vertical,
  9. Key? key,
})

Creates a FDialog with a title, subtitle, and possible actions.

The semanticLabel defaults to title if it is not provided.

The direction determines the layout of the actions. It is recommended to use Axis.vertical on smaller devices, such as mobile phones, and Axis.horizontal on larger devices, such as tablets and desktops.

The Axis.vertical layout with two possibles actions is:

|--------------------|
| [title]            |
|                    |
| [body]             |
|                    |
| [first action]     |
| [second action]    |
|--------------------|

The Axis.horizontal layout with two possibles actions is:

|--------------------------------------------|
| [title]                                    |
|                                            |
| [body]                                     |
|                                            |
|             [first action] [second action] |
|--------------------------------------------|

Implementation

FDialog({
  required List<Widget> actions,
  this.style,
  this.insetAnimationDuration = _defaultDuration,
  this.insetAnimationCurve = Curves.decelerate,
  this.semanticLabel,
  Widget? title,
  Widget? body,
  Axis direction = Axis.vertical,
  super.key,
}) : builder = switch (direction) {
        Axis.horizontal => (context, style) => HorizontalContent(
              style: style.horizontal,
              title: title,
              body: body,
              actions: actions,
            ),
        Axis.vertical => (context, style) => VerticalContent(
              style: style.vertical,
              title: title,
              body: body,
              actions: actions,
            ),
      };