flutter_animated 0.0.4

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 #

[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'),
//         ),
//       ),
//     );
//   }
// }

Use this package as a library

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 pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub 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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
27
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
14
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Admin