flutter_animated 0.0.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 68

flutter_animated

Animated images (GIF/APNG/WebP) support in flutter.

The plugin is under construction.

It lacks of basic features, and has got a number of serious issues.

USAGE

require it

in pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  flutter_animated: any

basic usage

// import
import 'flutter_animated/animated_gif.dart';

// fetch a gif
final Uint8List imgBytes = await http.readBytes('https://some.site/some.gif');

// generate a Widget for the gif
final Widget gifWidget = new AnimatedGif.memory(imgBytes);

NOTES

Currently the only format being supported is gif and the only constructor is .memory.

AnimatedGif inherits from Image and StatefulWidget. This may change in the future though.

The performance is way not ideal for now. The good news is, it shows the first frame while decoding.

TODO

  • POOR PERFORMANCE it takes seconds to decode large images
    • checkout low level ImageProvider, ImageStream, RawImage, etc.
    • or use the platform for high performance
      • android
        • android.graphics.Movie
        • https://github.com/bumptech/glide
        • https://github.com/koral--/android-gif-drawable
      • ios
        • https://github.com/Flipboard/FLAnimatedImage
        • https://github.com/ibireme/YYImage
  • BUG malfunctioning alpha composition
  • method to set speed/FPS
  • method to controll play/pause
  • method to set forward/reverse
  • support input more than UInt8List
    • asset path, url, etc.
  • support more formats like APNG and WebP
  • proper testing
  • proper example
  • proper annotation and doc generating

[0.0.1] - 2017 Jun 5.

Added

  • provided a simple AnimatedGif class

[0.0.2] - 2017 Jun 13.

Fixed

  • avoid freezing via an isolate

[0.0.3] - 2017 Jun 14.

Changed

  • change default constructor to named constrctor .memory

[0.0.4] - 2017 Jun 20.

  • minor improvements.

example/lib/main.dart

// UNDER CONSTRUCTION

// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
// import 'package:flutter_animated/flutter_animated.dart';

// void main() {
//   runApp(new MyApp());
// }

// class MyApp extends StatefulWidget {
//   @override
//   _MyAppState createState() => new _MyAppState();
// }

// class _MyAppState extends State<MyApp> {
//   String _platformVersion = 'Unknown';

//   @override
//   initState() {
//     super.initState();
//     initPlatformState();
//   }

//   // Platform messages are asynchronous, so we initialize in an async method.
//   initPlatformState() async {
//     String platformVersion;
//     // Platform messages may fail, so we use a try/catch PlatformException.
//     try {
//       platformVersion = await FlutterAnimated.platformVersion;
//     } on PlatformException {
//       platformVersion = 'Failed to get platform version.';
//     }

//     // If the widget was removed from the tree while the asynchronous platform
//     // message was in flight, we want to discard the reply rather than calling
//     // setState to update our non-existent appearance.
//     if (!mounted)
//       return;

//     setState(() {
//       _platformVersion = platformVersion;
//     });
//   }

//   @override
//   Widget build(BuildContext context) {
//     return new MaterialApp(
//       home: new Scaffold(
//         appBar: new AppBar(
//           title: new Text('Plugin example app'),
//         ),
//         body: new Center(
//           child: new Text('Running on: $_platformVersion\n'),
//         ),
//       ),
//     );
//   }
// }

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_animated: "^0.0.4"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_animated/animated_gif.dart';

import 'package:flutter_animated/gif_parser.dart';
        
Version Uploaded Documentation Archive
0.0.4 Jun 20, 2017 Go to the documentation of flutter_animated 0.0.4 Download flutter_animated 0.0.4 archive
0.0.3 Jun 14, 2017 Go to the documentation of flutter_animated 0.0.3 Download flutter_animated 0.0.3 archive
0.0.2 Jun 13, 2017 Go to the documentation of flutter_animated 0.0.2 Download flutter_animated 0.0.2 archive
0.0.1 Jun 12, 2017 Go to the documentation of flutter_animated 0.0.1 Download flutter_animated 0.0.1 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6
  • Flutter: 0.3.2

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
39 / 100
Health:
Code health derived from static analysis. [more]
97 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95 / 100
Overall score:
Weighted score of the above. [more]
68
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Use constrained dependencies.

    The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: image.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 hints.

    Run flutter format to format lib/animated_gif.dart.

    Run flutter format to format lib/gif_parser.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
image any 1.1.31
Transitive dependencies
archive 1.0.33
args 1.4.2
browser 0.10.0+3
charcode 1.1.1
collection 1.14.6 1.14.9
convert 2.0.1
crypto 2.0.2+1
matcher 0.12.2
meta 1.1.2
path 1.5.1
petitparser 1.7.6
sky_engine 0.0.99
stack_trace 1.9.2
typed_data 1.1.5
vector_math 2.0.6
xml 3.0.0