Home > database >  I had an error in flutter as "BOTTOM OVERFLOWING BY 1.1 PIXELS" while creating buttons
I had an error in flutter as "BOTTOM OVERFLOWING BY 1.1 PIXELS" while creating buttons

Time:10-01

This is my code. Help me with this:

    return SafeArea(
          child: Container(
            width: size.width,
            height: size.height,
            color: background,
            child: FittedBox(
              fit: BoxFit.contain,
              alignment: Alignment.center,
              child: Center(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                  children: <Widget>[
                    Container(
                      width: size.width,
                      height: size.height * 0.1,
                      child: Padding(
                        padding: EdgeInsets.zero,
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceAround,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: <Widget>[
                          ],
                        ),
                      ),
                    ),
                    Container(
                      width: size.width,
                      height: size.height * 0.25,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: <Widget>[
                          Container(
                            width: size.width * 0.25,
                            height: size.height * 0.25,
                            decoration: new BoxDecoration(
                              color: buttonBackground,
                              borderRadius: new BorderRadius.all(
                                Radius.circular(40.0),
                              ),
                            ),
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.spaceAround,
                              children: <Widget>[
                                Icon(
                                  Icons.keyboard_arrow_left,
                                  color: iconButton,
                                  size: 38,
                                ),
                                Text(
                                  "L&R",
                                  style: TextStyle(
                                    fontWeight: FontWeight.bold,
                                    color: text,
                                    fontSize: 24,
                                  ),
                                ),
                                Icon(
                                  Icons.keyboard_arrow_right,
                                  color: iconButton,
                                  size: 38,
                                ),
                              ],
                            ),
                          ),
                          Container(
                            padding: EdgeInsets.zero,
                            width: size.width * 0.1,
                            height: size.width * 0.1,
                            decoration: new BoxDecoration(
                              gradient: new LinearGradient(
                                begin: Alignment.topLeft,
                                end: Alignment.topRight,
                                colors: [
                                  Colors.blue,
                                  Colors.pink,
                                ],
                              ),
                              shape: BoxShape.circle,
                            ),
                            child: Container(
                              padding: EdgeInsets.zero,
                              width: size.width * 0.4,
                              height: size.width * 0.4,
                              decoration: new BoxDecoration(
                                color: background,
                                shape: BoxShape.circle,
                              ),
                            ),
                          ),
                          Container(
                            width: size.width * 0.25,
                            height: size.height * 0.25,
                            decoration: new BoxDecoration(
                              color: buttonBackground,
                              borderRadius: new BorderRadius.all(
                                Radius.circular(40.0),
                              ),
                            ),
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.spaceAround,
                              children: <Widget>[
                                Icon(
                                  Icons.keyboard_arrow_up,
                                  color: iconButton,
                                  size: 38,
                                ),
                                Text(
                                  "U & D",
                                  style: TextStyle(
                                    fontWeight: FontWeight.bold,
                                    color: text,
                                    fontSize: 24,
                                  ),
                                ),
                                Icon(
                                  Icons.keyboard_arrow_down,
                                  color: iconButton,
                                  size: 38,
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
    
                    Container(
                        width: size.width,
                        height: size.height*0.23,
                    ),
    
                  ],
                ),
              ),
            ),
          ),
        );

CodePudding user response:

Try below code hope its helpful to you.

Add your Column Widget inside SingleChildScrollView

SingleChildScrollView(
    child:Column(
      children:[
            //Add your widgets here
           ],
       ),
 ),

CodePudding user response:

I'm trying to reproduce the error, but I need your constants to do so. Can you add the constants.dart file to your question? Or at least the file where you specify size.width and size.height, for example?

That way I can run your code on my computer and see what I can do to help you.

For now, I'm thinking you should probably use Flex widget (https://api.flutter.dev/flutter/widgets/Flex-class.html) to fix this problem without making the app scroll, since that's not always what you want (thinking of a login page or something).

  • Related