Last updated:
0 purchases
overlay manager
Overlay Manager #
Group and manage easily flutter overlays:
Create a new overlay with the barrier options
Arrange it in z-index order.
Check, close, and capture the return value when closed.
Import #
import 'package:overlay_manager/overlay_manager.dart';
copied to clipboard
Create #
The GlobalOverlayManager helps you create and manage your overlay without context:
final navKey = GlobalKey<NavigatorState>();
final manager = GlobalOverlayManager(navigatorKey: navKey);
// ...
@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorKey: navKey,
// ...
);
}
copied to clipboard
or uses the ContextOverlayManager:
final manager = ContextOverlayManager(context: context);
copied to clipboard
Using #
For show an overlay:
final myEntry = manager.show(
barrierColor: Colors.red.shade500.withOpacity(0.2),
onDismiss: print,
isDismissible: false,
builder: (context, entry) => AlertMessage(
onClose: () => entry.close(0),
),
);
copied to clipboard
call myEntry.close(0) to close this overlay with the returns value
If you want to close all overlay when the screen is disposed, let's try:
@override
void dispose() {
manager.closeAll();
super.dispose();
}
copied to clipboard
Rearrange #
All the overlay entries in the OverlayManager will be arranged z-index by elevation value.
Create a new entry with it's elevation:
final myEntry = manager.show(
elevation: 1
// ...
);
copied to clipboard
Or rearrange it (after create):
myEntry.rearrange(newElevation);
// or
myEntry.elevation = 1;
manager.rearrange();
copied to clipboard
Features and bugs #
Please file feature requests and bugs at the issue tracker.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.