Tentukan ukuran layar menggunakan kelas mediaquery Flutter
class Home extends StatefulWidget
const Home({Key? key}) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Media Query"),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: (MediaQuery.of(context).size.height / 2),
width: (MediaQuery.of(context).size.width / 2),
color: Colors.green,
child: const Center(child: Text("Media Query Container")),
)
],
),
),
);
}
}{
Adventurous Ant