motion_widget 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 83

motion_widget #

A simple, powerful widget to build cool transitions. It handles initialization, state changes, code clean-ups and all the other animation boilerplate code, keeping you in the driver's seat by allowing you control the animations at each interval.

Features #

  • Fine-grained control with Interval
  • Lightweight & fully customizable
  • No boilerplate code
  • Works with Row & Column
  • Support for Translate & Fade modes
  • Provides Exit transitions
  • No code clean-up required

Screenshots #

Screenshot

Usage #

Example

To use this plugin :

  • Add the dependency
  dependencies:
    flutter:
      sdk: flutter
    motion_widget:
  • Use the widget as a Row or a Column
Motion<Row>(
    children: <Widget>[]
)
  • Wrap its child with MotionElement
MotionElement(
    interval: Interval(0.3, 0.9)
    mode: MotionMode.FADE
    child: Container()
    orientation: MotionOrientation.LEFT
)
  • Provide exitConfigurations for exit transitions
Motion(
    exitConfigurations: MotionExitConfigurations(
        displacement: 200,
        orientation: MotionOrientation.LEFT,
        durationMs: 400
    )
)

Pull Requests #

All the pull requests are welcomed. Please feel free to make valuable additions in the code.

Created by #

Sumeet Rukeja (LinkedIn)

License #

Copyright 2020 Sumeet Rukeja

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

[1.0.0] - 02 March 2020 #

  • A simple, powerful widget to build cool transitions

[1.0.1] - 02 March 2020 #

  • Updated documentation

[1.0.2] - 07 March 2020 #

  • Updated documentation, optimisations

example/example.dart

import 'package:flutter/material.dart';
import 'package:motion_widget/motion_widget.dart';

class SplashScreen extends StatefulWidget {
  @override
  _SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
  MotionExitConfigurations motionExitConfigurations;

  @override
  void initState() {
    super.initState();

    motionExitConfigurations =
        MotionExitConfigurations(durationMs: 500, displacement: 50);

    Future.delayed(Duration(seconds: 2), () {
      motionExitConfigurations.controller.addStatusListener((status) {
        if (status == AnimationStatus.completed)
          Navigator.pushReplacement(context,
              PageRouteBuilder(pageBuilder: (_, __, ___) => SplashScreen()));
      });
      motionExitConfigurations.controller.forward();
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
            child: Motion<Row>(
              mainAxisSize: MainAxisSize.min,
              exitConfigurations: motionExitConfigurations,
              children: <Widget>[
                MotionElement(
                  child: Text(
                    "Introducing\nMotion Widget",
                    textAlign: TextAlign.center,
                    style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25),
                  ),
                  orientation: MotionOrientation.RIGHT,
                  interval: Interval(0.0, 0.5),
                ),
                SizedBox(
                  width: 20,
                ),
                MotionElement(
                  child: FlutterLogo(size: 50),
                  interval: Interval(0.5, 1.0, curve: Curves.easeOutBack),
                )
              ],
            )));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  motion_widget: ^1.0.2

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:motion_widget/motion_widget.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
70
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • motion_widget that is a package requiring null.

Health suggestions

Fix lib/motion_widget.dart. (-0.50 points)

Analysis of lib/motion_widget.dart reported 1 hint:

line 5 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: Motion.motionController

Maintenance suggestions

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

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