[英]How to Change Button Icon to Animated Text in Flutter?
I am Facing Some Issues on this Topic.我在这个主题上面临一些问题。 I have a Material Button.
我有一个材质按钮。 as you can see in the Code below there is an "Emoticon" icon is Set for it.
正如您在下面的代码中看到的那样,为它设置了一个“表情”图标。
MaterialButton(
onPressed: () {},
// color: Colors.transparent,
child: Icon(
Icons.emoji_emotions_outlined,
color: Colors.black54,
size: 35,
),
shape: CircleBorder(),
padding: EdgeInsets.all(16),
),
],
),
I also Have a Text Field which Looks like, this, (below),我也有一个看起来像这样的文本字段(如下),
TextFormField(
// autofocus: true,
decoration: InputDecoration(
labelText: 'Write Task',
// border: OutlineInputBorder(),
prefixIcon: Icon(Icons.add),
),
),
After the user is done writing I need to Show up this List
of emojis [,,,,,,]
One by one in the Delay of One Second.用户写完后,我需要在一秒的延迟中一个一个地显示这个表情符号
List
[,,,,,,]
。 inside the Material Button, Place Above, in the place of Icon.在 Material Button 里面,Place Above,在 Icon 的地方。
List
of emojis [,,,,,,]
List
[,,,,,,]
I really want to Seek Help at this.我真的很想在这方面寻求帮助。
Two things here,这里有两件事,
Initially one icon is shown in material button.最初,材料按钮中显示一个图标。 As per the user's interaction the icon will be changed.
根据用户的交互,图标将被更改。
To achieve this, create instance of IconData
(as Icon
accepts IconData
) and initially set the default icon.为此,创建
IconData
的实例(因为Icon
接受IconData
)并最初设置默认图标。 You can set the selected IconData
to the variable whenever user selects another icon.每当用户选择另一个图标时,您都可以将选定的
IconData
设置为变量。
I don't know whether this traditional icons are there in Material Icons library or not.我不知道这个传统图标是否在 Material Icons 库中。 Check font_awesome_flutter otherwise.
否则检查font_awesome_flutter 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.