一大波Flutter酷炫动画来袭,持续更新。。。

# 前言

实现UI和交互是大前端开发者的必备技能,也是掌握Flutter开发的重点;在下学习Flutter之际,实现了几种客户端上常见的酷炫UI特效,虽说是用Flutter造原生的轮子,但Flutter跨平台的特性是原生不能比拟的,更何况还有不弱的性能表现。本文主要是介绍Flutter hub特效库[flutter_easyHub](https://github.com/ifgyong/flutter_easyHub)的基本情况和使用;

![image](//upload-images.jianshu.io/upload_images/869487-55294fcbccc4edef?imageMogr2/auto-orient/strip|imageView2/2/w/750/format/webp)

## 项目介绍

[flutter_easyHub](https://github.com/ifgyong/flutter_easyHub) 是纯粹的flutter编写,现在支持30中动画,在iOS和android上运行流畅,目前项目已经开发了30种动画,如果你有好的idea,可以及时pr。

### 详细动画


|![image](https://upload-images.jianshu.io/upload_images/783986-a9e0d7417e60b93c.GIF?imageMogr2/auto-orient/strip) default |![image](https://upload-images.jianshu.io/upload_images/783986-4e7785e8dd08aa70.GIF?imageMogr2/auto-orient/strip) CircularProgress|![image](https://upload-images.jianshu.io/upload_images/783986-a5343b8c889380a3.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) showErrorHub| ![image](https://upload-images.jianshu.io/upload_images/783986-63a745f258f8c1da.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) showComplateHub |![image](https://upload-images.jianshu.io/upload_images/783986-8869b1dbc9b08859.GIF?imageMogr2/auto-orient/strip) LineProgress |
|:-:|:-:|:-:|:-:|:-:|
|![image](https://upload-images.jianshu.io/upload_images/783986-7a4d66df9b6357eb.GIF?imageMogr2/auto-orient/strip) CircularProgressEasyOutEasyIn |![image](https://upload-images.jianshu.io/upload_images/783986-bb97fd0ff0271b06.GIF?imageMogr2/auto-orient/strip) CircularProgressEasy |![image](https://upload-images.jianshu.io/upload_images/783986-b75e8e5b0d090a53.GIF?imageMogr2/auto-orient/strip) singleFlipingRect |![image](https://upload-images.jianshu.io/upload_images/783986-bb6e466aee3ba8e5.GIF?imageMogr2/auto-orient/strip) beattingCircle |![image](https://upload-images.jianshu.io/upload_images/783986-fd770aee15427757.GIF?imageMogr2/auto-orient/strip) singlebeattingCircle |
![image](https://upload-images.jianshu.io/upload_images/783986-ae464d80ac6ca605.GIF?imageMogr2/auto-orient/strip) beatingRects |![image](https://upload-images.jianshu.io/upload_images/783986-a122df54bbedb90c.GIF?imageMogr2/auto-orient/strip) rotatingCircles |![image](https://upload-images.jianshu.io/upload_images/783986-1d7c4e4e1456e424.GIF?imageMogr2/auto-orient/strip) rotatingDeformedCircles |![image](https://upload-images.jianshu.io/upload_images/783986-a8a7f0fc0a59f929.GIF?imageMogr2/auto-orient/strip) rotatingTwoRect |![image](https://upload-images.jianshu.io/upload_images/783986-9b1090f836b71dab.GIF?imageMogr2/auto-orient/strip) rotatingTwoCircles |
|![image](https://upload-images.jianshu.io/upload_images/783986-1e3880f4d8eaa2b4.GIF?imageMogr2/auto-orient/strip) foldingRect |![image](https://upload-images.jianshu.io/upload_images/783986-ff35a3aca58dd80a.GIF?imageMogr2/auto-orient/strip) swingingBall |![image](https://upload-images.jianshu.io/upload_images/783986-ebf42d6335338af0.GIF?imageMogr2/auto-orient/strip) waves |![image](https://upload-images.jianshu.io/upload_images/783986-6b0207453476c1fa.GIF?imageMogr2/auto-orient/strip) spitBubbles |![image](https://upload-images.jianshu.io/upload_images/783986-6c2ee6a8a200e361.GIF?imageMogr2/auto-orient/strip) movingCube |
|![image](https://upload-images.jianshu.io/upload_images/783986-1f7f5a239da1ea66.GIF?imageMogr2/auto-orient/strip) rotatingTwoColorBall |![image](https://upload-images.jianshu.io/upload_images/783986-5c3fd52a58aca83b.GIF?imageMogr2/auto-orient/strip) pendulumingBall|![image](https://upload-images.jianshu.io/upload_images/783986-4b9ea6c442459826.GIF?imageMogr2/auto-orient/strip) flashingBalls|![image](https://upload-images.jianshu.io/upload_images/783986-4178988b45bf1c9e.GIF?imageMogr2/auto-orient/strip)fallingBall|![image](https://upload-images.jianshu.io/upload_images/783986-01559e77a95684dd.GIF?imageMogr2/auto-orient/strip)<br>hourglass|
|![image](https://upload-images.jianshu.io/upload_images/783986-588b868a1745a409.GIF?imageMogr2/auto-orient/strip) dancingCube|![image](https://upload-images.jianshu.io/upload_images/783986-669029ebf0321123.GIF?imageMogr2/auto-orient/strip) swingingBall|![image](https://upload-images.jianshu.io/upload_images/783986-4f77a9521516838d.GIF?imageMogr2/auto-orient/strip) creepingBug|

# 如何使用
```
dependencies:
flutter_easyhub: ^0.3.1

```
### 导入文件
```
$ flutter pub get

import 'package:flutter_easyhub/flutter_easyhub.dart';
```
### 初始化

```
EasyHub.getInstance
..setBackgroundColor(Colors.black38)
..setCircleBackgroundColor(Colors.lightGreen)
..setValueColor(new AlwaysStoppedAnimation(Colors.black38));
```

OR

```

EasyHub hub = EasyHub(
circlebackgroundColor: Colors.black38,
circleValueColor: new AlwaysStoppedAnimation(Colors.teal),
background: Colors.black38);
// OR
hub
..setParameter(
background: Colors.black38,
circleValueColor: new AlwaysStoppedAnimation(Colors.black38),
circlebackgroundColor: Colors.lightGreen);
hub.show_hub(
context: context, type: EasyHubType.EasyHub_msg, msg: 'loading');

// 隐藏
hub.dismiss_hub();
// OR
EasyHub.dismiddAll();

```
### 隐藏所有

```
EasyHub.dismiddAll();
```

### 展示文本

```

EasyHub.show(context, 'loading');
```

### 展示HUB

```
EasyHub.showHub(context);

```
### 展示文本 + hub

```
EasyHub.showMsg(context, '加载文字展示');
```


### 展示错误

```
EasyHub.showErrorHub(context, '网络错误');
```
### 展示完成

```
EasyHub.showComplateHub(context, '下载完成');
```

# 更新日志
### 0.3.1 2020.05.12
> 游泳的小球,fix 一些 bug


### 0.3.0 2020.05.11
> 添加跳动的矩形


### 0.2.9 2020.05.11
> 添加正方体移动效果
> 添加魔球旋转效果
> 添加跳舞的4个小球效果
> 添加闪烁的九饼
> 添加掉落的小球动画
> 沙漏动画

### 0.2.3 2020.05.07
> 添加水滴

### 0.2.2 2020.05.06
> 添加波浪动画

### 0.2.1 2020.04.29
> 添加钟摆动画,支持自定义球状半径和颜色

### 0.2.0 2020.04.29
> 添加多种动画

### [0.0.5 -- 0.1.1] 2020.04.24
> 更新备注和read me


### [0.0.3 -- 0.0.4] 2020.04.23
> 1. 增加菊花转,适配android 和iOS
> 2.增加错误和完成显示效果
> 3. 增加实例消失函数

### [0.0.2] 2020.04.21
> 优化文字动画分别展示
> 增加隐藏所有hub

### [0.0.1] 2020.04.20
> 添加浮窗,支持文字、进度条


# 更多效果持续更新,请关注[flutter_easyHub](https://github.com/ifgyong/flutter_easyHub)

posted @ 2020-05-13 15:58  fgyong  阅读(88)  评论(0)    收藏  举报