Bhavesh Rughwani
Bhavesh Rughwani

Reputation: 23

RenderDecoratedBox needs compositing size:Missing

The relevant error-causing widget was:

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(), devicePixelRatio: 3.0, locale: en_US, textDirection: TextDirection.ltr, 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

here is the code which is problematic

Widget buildForm() { newUser user; return Container( width: 330, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), ), child:Flexible(

        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,
            ),
          ),
]
),
      ),

  )
);

Upvotes: 1

Views: 2791

Answers (1)

Colin Lazarini
Colin Lazarini

Reputation: 947

The error is explained here:

Container file:///home/bhavesh/AndroidStudioProjects/AudioShow/lib/pages/welcome/phone.dart:124:12 
.....
64.0<=w<=Infinity, 36.0<=h<=Infinity
....

The error may come from your Flexible which is not supposed to be used inside a Container but a Row or a Column. Try and set constraints to your widgets in order to identify the problem and then work from there to make them responsive.

Upvotes: -1

Related Questions