首页 > 解决方案 > 如何使用颤振将图标放在小吃店内

问题描述

我是新手,我不知道是否可以这样做。我想在文本的左侧放置一个图标。

SnackBar(    
  backgroundColor: Colors.red,
  content: Text(_accion_toast + ". " + mensaje),
  duration: Duration(milliseconds: 1500),
);

标签: flutter

解决方案


您可以将 的内容参数更改为SnackBar首先包含 的行Icon,然后是Text. 一个例子:

SnackBar(    
  backgroundColor: Colors.red,
  content: Row(
    children: <Widget>[
      //Icon widget of your choice HERE,
      Text(_accion_toast + ". " + mensaje)
    ]
  ),
  duration: Duration(milliseconds: 1500),
);

推荐阅读