FDialog constructor

FDialog({
  1. required List<Widget> actions,
  2. FDialogStyle? style,
  3. String? semanticsLabel,
  4. BoxConstraints constraints = const BoxConstraints(minWidth: 280, maxWidth: 560),
  5. Widget? title,
  6. Widget? body,
  7. Axis direction = Axis.vertical,
  8. Key? key,
})

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

The semanticsLabel 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.semanticsLabel,
  this.constraints = const BoxConstraints(minWidth: 280, maxWidth: 560),
  Widget? title,
  Widget? body,
  Axis direction = Axis.vertical,
  super.key,
}) : builder = switch (direction) {
       Axis.horizontal => (_, style) => HorizontalContent(
         style: style.horizontalStyle,
         title: title,
         body: body,
         actions: actions,
       ),
       Axis.vertical => (_, style) => VerticalContent(
         style: style.verticalStyle,
         title: title,
         body: body,
         actions: actions,
       ),
     };