简体   繁体   English

带有文本 + 图标的按钮,在使用 Flutter 滚动时变为仅图标

[英]Button with text + icon that changes into only icon when scrolling using Flutter

Flutter Development Flutter 开发

I wanted to create a button just like the one on available at Gmail's Android Application.我想创建一个按钮,就像 Gmail 的 Android 应用程序中可用的按钮一样。

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.它是一个扩展浮动按钮,右侧有一个图标,右侧有一个标题/文本,当您向下滚动电子邮件列表时,该按钮会“缩小”为只有图标的传统浮动按钮。

It would be great to have the animation too.有动画也很棒。

This can be done with a Scrollcontroller which has a property position .这可以通过具有属性position的 Scrollcontroller 来完成。 Simply compare the initial value with another.只需将初始值与另一个进行比较。 If they are different, do something with the button.如果它们不同,请使用按钮执行某些操作。

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

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