简体   繁体   中英

How to prevent that the Flutter AppBar menu icon overlaps a slider in the AppBar?

I have a problem with the width of the slider because the menu overlaps the slider a bit. How can I program an automatic width of the slider to prevent overlapping?

  appBar: AppBar(
    titleSpacing: 0,
    title: Row(
      mainAxisAlignment: MainAxisAlignment.start,
      children: <Widget>[
        IconButton(icon: Icon(Icons.brush)),
        IconButton(icon: Icon(Icons.undo)),
        IconButton(icon: Icon(Icons.redo)),
        Slider(value: x, min: 0, max: 100, divisions: 100),
      ],
    ),
    actions: <Widget>[
      PopupMenuButton<String>(
 ...

Try adding a SizedBox(width: 10) between widgets

wrap Slider with Expanded widget

Expanded(child: Slider(value: x, min: 0, max: 100, divisions: 100),),

use Device Width

var width = MediaQuery.of(context).size.width;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM