简体   繁体   English

如何更改 FloatingActionButton 扩展中的图标位置

[英]How to change the icon position in FloatingActionButton extended

The icon on FloatingActionButton extended is on left, how can i put the icon on right? FloatingActionButton 扩展的图标在左边,我怎样才能把图标放在右边? after the text在正文之后

floatingActionButton: FloatingActionButton.extended(   
            onPressed: (){},
            label: Text("Next",),
            icon: Icon(Icons.arrow_forward,
            ),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.endFloat 

There isn't any direct way to do that.没有任何直接的方法可以做到这一点。 But as a workaround, you could just pass a Row widget (Which contains a Text and Icon widgets) to label parameter.但作为一种解决方法,您可以将一个Row小部件(其中包含一个TextIcon小部件)传递给label参数。

floatingActionButton: FloatingActionButton.extended(
    onPressed: () {},
    label: Row(
      children: <Widget>[Text("Proceed"), Icon(Icons.arrow_forward)],
    ),
    icon: Container(),
  ),

Hope it helps.希望能帮助到你。

I don't think you can do that with FloatingActionButton , but instead you can configure a RaisedButton to look very similar.我不认为你可以用FloatingActionButton做到这一点,但你可以将RaisedButton配置为看起来非常相似。
Just use it same as you would do it with FloatingActionButton.只需像使用 FloatingActionButton 一样使用它即可。

floatingActionButton: RaisedButton(
        child:  Container(
          height: 50.0,
          child: Row(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
            const SizedBox(width: 16.0),
                   Text('Next', style: TextStyle(color: Colors.white, fontSize: 25),),
                   const SizedBox(width: 8.0),
                   Icon(Icons.arrow_forward, size: 30.0, color: Colors.white,),
                   const SizedBox(width: 20.0),
          ]),
        ),
        color: Colors.blue,
        shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(30.0),
                  ),
        onPressed: () {
          print('Do somenthing');
        },

      )

Hope this help.希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM