Feedback & Overlays
Context-free alerts, toasts, and loaders for a smoother UX.
Feedback & Overlays
Fluxy v0.1.4 introduces a Context-Free overlay system. You can now trigger toasts, dialogs, and loaders from anywhere in your code — including controllers and services — without needing a BuildContext reference.
Technical Requirement: To use context-free overlays, ensure that
FluxyRouter.navigatorKeyis attached to yourMaterialApp.
MaterialApp(
navigatorKey: FluxyRouter.navigatorKey,
// ...
)Toasts
Toasts are non-intrusive messages that appear at the bottom (or top) of the screen. Fluxy provides semantic methods for different notification types.
Success Toast
Fx.toast.success("Profile updated successfully!");Error Toast
Fx.toast.error("Failed to save changes. Please try again.");Info & Warning
Fx.toast.info("A new update is available.");
// or
Fx.toast.warning("Your session is about to expire.");Loaders
Manage global loading states with simple show/hide commands. This is perfect for blocking the UI during critical network operations.
// Show the loader
Fx.loader.show();
// Perform async operation
await saveToServer();
// Hide the loader
Fx.loader.hide();Dialogs
Prompt the user for decisions or display critical alerts with ease.
Confirm Dialog
Returns a Future<bool> indicating the user's choice.
final confirmed = await Fx.dialog.confirm(
title: "Delete Account",
message: "Are you sure you want to proceed? This action cannot be undone.",
confirmText: "Delete",
cancelText: "Keep it",
);
if (confirmed) {
// Proceed with deletion
}Alert Dialog
A simple modal for displaying information that requires acknowledgment.
await Fx.dialog.alert(
title: "Permission Required",
message: "Please enable camera access in your settings.",
);Why Context-Free?
Traditional Flutter overlays require a BuildContext, which often forces you to pass the context down through multiple layers of widgets or logic. By moving to a Managed Overlay State, Fluxy allows your business logic (Controllers) to trigger UI feedback directly, adhering to a cleaner "Context-Free" architecture.