FLUTTER ECOSYSTEM

peng8350/flutter_gifimage

GIF 图像小部件,帮助控制 GIF 进度、速度、重复帧

flutter_gifimage 项目封面
Stars
65
Forks
81
最近推送(UTC)
2022年1月20日
项目状态
未归档
Jpeng GitHub avatar
GITHUB User

Jpeng ↗

Flutter && Android && NLP && CV

GDUFSGuangzhou,Guangdong,China
语言DartObjective-CJava

此仓库发布的插件

使用的依赖

依赖清单 1 项
  • flutter{"sdk":"flutter"}

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

flutter_gifimage

We should know that in order to achieve Gif in flutter, we can use Image, but we have no way to manipulate Gif, for example: change its speed, control it has been playing in a frame, in which frame range loop. These problems can be solved by this widget,it also help you contain gif cache,avoid load frame every time.

Screenshots

https://raw.githubusercontent.com/peng8350/flutter_gifimage/HEAD/arts/gif.gif

Usage(Simple)

add in pubspec


     flutter_gifimage: ^1.0.0

simple usage

    GifController controller= GifController(vsync: this);


    GifImage(
         controller: controller,
         image: AssetImage("images/animate.gif"),
    )

list the most common operate in GifController:

// loop from 0 frame to 29 frame
controller.repeat(min:0,max:29,period:Duration(millseconds:300));

// jumpTo thrid frame(index from 0)
controller.value = 0;

// from current frame to 26 frame
controller.animateTo(26);

If you need to preCache gif,try this

// put imageProvider
fetchGif(AssetImage("images/animate.gif"));

Thanks

  • gif_ani (thanks for giving me idea)

License

MIT License

Copyright (c) 2019 Jpeng

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.