Flutter : infinite width
4,044
Instead of width: double.infinity
,
Use,
width: MediaQuery.of(context).size.width
Author by
shankyyyyyyy
Updated on November 28, 2022Comments
-
shankyyyyyyy over 1 year
I'm doing a flutter course, and here is my relevent code :
Container( color: kBottomContainerColour, margin: EdgeInsets.only(top: 10.0), width: double.infinity, height: kBottomContainerHeight, ),
And I keep getting this :
These invalid constraints were provided to _RenderColoredBox's layout() function by the following function, which probably computed the invalid constraints in question: RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:268:14) The offending constraints were: BoxConstraints(w=Infinity, h=80.0) The relevant error-causing widget was: Container file:///F:/Works/Projects/flutter/Flutter-Course-Resources/bmi-calculator-flutter1/lib/input_page.dart:241:24
Though it is working fine in the course Please help
-
mrgnhnt96 about 3 yearsWhat is your container within? Is it within a
Row
,Column
, orStack
widget?
-