问题描述
相关的导致错误的小部件是:
Container file:///home/bhavesh/AndroidStudioProjects/AudioShow/lib/pages/welcome/phone.dart:124:12
When the exception was thrown,this was the stack:
#2 RenderBox.size (package:Flutter/src/rendering/Box.dart:1940:12)
#3 RenderDecoratedBox.paint (package:Flutter/src/rendering/proxy_Box.dart:2136:12)
#4 RenderObject._paintWithContext (package:Flutter/src/rendering/object.dart:2322:7)
#5 PaintingContext.paintChild (package:Flutter/src/rendering/object.dart:189:13)
#6 RenderProxyBoxMixin.paint (package:Flutter/src/rendering/proxy_Box.dart:142:15)
...
The following RenderObject was being processed when the exception was fired: RenderDecoratedBox#2711f relayoutBoundary=up5
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=100.0,0.0<=h<=Infinity)
... size: MISSING
... decoration: Boxdecoration
... color: Color(0xffffffff)
... borderRadius: BorderRadius.circular(8.0)
... configuration: ImageConfiguration(bundle: PlatformAssetBundle#d7160(),devicePixelRatio: 3.0,locale: en_US,textDirection: TextDirection.ltr,platform: android)
RenderObject: RenderDecoratedBox#2711f relayoutBoundary=up5
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(w=100.0,0.0<=h<=Infinity)
size: MISSING
decoration: Boxdecoration
color: Color(0xffffffff)
borderRadius: BorderRadius.circular(8.0)
configuration: ImageConfiguration(bundle: PlatformAssetBundle#d7160(),platform: android)
... child: RenderFlex#2fab8 relayoutBoundary=up6 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=100.0,0.0<=h<=Infinity)
... size: MISSING
... direction: horizontal
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... textDirection: ltr
... verticalDirection: down
... child 1: RenderSemanticsAnnotations#b73cb relayoutBoundary=up7 NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0,0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(unconstrained)
... semantic boundary
... size: MISSING
... child: _RenderInputPadding#95409 relayoutBoundary=up8 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(unconstrained)
... size: MISSING
... child: RenderConstrainedBox#4930b relayoutBoundary=up9 NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0,0.0) (can use size)
... constraints: BoxConstraints(unconstrained)
... size: MISSING
... additionalConstraints: BoxConstraints(64.0<=w<=Infinity,36.0<=h<=Infinity)
... child 2: RenderMouseRegion#183ec NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0,0.0); flex=null; fit=null
... constraints: MISSING
... size: MISSING
... listeners: enter,exit
... cursor: SystemMouseCursor(text)
... child: RenderIgnorePointer#e02f9 NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: <none>
... constraints: MISSING
... size: MISSING
... ignoring: false
... ignoringSemantics: implicitly false
... child: RenderSemanticsAnnotations#8806a NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: <none>
... constraints: MISSING
... size: MISSING
这是有问题的代码
小部件 buildForm() { 新用户; 返回容器( 宽度:330, 装饰:Boxdecoration( 颜色:Colors.white, borderRadius: BorderRadius.circular(8),),孩子:灵活(
child: Form(
key: _formKey,child:Row(
children:<Widget>[
CountryCodePicker(
initialSelection: 'IN',showCountryOnly: false,alignLeft: true,padding: const EdgeInsets.all(4),textStyle: TextStyle(fontSize: 20),TextFormField(
onChanged: (value1) {
_formKey.currentState.validate();
verifyPhone(value1);
},validator: (value) {
if (value.isEmpty) {
setState(() {
onSignUpButtonClick = null;
});
} else {
setState(() {
onSignUpButtonClick = signUp;
user.user.phonenumber=value;
});
}
return null;
},controller: _phoneNumberController,autocorrect: false,autofocus: false,decoration: Inputdecoration(
hintText: 'Phonenumber',border: InputBorder.none,focusedBorder: InputBorder.none,enabledBorder: InputBorder.none,errorBorder: InputBorder.none,disabledBorder: InputBorder.none,keyboardType: TextInputType.phone,style: TextStyle(
fontSize: 20,color: Colors.black,fontWeight: FontWeight.w400,]
),)
);
解决方法
错误解释如下:
Container file:///home/bhavesh/AndroidStudioProjects/AudioShow/lib/pages/welcome/phone.dart:124:12
.....
64.0<=w<=Infinity,36.0<=h<=Infinity
....
错误可能来自您的 Flexible ,它不应该在容器内使用,而是在行或列中使用。尝试为您的小部件设置约束以识别问题,然后从那里开始工作以使它们具有响应性。