Dialog
A dialog brings a short message or decision in front of the current screen. Use one when the reader needs to respond before continuing. Keep routine status updates inline.
Read draft details
#Open the details and dismiss the dialog to return to its trigger. Changing the theme closes the dialog so you can reopen it in the new palette.
components/dialog/appliance/draft_details.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class DraftDetails extends StatelessWidget {
const DraftDetails({super.key});
@override
Widget build(BuildContext context) => ApplianceButton.filled(
'View draft details',
onPressed: () => showApplianceDialog<void>(
context: context,
builder: (dialogContext) => ApplianceDialog(
title: 'Draft details',
content: const Text('Only visible to you until you publish'),
actions: [
ApplianceButton.filled(
'Done',
onPressed: () => Navigator.pop(dialogContext),
),
],
),
),
);
}
Parameters
ApplianceDialog API ↗title- Heading on the raised panel.
content- Widget below the heading.
actions- Keys at the bottom, with the main action last.
style- Overrides the component’s themed appearance.
Shared behaviour
- Keyboard and focus. A modal route keeps Tab and Shift+Tab inside while it is open. Escape dismisses this example and returns focus to the opener.
- Screen readers. The route identifies itself as a dialog. Its heading names the message and its action supplies an explicit way out.
- Direction and type. The reading direction and text scale carry into the overlay. Try the narrow frame with larger text to inspect the heading, body and action together.