AlertDialog.adaptive constructor
- Key? key,
- Widget? icon,
- EdgeInsetsGeometry? iconPadding,
- Color? iconColor,
- Widget? title,
- EdgeInsetsGeometry? titlePadding,
- TextStyle? titleTextStyle,
- Widget? content,
- EdgeInsetsGeometry? contentPadding,
- TextStyle? contentTextStyle,
- List<
Widget> ? actions, - EdgeInsetsGeometry? actionsPadding,
- MainAxisAlignment? actionsAlignment,
- OverflowBarAlignment? actionsOverflowAlignment,
- VerticalDirection? actionsOverflowDirection,
- double? actionsOverflowButtonSpacing,
- EdgeInsetsGeometry? buttonPadding,
- Color? backgroundColor,
- double? elevation,
- Color? shadowColor,
- Color? surfaceTintColor,
- String? semanticLabel,
- EdgeInsets insetPadding,
- Clip? clipBehavior,
- ShapeBorder? shape,
- AlignmentGeometry? alignment,
- bool scrollable,
- ScrollController? scrollController,
- ScrollController? actionScrollController,
- Duration insetAnimationDuration,
- Curve insetAnimationCurve,
Creates an adaptive AlertDialog based on whether the target platform is iOS or macOS, following Material design's Cross-platform guidelines.
On iOS and macOS, this constructor creates a CupertinoAlertDialog. On other platforms, this creates a Material design AlertDialog.
Typically passed as a child of showAdaptiveDialog, which will display the alert differently based on platform.
If a CupertinoAlertDialog is created only these parameters are used:
title
, content
, actions
, scrollController
,
actionScrollController
, insetAnimationDuration
, and
insetAnimationCurve
. If a material AlertDialog is created,
scrollController
, actionScrollController
, insetAnimationDuration
,
and insetAnimationCurve
are ignored.
The target platform is based on the current Theme: ThemeData.platform.
CupertinoDialogAction is conditionally used as the child to show more platform specific design.
To create a local project with this code sample, run:
flutter create --sample=material.AlertDialog.AlertDialog.adaptive.1 mysample
Implementation
const factory AlertDialog.adaptive({
Key? key,
Widget? icon,
EdgeInsetsGeometry? iconPadding,
Color? iconColor,
Widget? title,
EdgeInsetsGeometry? titlePadding,
TextStyle? titleTextStyle,
Widget? content,
EdgeInsetsGeometry? contentPadding,
TextStyle? contentTextStyle,
List<Widget>? actions,
EdgeInsetsGeometry? actionsPadding,
MainAxisAlignment? actionsAlignment,
OverflowBarAlignment? actionsOverflowAlignment,
VerticalDirection? actionsOverflowDirection,
double? actionsOverflowButtonSpacing,
EdgeInsetsGeometry? buttonPadding,
Color? backgroundColor,
double? elevation,
Color? shadowColor,
Color? surfaceTintColor,
String? semanticLabel,
EdgeInsets insetPadding,
Clip? clipBehavior,
ShapeBorder? shape,
AlignmentGeometry? alignment,
bool scrollable,
ScrollController? scrollController,
ScrollController? actionScrollController,
Duration insetAnimationDuration,
Curve insetAnimationCurve,
}) = _AdaptiveAlertDialog;