Deep dive into the Container widget in flutter

Container(
color: Colors.blue,
),
Container(
color: Colors.blue,
width: 200,
height: 400,
),
MediaQueryData mediaQueryData(BuildContext context) {
return MediaQuery.of(context);
}

Size size(BuildContext buildContext) {
return mediaQueryData(buildContext).size;
}
double width(BuildContext buildContext) {
return size(buildContext).width;
}

double height(BuildContext buildContext) {
return size(buildContext).height;
}
Container(
color: Colors.blue,
width: width(context) * 0.5,
height: height(context) * 0.6,
),
Container(
color: Colors.blue,
width: width(context) * 0.5,
height: height(context) * 0.6,
child: Text(
"this is a container",
style: TextStyle(fontSize: 30),
),
),
Container(
color: Colors.blue,
width: width(context) * 0.5,
padding: EdgeInsets.all(10),
height: height(context) * 0.6,
child: Text(
"this is a container",
style: TextStyle(fontSize: 30),
),
),
Row(
children: [
Text("this is demo text "),
Container(
color: Colors.blue,
width: width(context) * 0.5,
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(40),
height: height(context) * 0.6,
child: Text(
"this is a container",
style: TextStyle(fontSize: 30),
),
)
],
),
Container(
color: Colors.blue,
width: width(context) * 0.5,
height: height(context) * 0.6,
alignment: Alignment.centerLeft,
child: Text(
"container",
style: TextStyle(fontSize: 30),
),
),
Container(
color: Colors.blue,
width: width(context) * 0.5,
height: height(context) * 0.6,
constraints: BoxConstraints(
maxWidth: 600,
minWidth: 300,
maxHeight: 500,
minHeight: 400,
),
child: Text(
"container",
style: TextStyle(fontSize: 30),
),
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
gradient: LinearGradient(
colors: [
Colors.red,
Colors.green,
],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
),
),
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
colors: [
Colors.red,
Colors.green,
],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
),
boxShadow: [
BoxShadow(
color: Colors.blue,
spreadRadius: 10,
blurRadius: 10,
),
],
),

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store