颤振:无限宽度

sha*_*yyy 3 constraints flutter

我正在做颤振课程,这是我的相关代码:

Container(
                  color: kBottomContainerColour,
                  margin: EdgeInsets.only(top: 10.0),
                  width: double.infinity,
                  height: kBottomContainerHeight,
                ),
Run Code Online (Sandbox Code Playgroud)

我不断得到这个:

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
Run Code Online (Sandbox Code Playgroud)

虽然它在课程中运行良好请帮忙

Ron*_*tel 5

代替 width: double.infinity

使用,

width: MediaQuery.of(context).size.width
Run Code Online (Sandbox Code Playgroud)