相关疑难解决方法(0)

如何使appbar的标题居中

我试图将标题文本集中在一个既有前导又有尾随动作的应用栏中.

@override
Widget build(BuildContext context) {
  final menuButton = new PopupMenuButton<int>(
    onSelected: (int i) {},
    itemBuilder: (BuildContext ctx) {},
    child: new Icon(
      Icons.dashboard,
    ),
  );

  return new Scaffold(
    appBar: new AppBar(
      // Here we take the value from the MyHomePage object that
      // was created by the App.build method, and use it to set
      // our appbar title.
      title: new Text(widget.title, textAlign: TextAlign.center),
      leading: new IconButton(
          icon: new Icon(Icons.accessibility),
          onPressed: () {},
      ),
      actions: [
        menuButton,
      ],
    ),
    body: new …
Run Code Online (Sandbox Code Playgroud)

flutter

54
推荐指数
8
解决办法
3万
查看次数

标签 统计

flutter ×1