DialogFactory class
Factory for creating consistent dialogs across the core. Eliminates code duplication for common dialog patterns.
Usage:
// Dropdown selection dialog
DialogFactory.showDropdownDialog<ProfileType>(
context: context,
title: 'Select Profile Type',
items: ProfileType.values,
selectedValue: currentType,
itemBuilder: (type) => type.name,
onConfirm: (type) => updateProfileType(type),
);
// Confirmation dialog
DialogFactory.showConfirmDialog(
context: context,
title: 'Delete Item',
message: 'Are you sure?',
confirmText: 'Delete',
onConfirm: () => deleteItem(),
);
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
dismissDialog(
BuildContext context) → void - Dismisses any open dialog.
-
showConfirmDialog(
{required BuildContext context, required String title, String? message, String? secondaryMessage, String confirmText = 'Confirm', String cancelText = 'Cancel', bool isDestructive = false, IconData? icon}) → Future< bool> - Shows a confirmation dialog with optional message.
-
showDropdownDialog<
T> ({required BuildContext context, required String title, required List< T> items, required T selectedValue, required String itemBuilder(T), required void onConfirm(T), String? subtitle, String confirmText = 'Update', String cancelText = 'Cancel', bool dismissOnConfirm = true, List<T> ? excludeItems}) → Future<T?> - Shows a dropdown selection dialog with confirm/cancel buttons.
-
showInputDialog(
{required BuildContext context, required String title, String? subtitle, String? initialValue, String? hintText, String confirmText = 'Save', String cancelText = 'Cancel', int maxLines = 1, int? maxLength, TextInputType keyboardType = TextInputType.text, String? validator(String?)?}) → Future< String?> - Shows an input dialog with text field.
-
showLoadingDialog(
{required BuildContext context, String? message}) → Future< void> - Shows a loading dialog that can be dismissed programmatically.