v1.0.2+1
animated_progress_button
您在寻找让您的按钮变得专业的解决方案吗?这个包可以为您提供来自Pinterest的所有动画灵感。
26喜欢 9近 30 天下载30Pub 分数
平台暂无数据
nghiashiyi/animated_button open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
Animated loading button to make you app button looks smoother. Take inspritation from Pinterest https://www.pinterest.com/pin/671177150707141229/
Create animatedButtonController for controlling the button.
import 'package:animated_progress_button/animated_progress_button.dart';
final AnimatedButtonController animatedButtonController = AnimatedButtonController();
Then customize the button like your own way
Noted that you must call animatedButtonController.completed() after getting response from server in order to complete the button animation
AnimatedButton(
controller: animatedButtonController,
color: Colors.greenAccent,
text: 'Log in',
loadingText: 'Loading',
loadedIcon: Icon(Icons.check, color: Colors.white),
onPressed: () async {
/// calling your API here and wait for the response.
await Future.delayed(Duration(seconds: 5)); // simulated your API requesting time.
animatedButtonController.completed(); // call when you get the response
await Future.delayed(Duration(seconds: 2));
animatedButtonController.reset(); // call to reset button animation
},
),
依赖清单 2 项
{"sdk":"flutter"}{"sdk":"flutter"}先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗