Ios 颤振AppBar前导文本
我想在我的AppBar中使:Icon(Icons.settings)变为==>Text('settings') 当我只做Ios 颤振AppBar前导文本,ios,flutter,flutter-layout,appbar,Ios,Flutter,Flutter Layout,Appbar,我想在我的AppBar中使:Icon(Icons.settings)变为==>Text('settings') 当我只做leading:Text('Cancel',style:TextStyle(fontSize:20)), 需要像这样下去 基本上,我想使前导成为文本而不是图标,这可能吗?通常,您可以在AppBar构造函数的leading参数中放入任何您想要的小部件。 如果您想将图标(Icons.settings)交换为文本('settings')只需这样做! 如果“设置”文本分为两部分,
leading:Text('Cancel',style:TextStyle(fontSize:20)),
需要像这样下去
基本上,我想使前导成为文本而不是图标,这可能吗?通常,您可以在
AppBar
构造函数的leading
参数中放入任何您想要的小部件。
如果您想将图标(Icons.settings)
交换为文本('settings')
只需这样做!
如果“设置”文本分为两部分,则通过设置适当的引线宽度值来调整它
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.orange,
accentColor: Colors.blue,
textTheme: TextTheme(title: TextStyle(color: Colors.white))),
home: Scaffold(
appBar: AppBar(
leadingWidth: 75, //TODO Adjust leading container width
leading: Center(
child: Text(
'Settings',
style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
)),
)));
}
}
为了获得更好的体验,我添加了Center
小部件和TextStyle
。
出于某种原因,我仍然能够生成文本,但文本不会显示在一行中,看起来像这样显示在列中:/使用leadingWidth属性。我更新了我的回复。非常感谢,添加了“leadingWidth:75”,这现在是完美的。这回答了你的问题吗?看看这个答案: