小编典典

Flutter:设置AppBar的高度

flutter

如何简单地设置AppBarFlutter中的高度?

栏的标题应垂直居中(在中AppBar)。


阅读 584

收藏
2020-08-13

共1个答案

小编典典

您可以使用PreferredSize

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Example',
      home: Scaffold(
        appBar: PreferredSize(
          preferredSize: Size.fromHeight(50.0), // here the desired height
          child: AppBar(
            // ...
          )
        ),
        body: // ...
      )
    );
  }
}
2020-08-13