Last active
April 22, 2020 23:04
-
-
Save brandondiamond/0989d15eaed6f40971a71b8dc6617f8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class RootOverlayInjector extends Overlay { | |
final Widget child; | |
const RootOverlayInjector({Key key, this.child}) | |
: super(key: key, initialEntries: const []); | |
@override | |
_RootOverlayInjectorState createState() => _RootOverlayInjectorState(); | |
} | |
class _RootOverlayInjectorState extends OverlayState { | |
@override | |
BuildContext get context => | |
super.context.findRootAncestorStateOfType<OverlayState>().context; | |
@override | |
Widget build(BuildContext context) => (widget as RootOverlayInjector).child; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment