FDialog.adaptive constructor

FDialog.adaptive({
  1. required List<Widget> actions,
  2. FDialogStyleDelta style = const .context(),
  3. Clip clipBehavior = .none,
  4. Animation<double>? animation,
  5. String? semanticsLabel,
  6. BoxConstraints constraints = const BoxConstraints(minWidth: 280, maxWidth: 560),
  7. bool resizeToAvoidInsets = true,
  8. Widget? image,
  9. Widget? title,
  10. Widget? body,
  11. 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.clipBehavior = .none,
  this.animation,
  this.semanticsLabel,
  this.constraints = const BoxConstraints(minWidth: 280, maxWidth: 560),
  this.resizeToAvoidInsets = true,
  Widget? image,
  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}),
         slideableActions: style.slideableActions.resolve({context.platformVariant, FDialogAxisVariant.vertical}),
         slidePressHapticFeedback: style.slidePressHapticFeedback,
         image: image,
         title: title,
         body: body,
         actions: actions,
       ),
       _ => HorizontalContent(
         style: style.contentStyle.resolve({context.platformVariant}),
         slideableActions: style.slideableActions.resolve({context.platformVariant}),
         slidePressHapticFeedback: style.slidePressHapticFeedback,
         image: image,
         title: title,
         body: body,
         actions: actions.reversed.toList(),
       ),
     });