I have an AppBar that only contains an action, which is an icon. I put some padding around the icon, and now there is some overflow, so the icon is cut.

enter image description here

Here is my code:

 appBar: PreferredSize(
        preferredSize: Size.fromHeight(100.0),
        child: AppBar(
          backgroundColor: Theme.of(context).backgroundColor,
          elevation: 10,
          actions: <Widget>[
            Container(),
            Padding(
              padding: EdgeInsets.only(right: 25, top: 40),
              child: SizedBox(
                child: Icon(
                  Icons.settings,
                  color: HexColor('#FF4848'),
                  size: 30,
                ),
              ),
            )
          ],
        ),


Solution 1: lsboissard.dev

That's because ur using a PreferredSize. Now you have to use flexibleSpace to put the widgets, like that,

PreferredSize(
    preferredSize: Size.fromHeight(100.0),
    child: AppBar(
        backgroundColor: Theme.of(context).backgroundColor,
        elevation: 10,
        flexibleSpace: Row(
          mainAxisAlignment: MainAxisAlignment.end,
          children: <Widget>[
            Padding(
              padding: EdgeInsets.only(right: 25, top: 80),
              child: SizedBox(
                child: Icon(
                  Icons.settings,
                  color: Colors.red,
                  size: 30,
                ),
              ),
            ),
          ],
        )));


Solution 2: Junsu Cho

i use appBar bottom

  return new Scaffold(
  appBar: PreferredSize(
    preferredSize: Size.fromHeight(100.0) ,
    child: AppBar(
      backgroundColor: Theme.of(context).backgroundColor,
      elevation: 10,
      bottom: PreferredSize(
        preferredSize: const Size.fromHeight(100.0),
        child: Theme(
          data: Theme.of(context).copyWith(accentColor: Colors.white),
          child: Container(
            height: 100.0,
            alignment: Alignment.centerRight ,
            child: Padding(
              padding: EdgeInsets.only(right: 25, top: 40),
              child: SizedBox(
                child: Icon(
                  Icons.settings,
                  color: Colors.red,
                  size: 30,
                ),
              ),
            ),
            ),
          ),
        ),
      ),
  ),
  body: new Text('hello world'),
);