MagicViewRegistry class
Registry for custom view builders.
Allows developers to replace default UI components with custom implementations
via their AppServiceProvider.
Usage
class AppServiceProvider extends ServiceProvider {
@override
void boot() {
Magic.view.setLoadingBuilder((context) {
return MyCustomLoadingWidget();
});
Magic.view.setSnackbarBuilder((title, message, type) {
return MyCustomSnackbar(title: title, message: message);
});
}
}
Properties
- hasConfirmBuilder → bool
-
Check if custom confirm builder exists.
no setter
- hasDialogBuilder → bool
-
Check if custom dialog builder exists.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasLoadingBuilder → bool
-
Check if custom loading builder exists.
no setter
- hasSnackbarBuilder → bool
-
Check if custom snackbar builder exists.
no setter
- hasToastBuilder → bool
-
Check if custom toast builder exists.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
buildConfirm(
BuildContext context, String title, String message, String confirmText, String cancelText, bool isDangerous, void onResult(bool)) → Widget - Build custom confirm dialog.
-
buildDialog(
BuildContext context, Widget content) → Widget - Build custom dialog wrapper.
-
buildLoading(
BuildContext context, String? message) → Widget - Build custom loading widget.
-
buildSnackbar(
String title, String message, String type) → Widget - Build custom snackbar widget.
-
buildToast(
String message) → Widget - Build custom toast widget.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Reset all custom builders (for testing).
-
setConfirmBuilder(
Widget builder(BuildContext context, String title, String message, String confirmText, String cancelText, bool isDangerous, void onResult(bool))) → void - Set a custom confirm dialog builder.
-
setDialogBuilder(
Widget builder(BuildContext context, Widget content)) → void - Set a custom dialog wrapper builder.
-
setLoadingBuilder(
Widget builder(BuildContext context, String? message)) → void - Set a custom loading widget builder.
-
setSnackbarBuilder(
Widget builder(String title, String message, String type)) → void - Set a custom snackbar widget builder.
-
setToastBuilder(
Widget builder(String message)) → void - Set a custom toast widget builder.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → MagicViewRegistry
-
Get the singleton instance.
no setter