build method
Implementation
OverlayEntry build() {
_entry?.remove();
_entry = OverlayEntry(
builder: (context) {
final size = MediaQuery.of(context).size;
return SizedBox.fromSize(
size: size,
child: Stack(
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (tapToDismiss) {
// remove this from the overlay when tapped the opaque layer
_entry?.remove();
_entry = null;
dismissCallback?.call();
}
},
),
Positioned(
top: top,
bottom: bottom,
left: left,
right: right,
child: Material(
// Avoid background color behind the child, so the child can fully control the overlay style
color: Colors.transparent,
child: builder(context),
),
),
],
),
);
},
);
return _entry!;
}