The Complete Overlay Experience System for Flutter
Build stunning, production-ready dialogs, edge-to-edge sheets with custom alignments, collision-aware popups, orbital loaders, and toast queues with unified, elegant APIs.
Explore all Modalora overlay systems. Click any card to navigate directly to its step-by-step guide:
๐ฆ 1. Installation & Setup
Add modalora to your pubspec.yaml dependencies or run flutter pub add:
flutter pub add modalora
Basic Initialization
Import Modalora and use it directly with standard MaterialApp:
import 'package:flutter/material.dart';
import 'package:modalora/modalora.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Modalora App',
theme: ThemeData.dark(),
home: const HomeScreen(),
);
}
}
๐ 2. Contextless Invocations (Optional Context)
You can call any Modalora modal (dialog, bottomSheet, snackbar, loading overlay) from anywhere in your
codebaseโincluding
BLoCs, Riverpod providers, services, or controllersโwithout passing BuildContext!
// 1. Define global navigatorKey in your main.dart
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
void main() {
// 2. Configure Modalora once at app startup
Modalora.configure(navigatorKey: navigatorKey);
runApp(MaterialApp(
navigatorKey: navigatorKey,
home: const HomeScreen(),
));
}
// 3. Trigger anywhere without passing context!
void showWelcomeToast() {
Modalora.snackbar(
title: 'Welcome Back!',
message: 'Triggered cleanly from service layer without BuildContext.',
);
}
๐ฎ Interactive Live Simulator
Test how Modalora renders glassmorphic overlays, alignments, and orbital indicators in real-time:
Select Overlay Component:
Click any trigger button below to see the interactive phone screen respond immediately.
Modalora OS
Tap left controls to simulate live transitions.
๐ฌ 3. Dialogs & Confirmations
Create ultra-clean modal dialogs with customizable titles, messages, custom widget children, primary, secondary, and destructive action buttons, as well as optional auto-close timers.
// Display a confirmation dialog with primary & destructive actions
final confirmed = await Modalora.dialog<bool>(
title: 'Delete Repository',
message: 'This will permanently remove the project and all history.',
primaryActionText: 'Keep Project',
onPrimaryAction: () => Navigator.pop(context, false),
destructiveActionText: 'Delete Forever',
onDestructiveAction: () => Navigator.pop(context, true),
barrierBlur: 10.0,
surfaceBlur: 14.0,
);
๐ 4. Bottom & Top Sheets (Alignment Control)
Modalora gives developers complete control over sheet alignment. Choose Alignment.bottomCenter,
Alignment.topCenter, or Alignment.center with edge-to-edge support and snap
points.
// 1. Open a classic Bottom Sheet (context is completely optional!)
await Modalora.bottomSheet(
alignment: Alignment.bottomCenter, // Default bottom placement
title: 'Filter Results',
showDragHandle: true,
child: const MyFilterFormWidget(),
);
// 2. Open a Top Sheet entering from screen top
await Modalora.bottomSheet(
alignment: Alignment.topCenter, // Custom top placement!
title: 'Quick Search & Commands',
child: const MyCommandPaletteWidget(),
);
๐ 5. Action Sheets
Displays sleek iOS-inspired action sheets with icon items, destructive flags, and cancel capsules.
await Modalora.actionSheet(
title: 'Share Project',
message: 'Select your preferred export method.',
actions: [
ModaloraActionSheetItem(
label: 'Copy Public Link',
icon: Icons.link_rounded,
onPressed: () => copyLink(),
),
ModaloraActionSheetItem(
label: 'Export as PDF',
icon: Icons.picture_as_pdf_rounded,
onPressed: () => exportPdf(),
),
ModaloraActionSheetItem(
label: 'Delete Access',
icon: Icons.delete_outline_rounded,
isDestructive: true,
onPressed: () => deleteAccess(),
),
],
cancelText: 'Dismiss',
);
๐ฏ 6. Anchor-Targeted Popups & Tooltips
Anchor popups to any GlobalKey or Rect. Modalora's custom layout delegate computes
viewport bounds and automatically flips the anchor (e.g. from top to bottom) if edge collisions occur!
final GlobalKey buttonKey = GlobalKey();
// Button in widget tree
ElevatedButton(
key: buttonKey,
onPressed: () {
Modalora.popup(
anchorKey: buttonKey,
anchor: ModaloraPopupAnchor.bottom,
title: 'Pro Feature',
message: 'Upgrade your subscription to unlock unlimited bandwidth.',
);
},
child: const Text('Inspect'),
);
๐ 8. Snackbars & Multi-Position Toast Queues
Queue floating toast capsules anywhere across the viewport (topCenter,
bottomCenter,
topRight, etc.) with countdown progress bars and swipe-to-dismiss gestures.
Modalora.snackbar(
title: 'Upload Finished',
message: '3 files successfully synchronized.',
position: ModaloraPosition.topCenter,
duration: const Duration(seconds: 4),
showProgressBar: true,
actionLabel: 'VIEW',
onActionPressed: () => openGallery(),
);
๐ 9. Orbital Loading Overlays & Handles
Block user interactions during asynchronous actions with high-precision orbital gradient spinners.
Returns a ModaloraOverlayHandle for clean programmatic dismissal.
// 1. Show loading spinner and capture handle
final handle = Modalora.loading(
title: 'Processing AI Generation...',
message: 'Synthesizing neural model outputs.',
);
// 2. Perform async work
await generateContent();
// 3. Programmatically dismiss
await handle.dismiss();
๐ฑ 10. Adaptive Mobile / Tablet / Desktop Presentation
Present as a bottom sheet on mobile devices (width ≤ 600dp) and automatically convert to a centered dialog on tablets, laptops, and web browsers!
await Modalora.adaptive(
title: 'Account Settings',
message: 'Manage your profile credentials and security.',
child: const SettingsFormWidget(),
);
๐จ 11. Ambient Theming & Design System
Customize your application's modal design tokens globally or locally using ModaloraThemeData:
final customTheme = ModaloraThemeData.dark().copyWith(
primaryColor: const Color(0xFF8B5CF6),
surfaceColor: const Color(0xFF1E293B).withOpacity(0.8),
borderRadius: BorderRadius.circular(24.0),
dialogTheme: const ModaloraDialogTheme(
barrierBlur: 12.0,
surfaceBlur: 16.0,
),
bottomSheetTheme: const ModaloraBottomSheetTheme(
alignment: Alignment.bottomCenter,
showDragHandle: true,
),
);
๐ 11. 3D Perspective Hologram & Tilt Engine
Experience next-generation spatial UI in Flutter! Modalora provides a built-in Matrix4 3D perspective distortion engine with real-time pointer/gyro tracking, radial specular light glare reflections, pulsing orbital glow rings, and responsive glass chip wrapping.
// 1. Direct One-Line 3D Hologram Modal Launch
await Modalora.hologram(
title: '3D Hologram Engine',
message: 'Drag or move cursor across the card to experience real-time 3D perspective gyro tilting and specular light reflections.',
icon: Icons.view_in_ar_rounded,
accentColor: const Color(0xFF06B6D4), // Glowing cyan ring
secondaryAccentColor: const Color(0xFF8B5CF6),// Ambient purple glow
primaryActionText: 'Explore 3D',
secondaryActionText: 'Dismiss',
features: const [
Modalora3DFeature(icon: Icons.threed_rotation_rounded, label: '3D Tilt'),
Modalora3DFeature(icon: Icons.flare_rounded, label: 'Specular Glare'),
Modalora3DFeature(icon: Icons.blur_on_rounded, label: 'Frosted Glass'),
],
onPrimaryAction: () {
print('3D Action Pressed!');
},
);
// 2. Transform ANY Custom Widget into a 3D Perspective Modal
await Modalora.dialog3D(
maxTilt: 0.3,
perspective: 0.002,
child: MyCustomGlassCardWidget(),
);
// 3. Reusable 3D Tilt Container for Any Screen or Grid
Modalora3DTiltCard(
maxTilt: 0.25,
perspective: 0.0018,
glareIntensity: 0.4,
glareColor: Colors.white,
child: ProductCard(),
);
๐ 12. Complete API Reference
Comprehensive list of all parameters, types, defaults, and descriptions across Common hooks and specific components. Use the live search box to instantly filter any parameter!
| Category | Parameter | Type | Default | Description & Usage |
|---|---|---|---|---|
| Common (All) | context |
BuildContext? |
null (navigatorKey) |
Optional context; automatically resolves global ModaloraConfig.navigatorKey if
omitted. |
| Common (All) | title |
String? |
null |
Primary headline title text for the modal, sheet, or toast. |
| Common (All) | message |
String? |
null |
Secondary description body text. |
| Common (All) | child |
Widget? |
null |
Custom widget content embedded inside the modal or sheet. |
| Common (All) | surfaceBlur |
double? |
12.0 |
Glassmorphic blur sigma intensity applied to the card surface. |
| Common (All) | barrierBlur |
double? |
8.0 |
Frosted backdrop blur sigma applied behind the modal. |
| Common (All) | barrierColor |
Color? |
Colors.black54 |
Dimming color tint for the background barrier. |
| Common (All) | barrierDismissible |
bool? |
true |
Whether tapping outside the card dismisses the modal. |
| Common (All) | borderRadius |
BorderRadius? |
BorderRadius.circular(20) |
Corner radius curvature for the modal card or sheet. |
| Common (All) | border |
BoxBorder? |
Border.all(...) |
Custom outline stroke border decoration. |
| Common (All) | boxShadow |
List<BoxShadow>? |
theme.boxShadow |
Outer elevation shadows and glow effects. |
| Common (All) | animation |
ModaloraAnimation? |
fadeScale / spring |
Custom transition configuration (duration, curve, slide, spring). |
| Common (All) | useRootNavigator |
bool |
true |
Whether to present over nested navigators or root screen. |
| BottomSheet | alignment |
AlignmentGeometry? |
Alignment.bottomCenter |
Screen alignment! Supports bottomCenter, topCenter, center.
|
| BottomSheet | showDragHandle |
bool? |
true |
Whether to display the rounded top drag pill handle. |
| BottomSheet | snapPoints |
List<double>? |
null |
Fractional heights (e.g. [0.4, 0.85]) for multi-stage expansion. |
| BottomSheet | isDraggable |
bool? |
true |
Whether user can drag up/down to expand or dismiss. |
| BottomSheet | header / footer |
Widget? |
null |
Fixed header and footer widgets pinned above/below scroll area. |
| BottomSheet | useSafeArea |
bool |
true |
Respects system notches and home navigation bars. |
| Dialog | primaryActionText |
String? |
null |
Label for the primary elevated action button. |
| Dialog | destructiveActionText |
String? |
null |
Label for the red destructive action button. |
| Dialog | secondaryActionText |
String? |
null |
Label for the secondary outlined/ghost button. |
| Dialog | buttonLayout |
ModaloraButtonLayout |
horizontal |
Layout orientation: horizontal, vertical, stacked. |
| Dialog | autoCloseDuration |
Duration? |
null |
Timer that automatically closes the dialog with circular countdown. |
| Dialog | icon |
Widget? |
null |
Custom header icon widget (e.g. warning, shield, success). |
| ActionSheet | actions |
List<ModaloraActionSheetItem> |
required |
List of action items with labels, icons, destructive flags, and callbacks. |
| ActionSheet | cancelText |
String? |
'Cancel' |
Label for the bottom-separated dismiss capsule. |
| Popup | anchorKey |
GlobalKey? |
null |
GlobalKey of the target widget to attach the popup to. |
| Popup | anchor |
ModaloraPopupAnchor |
bottom |
Placement position (top, bottom, left, right, etc.) with auto-flip. |
| Popup | offset |
Offset |
Offset(0, 8.0) |
Distance gap offset between popup and target element. |
items |
List<ModaloraMenuEntry> |
required |
Items list (ModaloraMenuItem, ModaloraMenuDivider,
ModaloraSubmenu). |
|
shortcut |
String? |
null |
Keyboard shortcut badge string (e.g. 'โC', 'Ctrl+S'). | |
| Snackbar | position |
ModaloraPosition |
bottomCenter |
Screen coordinate placement (topCenter, bottomCenter,
topRight). |
| Snackbar | duration |
Duration |
Duration(seconds: 4) |
Toast visible display duration before automatic dismissal. |
| Snackbar | showProgressBar |
bool? |
false |
Renders animated countdown line showing remaining time. |
| Snackbar | dismissOnSwipe |
bool? |
true |
Allows user to flick or swipe the toast offscreen. |
| Snackbar | actionLabel |
String? |
null |
Clickable action capsule button (e.g. 'UNDO', 'VIEW'). |
indicator |
Widget? |
ModaloraLoadingSpinner() |
Custom animated indicator or default orbital gradient spinner. | |
returns |
ModaloraOverlayHandle |
handle |
Handle instance with await handle.dismiss() method. |
|
| 3D Hologram | accentColor |
Color |
Color(0xFF06B6D4) |
Primary glowing orbital ring & specular highlight color. |
| 3D Hologram | secondaryAccentColor |
Color |
Color(0xFF8B5CF6) |
Secondary ambient glow & background gradient color. |
| 3D Hologram | features |
List<Modalora3DFeature> |
[3D Tilt, Glare, Glass] |
List of feature chips rendered with responsive Wrap in glass container. |
| 3D Hologram | maxTilt |
double |
0.25 |
Maximum 3D angular tilt magnitude in radians on pointer/drag. |
| 3D Hologram | glareIntensity |
double |
0.35 |
Specular radial light sheen opacity following cursor movement. |
๐ 13. Complete main.dart Full Example
Copy and paste this complete, production-ready main.dart file directly into your Flutter project to test every single
Modalora feature immediately:
import 'package:flutter/material.dart';
import 'package:modalora/modalora.dart';
// 1. Define global navigatorKey for contextless modal dispatch
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
void main() {
// 2. Configure global default theme and navigatorKey
Modalora.configure(
navigatorKey: navigatorKey,
theme: ModaloraThemeData.dark(),
);
runApp(const ModaloraDemoApp());
}
class ModaloraDemoApp extends StatelessWidget {
const ModaloraDemoApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorKey: navigatorKey, // Attach navigator key
title: 'Modalora Showcase',
debugShowCheckedModeBanner: false,
theme: ThemeData.dark(useMaterial3: true),
home: const HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
final GlobalKey popupKey = GlobalKey();
return Scaffold(
appBar: AppBar(
title: const Text('โจ Modalora Example App'),
centerTitle: true,
),
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// 1. Glass Dialog Demo
ElevatedButton.icon(
icon: const Icon(Icons.chat_bubble_outline_rounded),
label: const Text('1. Show Dialog'),
onPressed: () {
Modalora.dialog(
title: 'Delete Document?',
message: 'Are you sure you want to permanently remove this file?',
primaryActionText: 'Keep File',
destructiveActionText: 'Delete',
onDestructiveAction: () {
Modalora.snackbar(
title: 'Deleted',
message: 'The document was removed.',
position: ModaloraPosition.topCenter,
);
},
);
},
),
const SizedBox(height: 14),
// 2. Bottom Sheet Demo (Alignment.bottomCenter)
ElevatedButton.icon(
icon: const Icon(Icons.vertical_align_bottom_rounded),
label: const Text('2. Open Bottom Sheet'),
onPressed: () {
Modalora.bottomSheet(
alignment: Alignment.bottomCenter,
title: 'Bottom Sheet Filter',
showDragHandle: true,
child: const Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Text('Smooth drag gesture with customizable alignment.'),
),
);
},
),
const SizedBox(height: 14),
// 3. Top Sheet Demo (Alignment.topCenter)
ElevatedButton.icon(
icon: const Icon(Icons.vertical_align_top_rounded),
label: const Text('3. Open Top Sheet'),
onPressed: () {
Modalora.bottomSheet(
alignment: Alignment.topCenter,
title: 'Top Sheet Command Bar',
child: const Padding(
padding: EdgeInsets.all(16.0),
child: Text('Enters seamlessly from the top edge!'),
),
);
},
),
const SizedBox(height: 14),
// 4. Anchor-Targeted Popup
ElevatedButton.icon(
key: popupKey,
icon: const Icon(Icons.ads_click_rounded),
label: const Text('4. Anchor Popup'),
onPressed: () {
Modalora.popup(
anchorKey: popupKey,
anchor: ModaloraPopupAnchor.bottom,
title: 'Smart Tip',
message: 'Automatically flips if colliding with screen bottom!',
);
},
),
const SizedBox(height: 14),
// 5. Toast Snackbar with Countdown
ElevatedButton.icon(
icon: const Icon(Icons.notifications_active_outlined),
label: const Text('5. Trigger Toast'),
onPressed: () {
Modalora.snackbar(
title: 'Project Saved',
message: 'All changes synchronized to cloud.',
showProgressBar: true,
position: ModaloraPosition.bottomCenter,
);
},
),
const SizedBox(height: 14),
// 6. Orbital Loading Overlay with Handle Dismiss
ElevatedButton.icon(
icon: const Icon(Icons.hourglass_top_rounded),
label: const Text('6. Orbital Loader'),
onPressed: () async {
final handle = Modalora.loading(
title: 'Syncing Database...',
message: 'Please wait a moment.',
);
// Simulate 2.5 seconds asynchronous task
await Future.delayed(const Duration(milliseconds: 2500));
await handle.dismiss();
Modalora.snackbar(
title: 'Completed!',
message: 'Database synced successfully.',
);
},
),
const SizedBox(height: 14),
// 7. 3D Hologram Tilt Modal (Direct 1-line package call)
ElevatedButton.icon(
icon: const Icon(Icons.view_in_ar_rounded),
label: const Text('7. 3D Hologram Modal'),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF06B6D4),
foregroundColor: Colors.white,
),
onPressed: () {
Modalora.hologram(
title: '3D Hologram Engine',
message: 'Real-time 3D perspective gyro tilting and specular light reflections.',
primaryActionText: 'Explore 3D',
secondaryActionText: 'Dismiss',
);
},
),
],
),
),
),
);
}
}