Skip to content

Instantly share code, notes, and snippets.

@felipecastrosales
Last active January 29, 2021 13:56
Show Gist options
  • Save felipecastrosales/327f3dca77fd1bd7f6df9fecf5451c9a to your computer and use it in GitHub Desktop.
Save felipecastrosales/327f3dca77fd1bd7f6df9fecf5451c9a to your computer and use it in GitHub Desktop.
MediaQuery 01
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