带有文本+图标的按钮,使用Flutter滚动时变成仅图标 [英] Button with text + icon that changes into only icon when scrolling using Flutter

查看:661
本文介绍了带有文本+图标的按钮,使用Flutter滚动时变成仅图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Flutter开发

我想创建一个按钮,就像Gmail的Android应用程序上的按钮一样。

I wanted to create a button just like the one on available at Gmail's Android Application.

这是一个扩展浮动按钮,带有右边的图标和右边的标题/文本,当您向下滚动电子邮件列表时,按钮缩小。

It's an Extended Floating button with an Icon to the right and a title/text to the right, and when you scroll down the list of emails the button "shrinks" into a traditional Floating Button with only the Icon.

也可以制作动画。

推荐答案

这可以通过具有属性 position 的Scrollcontroller来完成。只需将初始值与另一个值进行比较。如果它们不同,请使用按钮进行操作。

This can be done with a Scrollcontroller which has a property position. Simply compare the initial value with another. If they are different, do something with the button.

这篇关于带有文本+图标的按钮,使用Flutter滚动时变成仅图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆