FDialog.adaptive constructor

FDialog.adaptive({
  1. required List<Widget> actions,
  2. FDialogStyleDelta style = const .context(),
  3. Animation<double>? animation,
  4. String? semanticsLabel,
  5. BoxConstraints constraints = const BoxConstraints(minWidth: 280, maxWidth: 560),
  6. Widget? title,
  7. Widget? body,
  8. Key? key,
})

Creates an adaptive FDialog that lays out the actions vertically on FBreakpoints.sm devices and horizontally on larger devices.

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).

Implementation

FDialog.adaptive({
  required List<Widget> actions,
  this.style = const .context(),
  this.animation,
  this.semanticsLabel,
  this.constraints = const BoxConstraints(minWidth: 280, maxWidth: 560),
  Widget? title,
  Widget? body,
  super.key,
}) : builder = ((context, style) => switch (MediaQuery.sizeOf(context).width) {
       final width when width < context.theme.breakpoints.sm => VerticalContent(
         style: style.contentStyle.resolve({context.platformVariant, FDialogAxisVariant.vertical}),
         title: title,
         body: body,
         actions: actions,
       ),
       _ => HorizontalContent(
         style: style.contentStyle.resolve({context.platformVariant}),
         title: title,
         body: body,
         actions: actions.reversed.toList(),
       ),
     });