Last active
September 17, 2019 16:13
This file contains hidden or 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
class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver { | |
@override | |
void initState() { | |
super.initState(); | |
WidgetsBinding.instance.addObserver(this); | |
} | |
@override | |
void dispose() { | |
WidgetsBinding.instance.removeObserver(this); | |
super.dispose(); | |
} | |
@override | |
void didChangePlatformBrightness() { | |
final Brightness brightness = | |
WidgetsBinding.instance.window.platformBrightness; | |
//inform listeners and rebuild widget tree | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment