FDialog constructor
FDialog({
- required List<
Widget> actions, - FDialogStyle? style,
- String? semanticsLabel,
- BoxConstraints constraints = const BoxConstraints(minWidth: 280, maxWidth: 560),
- Widget? title,
- Widget? body,
- Axis direction = Axis.vertical,
- 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,
),
};