explosion_animation 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

Explode Animation #

A Flutter package to create widgets with exploding animation. Currently two types of animations are supported. More will be added in future. Pull Requests are welcome.

Note : If you don't provide a list of colors then the PalleteGenerator package will be used which may take a lot of time to extract colors from a high resolution image.

Installation #

First, add explosion_animation as a dependency in your pubspec.yaml file.

No configuration required - the plugin should work out of the box.

Demo #

Animation Type Spread

[1.0.3] #

updated GIF and dependencies

[1.0.2] #

updated README.md

[1.0.1] #

Added example code

[1.0.0] #

Initial Version

example/lib/main.dart

import 'dart:io';
import 'package:image_picker/image_picker.dart';
import 'package:flutter/material.dart';
import 'package:explosion_animation/explosion_animation.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Home(),
    );
  }
}
class Home extends StatelessWidget{
  String number;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
              keyboardType: TextInputType.number,
              textAlign: TextAlign.center,
              onChanged: (str){
                number = str;
              },
              decoration: InputDecoration(
                hintText: "Number Of particles",
              ),
            ),
            MaterialButton(
                color: Colors.red,
                padding: EdgeInsets.fromLTRB(30, 5, 30, 5),
                child: Text("Pick An Image"),
                onPressed: (){
              getImage(context);
            }),
          ],
        ),
      ),
    );
  }
  getImage(BuildContext context)async{
    File img = await ImagePicker.pickImage(source: ImageSource.gallery);
    Navigator.push(context, MaterialPageRoute(builder: (c)=>MyHomePage(file: img,number:number == null ?100:int.parse(number))));
  }
}
var key = Explode.getKey();
class MyHomePage extends StatefulWidget {
  final File file;
  final int number;
  MyHomePage({Key key, this.title,this.file,this.number}) : super(key: key);
  final String title;
  @override
  _MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
      body: Center(
        child: Container(
          child: InkWell(
            onTap: (){
              key.currentState.explode();
            },
            child: Explode(
              key: key,
              size: MediaQuery.of(context).size,
              fit: BoxFit.cover,
              particleCount: widget.number ?? 100,
              path: widget.file.path,
              type: ExplodeType.Spread,
              isAsset: false,
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  explosion_animation: ^1.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [explosion_animation] that is in a package requiring null.

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:explosion_animation/explosion_animation.dartdart:io

Health suggestions

Format lib/explosion_animation.dart.

Run flutter format to format lib/explosion_animation.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
palette_generator ^0.2.2 0.2.3
vector_math ^2.0.8 2.0.8
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
path 1.7.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
Dev dependencies
flutter_test