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 AppBar actions iconButton overflowed

My AppBar action IconButton is overflowed.

The likesCount parameter changes over time.

How to prevent overflow dynamically, using IconButton in AppBar actions?

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

My code:

appBar: AppBar(
        actions: [
          IconButton(
            onPressed: () {},
            icon: Row(
              children: [
                Text("$likesCount"), <---- overflow in big numbers
                const Icon(Icons.favorite_border),
              ],
            ),
          ),
        ],
      ),

>Solution :

Is it necessary that you can tap in the Text too ? Cause’ you can do it like this :

     AppBar(
        actions: [
          Row(
            children: [
              Text("155.55"),
              IconButton(
                onPressed: () {},
                icon: Icon(Icons.favorite_border),
              ),
            ],
          )
        ],
      ),

Make the Row have both the Text and the IconButton

And if you want the Icon and the Text be more close, just add this in the IconButton:

constraints: BoxConstraints(),
padding: EdgeInsets.zero,
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