Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flutter || Padding for floatingActionButton in flutter

In my flutter project I used a floatingActionButton and I want to add a padding but I don’t know how to make the tree with my code. Any help is highly appreciated.

This is my code :

 floatingActionButton: Visibility(
              visible: buttonshow,
              child: FloatingActionButton(
                onPressed: () {
                  scrollToTop();
                },
                shape: const StadiumBorder(
                    side: BorderSide(
                        color: Color(0xff135888), width: 2.5)),
                backgroundColor: Colors.transparent,
                elevation: 0.0,
                child: const Icon(
                  Icons.keyboard_arrow_up, color: Color(0xff135888),
                  size: 28.0,),
                mini: true,

              ),
            ),

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Wrap your Visibility with an Expanded Widget.

Updated code:

floatingActionButton: Padding(
  padding: const EdgeInsets.all(8.0),
  child: Visibility(
    visible: buttonshow,
    child: FloatingActionButton(
      onPressed: () {
        scrollToTop();
      },
      shape: const StadiumBorder(
          side: BorderSide(color: Color(0xff135888), width: 2.5)),
      backgroundColor: Colors.transparent,
      elevation: 0.0,
      child: const Icon(
        Icons.keyboard_arrow_up,
        color: Color(0xff135888),
        size: 28.0,
      ),
      mini: true,
    ),
  ),
), 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading