[Feedback Requested] Cross-platform Adaptation for Alert Dialogs #92
InMatrix
started this conversation in
Cross-platform Design
Replies: 1 comment 1 reply
-
About the automated |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is an alert dialog?
An alert dialog (also known as a basic dialog or simply an alert) informs the user about situations that require acknowledgment. An alert dialog has content, an optional title and an optional list of actions. The title is displayed above the content and the actions are displayed below the content.
Platform differences
Since Android 12, the default UI of alert dialogs follows the design guidelines defined in Material 3 (M3). On iOS, an equivalent component called “alert” is defined in Apple’s Human Interface Guidelines (HIG). There are some notable differences on the design of the alert dialog between the two platforms, as shown in the table below.
The Flutter framework has two different widgets for displaying alert dialogs:
Adaptation recommendation
Our overall recommendation is to follow the platform convention when using alert dialogs in your app.
Rationale and exception
Since alert dialogs are often tightly integrated with the operating system, we recommend following the platform conventions. This is especially important when a dialog is used to request user input about security, privacy, and destructive operations (e.g., deleting files permanently). As an exception, a branded alert dialog design can be used on non-critical user flows to highlight specific information or messages. Here are some examples of alert dialog usage from public apps.
This option has the following tradeoffs:
Example code
To implement platform-specific alert dialogs, you can use Flutter’s
AlertDialog
widget on Android and theCupertinoAlertDialog
widget on iOS. Below is a code snippet you can adapt to show a platform-specific alert dialog. You can run this program in a local project to see the effect in action.Automated adaptation
A
.adaptive
constructor has been added toAlertDialog
to enable automatic adaptation of the widget across platforms. See flutter/flutter#124336 for details. It will likely to be available in the next stable release of Flutter.Beta Was this translation helpful? Give feedback.
All reactions