flutter get width of parent widget code example
Example 1: flutter container width of parent
width: double.infinity,
height: double.infinity
Example 2: flutter set widget width to 50% o parent
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("MediaQuery"),
),
body: Container(
width: MediaQuery.of(context).size.width * 0.5,
height: MediaQuery.of(context).size.height * 0.5,
),
);
}