Last active
June 1, 2023 07:57
-
-
Save rei-codes/230a4b68ad6f6590796bdde4f277ac82 to your computer and use it in GitHub Desktop.
MediaQuery as an InheritedModel
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
class HomePage extends StatelessWidget { | |
const HomePage({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
log('HomePage'); | |
return Scaffold( | |
appBar: AppBar(), | |
body: Center( | |
child: Text( | |
MediaQuery.of(context).platformBrightness.name, | |
), | |
), | |
floatingActionButton: FloatingActionButton( | |
onPressed: () { | |
Navigator.of(context).push( | |
MaterialPageRoute(builder: (_) => const DetailsPage()), | |
); | |
}, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment