0
votes

This error is showing whenever i run my code and contact avatar is shown in the calling screen,otherwiss it works fine

ERROR ----> A RenderFlex overflowed by 243 pixels on the bottom.

Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size. This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.

   Widget build(BuildContext context) {
//var contectinfo=widget.contact;
var contactinfo=widget.contact!=null?widget.contact:new Contact();

return MaterialApp(
    home: Scaffold(
  backgroundColor: Colors.red.shade700,
  body: SafeArea(
    child: Container(
      color: Colors.red.shade700,
      child: Padding(
        padding: const EdgeInsets.all(0.0),
        child: Card(
          color: Colors.red.shade700,

            child: Column(
              children: <Widget>[
                Row(
                  mainAxisSize: MainAxisSize.max,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Text(
                        'CALLING',
                        style: new TextStyle(fontSize: 20.0),
                      ),
                    )
                  ],
                ),
                Row(
                  mainAxisSize: MainAxisSize.max,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Text(
                        contactinfo.displayName,
                        style: new TextStyle(fontSize: 20.0),
                      ),
                    )
                  ],
                ),
                Column(
                  children: [
                    Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: (_avatar != null && _avatar.length > 0) ? CircleAvatar(
                        backgroundImage: MemoryImage(_avatar),
                        maxRadius: 80,
                      ):

                      Container(
                          decoration: BoxDecoration(
                              shape: BoxShape.circle,
                              color: Colors.grey

                          ),
                          child: CircleAvatar(
                              child: Text(
                                  contactinfo.initials(),
                                  style: TextStyle(
                                      color: Colors.white,
                                    fontSize: 60
                                  )
                              ),
                              backgroundColor: Colors.transparent,
                              maxRadius: 80
                          )
                      )
                    ),
                  ],
                ),
                Padding(
                  padding:
                      const EdgeInsets.only(left: 30, right: 20, bottom: 20),
                  child: Container(
                    color: Colors.red.shade700,
                    margin: EdgeInsets.all(30),
                    child: Column(
                      children: <Widget>[
                        Row(
                          children: [
                            Padding(
                              padding: const EdgeInsets.all(20.0),
                              child: FloatingActionButton(
                                  heroTag: "btn7",
                                  child: Icon(
                                    CupertinoIcons.mic_slash_fill,
                                    color: Colors.red.shade700,
                                  ),
                                  backgroundColor: Colors.white,
                                  onPressed: null),
                            ),
                            Padding(
                              padding: const EdgeInsets.all(20.0),
                              child: FloatingActionButton(
                                  heroTag: "btn6",
                                  child: Icon(
                                    Icons.dialpad,
                                    color: Colors.red.shade700,
                                  ),
                                  backgroundColor: Colors.white,
                                  onPressed: null),
                            ),
                            Padding(
                              padding: const EdgeInsets.all(20.0),
                                child: FloatingActionButton(
                                    heroTag: "btn5",
                                    child: Icon(
                                      Icons.volume_up_sharp,
                                      color: Colors.red.shade700,
                                    ),
                                    backgroundColor: Colors.white,
                                    onPressed: null),
                            ),
                          ],
                        ),
                        Row(
                          children: [
                            Padding(
                              padding: const EdgeInsets.all(20.0),
                              child: FloatingActionButton(

                                  heroTag: "btn4",
                                  child: Icon(
                                    CupertinoIcons.add,
                                    color: Colors.red.shade700,
                                  ),
                                  backgroundColor: Colors.white,
                                  onPressed: null),
                            ),
                            Padding(
                              padding: const EdgeInsets.all(20.0),
                              child: FloatingActionButton(
                                  heroTag: "btn3",
                                  child: Icon(
                                    CupertinoIcons.video_camera_solid,
                                    color: Colors.red.shade700,
                                  ),
                                  backgroundColor: Colors.white,
                                  onPressed: null),
                            ),
                            Padding(
                              padding: const EdgeInsets.all(20.0),
                              child: FloatingActionButton(
                                  heroTag: "btn2",
                                  child: Icon(
                                    CupertinoIcons.person_add_solid,
                                    color: Colors.red.shade700,
                                  ),
                                  backgroundColor: Colors.white,
                                  onPressed: null),
                            ),
                          ],
                        )
                      ],
                    ),
                  ),
                ),
                Padding(
                  padding: const EdgeInsets.only(bottom: 30),
                  child: FloatingActionButton(
                      heroTag: "btn1",
                      child: Icon(
                        Icons.phone_disabled_rounded,
                        color: Colors.red.shade700,

                      ),
                      backgroundColor: Colors.white,
                    onPressed: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(builder: (context) => ContactsScreen()),
                      );
                      },
                      ),
                ),
              ],
            ),

        ),
      ),
    ),
  ),
));
 }
2
if you want a fix screen, consider setting height or set flex for each child in the outer Column; else wrap the outer Column in a SingleChildScrollView and let it freely scrollDung Ngo

2 Answers

1
votes

Use a SingleChildScrollView as your parent widget, it is flutter magic :)) for RenderOverflows

1
votes

Use ListView or SingleChildScrollView if your content-length exceeds device height, i.e. height-of-widgets > height-of-screen.

If you use ListView than it will add the ripple pull effect on the scroll boundaries, no matter the content length is lesser than the height of screen.

But if you use SingleChildScrollView then it will add the ripple pull effect only if the content-length exceeds device height. i.e your page will become responsive to different screen sizes;