flutter - AppBar 参数设置布局效果
class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( // backgroundColor: Colors.red, // backgroundColor: Color(0xff45ff41), leading: Container( padding: EdgeInsets.all(8), child: ClipOval( child: Image.network( "https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/ab5870542e8d4479bfb899ea7a195e4d~tplv-k3u1fbpfcp-watermark.image", fit: BoxFit.cover, ), ), ), title: Text("首页"), centerTitle: true, actions: [ Row( children: [ Text("右1"), SizedBox(width: 10), Text("右2"), SizedBox(width: 10), Text("右3"), SizedBox(width: 10), ], ) ], elevation: 0.0 ), ); } }
leading里放置一段文本,默认宽度下,文字过多时, 可能文字换行
设置 leadingWidth 后
设置titleSpacing
上一篇:
IDEA上Java项目控制台中文乱码