The simple and easy overlay package. With it, you can overlay a custom widget on any other widget.
- Custom widget overlay;
- Auto show on build;
- Auto hide by duration;
- Hide on tap outside overlay;
- Controller with show/hide functions;
- Custom background shadow color/opacity;
1 - Import library on pubspec.yaml:
dependencies:
simple_overlay: ^1.0.1
2 - Add import for SimpleOverlay package on your file:
import 'package:simple_overlay/simple_overlay.dart';
3 - Creating SimpleOverlayWidget:
SimpleOverlayWidget(
controller: SimpleOverlayController(),
configuration: SimpleOverlayConfiguration(
startShowing: false,
hideOnTapOutside: true,
autoHideDuration: const Duration(seconds: 5),
shadowColor: Colors.black,
shadowOpacity: 0.5,
onShowOverlay: () {
// Called after show overlay widget
},
onHideOverlay: () {
// Called after hide overlay widget
},
),
position: SimpleOverlayPosition.topLeft(),
overlayWidget: _overlayWidget,
child: _child,
)
4 - Show/hide overlay manually:
final controller = SimpleOverlayController();
...
controller.show();
controller.hide();