Search packages, repositories and app categories

Package detailsv2.3.0

gif

Control a gif using flutter animation controller. You can either specify a fixed duration or set the framerate of the playback.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
40.6K
Likes
80
Pub points
150

Install package

flutter pub add gif

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The gif package enables precise control over GIF animations in Flutter using an AnimationController. It supports both fixed-duration playback and customizable frame rates, allowing developers to synchronize GIFs with animations or user interactions. The package is compatible across all major platforms, including mobile, web, and desktop, making it ideal for dynamic UI elements that require animated content. It simplifies the integration of GIFs into Flutter apps without requiring native platform code.

Use cases

  • Synchronizing GIFs with animation timelines
  • Creating interactive animated UI components
  • Displaying animated banners or loading indicators
  • Integrating GIFs in cross-platform applications
  • Controlling playback speed dynamically

Key features

  • AnimationController integration
  • Support for fixed duration or frame rate
  • Cross-platform compatibility
  • Simple API for playback control
  • Efficient rendering on all platforms

Suitable for

  • Developers building animated UIs
  • Apps requiring dynamic GIF playback
  • Cross-platform projects with multimedia needs
  • Interactive app components with visual feedback

Considerations

  • May impact performance with large GIFs
  • Requires careful memory management for long-running animations
  • Limited to static GIFs (no support for animated GIFs with complex transitions)
  • Best suited for lightweight animations
  • Not optimized for high-frame-rate or video-like content

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

gif

Overview

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.

Example

Load a gif asynchronously and display a text placeholder during loading.
When the gif is loaded reset the controller and run the gif to the end.

GifController _controller = GifController(vsync: this);

Gif(
    image: AssetImage("images/animate.gif"),
    controller: _controller, // if duration and fps is null, original gif fps will be used.
    //fps: 30,               
    //duration: const Duration(seconds: 3),
    autostart: Autostart.no,
    placeholder: (context) => const Text('Loading...'),
    onFetchCompleted: () {
         _controller.reset();
         _controller.forward();
    },
),

Thanks

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.

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.