{"id":2075,"date":"2022-04-07T18:47:49","date_gmt":"2022-04-07T18:47:49","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=2075"},"modified":"2022-04-07T18:47:49","modified_gmt":"2022-04-07T18:47:49","slug":"why-we-need-a-container-widget-in-flutter","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/04\/07\/why-we-need-a-container-widget-in-flutter\/","title":{"rendered":"Why we need a container widget in Flutter?"},"content":{"rendered":"\n<p>If we have a widget that needs some background styling may be a color, shape, or size constraints, we may try to&nbsp;<strong>wrap it in a container widget<\/strong>. This widget helps us to compose, decorate, and position its child widgets. If we wrap our widgets in a container, then without using any parameters, we would not notice any difference in its appearance. But if we add any properties such as color, margin, padding, etc. in a container, we can style our widgets on the screen according to our needs.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>A basic container has a margin, border, and padding properties surrounding its child widget, as shown in the below image:<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/flutter\/images\/flutter-container.png\" alt=\"Flutter Container\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Constructors of the container class<\/h3>\n\n\n\n<p>The following are the syntax of container class constructor:<a href=\"https:\/\/www.javatpoint.com\/flutter-container#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-container#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-container#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Container({Key key,  \n           AlignmentGeometry alignment,   \n           EdgeInsetsGeometry padding,   \n           Color color,   \n           double width,   \n           double height,  \n           Decoration decoration,   \n           Decoration foregroundDecoration,   \n           BoxConstraints constraints,   \n           Widget child,   \n           Clip clipBehavior: Clip.none  \n});  <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If we have a widget that needs some background styling may be a color, shape, or size constraints, we may try to&nbsp;wrap it in a container widget. This widget helps us to compose, decorate, and position its child widgets. If we wrap our widgets in a container, then without using any parameters, we would not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[336],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/2075"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=2075"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/2075\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=2075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=2075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=2075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}