mirror of
https://github.com/ente-io/ente.git
synced 2025-05-03 04:11:28 +00:00
33 lines
695 B
Dart
33 lines
695 B
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
class KeyboardOverlay {
|
|
static OverlayEntry? _overlayEntry;
|
|
|
|
static showOverlay(BuildContext context, Widget child) {
|
|
if (_overlayEntry != null) {
|
|
return;
|
|
}
|
|
|
|
final OverlayState overlayState = Overlay.of(context);
|
|
_overlayEntry = OverlayEntry(
|
|
builder: (context) {
|
|
return Positioned(
|
|
bottom: MediaQuery.of(context).viewInsets.bottom,
|
|
right: 0.0,
|
|
left: 0.0,
|
|
child: child,
|
|
);
|
|
},
|
|
);
|
|
|
|
overlayState.insert(_overlayEntry!);
|
|
}
|
|
|
|
static removeOverlay() {
|
|
if (_overlayEntry != null) {
|
|
_overlayEntry!.remove();
|
|
_overlayEntry = null;
|
|
}
|
|
}
|
|
}
|