FDialog constructor
FDialog({})
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 actions should always be ordered with the primary action first. In vertical layouts, the primary action is
on top. In horizontal layouts, the primary action is at the end (i.e. the list is reversed).
The Axis.vertical layout with two actions is:
|--------------------|
| [title] |
| |
| [body] |
| |
| [primary action] |
| [secondary action] |
|--------------------|
The Axis.horizontal layout with two actions (in LTR locale) is:
|----------------------------------------------|
| [title] |
| |
| [body] |
| |
| [secondary action] [primary action] |
|----------------------------------------------|
Implementation
FDialog({
required List<Widget> actions,
this.style = const .context(),
this.animation,
this.semanticsLabel,
this.constraints = const BoxConstraints(minWidth: 280, maxWidth: 560),
Widget? title,
Widget? body,
Axis direction = .vertical,
super.key,
}) : builder = switch (direction) {
.horizontal => (context, style) => HorizontalContent(
style: style.contentStyle.resolve({context.platformVariant}),
title: title,
body: body,
actions: actions.reversed.toList(),
),
.vertical => (context, style) => VerticalContent(
style: style.contentStyle.resolve({context.platformVariant, FDialogAxisVariant.vertical}),
title: title,
body: body,
actions: actions,
),
};