Last active
January 29, 2021 13:56
-
-
Save felipecastrosales/327f3dca77fd1bd7f6df9fecf5451c9a to your computer and use it in GitHub Desktop.
MediaQuery 01
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'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: MediaQueryExample01(), | |
); | |
} | |
} | |
class MediaQueryExample01 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.black, | |
body: Container( | |
width: MediaQuery.of(context).size.width / 2, | |
height: MediaQuery.of(context).size.height / 2, | |
color: Colors.blue, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment