Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 颤振AppBar前导文本_Ios_Flutter_Flutter Layout_Appbar - Fatal编程技术网

Ios 颤振AppBar前导文本

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')只需这样做! 如果“设置”文本分为两部分,

我想在我的AppBar中使:Icon(Icons.settings)变为==>Text('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”,这现在是完美的。这回答了你的问题吗?看看这个答案: