GithubHelp home page GithubHelp logo

florent37 / animatedwidgets Goto Github PK

View Code? Open in Web Editor NEW
112.0 6.0 18.0 4.95 MB

Easily add animations on your screen with AnimatedWidgets. Made for Bloc pattern

Home Page: https://pub.dev/packages/animated_widgets

License: Apache License 2.0

Kotlin 0.59% Ruby 3.63% Swift 0.66% Objective-C 0.06% Dart 93.84% Shell 1.23%
flutter dart stateless stateful anim animation controller translation alpha rotation

animatedwidgets's People

Contributors

azielman avatar florent37 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

animatedwidgets's Issues

GestureDetector‘s onTap is always fired

Hi, I wrap ScaleAnimationWidget in a GestureDetector,

GestureDetector(
                    child: ScaleAnimatedWidget.tween(
                      enabled: _enbaleScale,
                      duration: Duration(milliseconds: 1000),
                      scaleDisabled: 1,
                      scaleEnabled: 1.4,
                      child: ExtendedImage.asset(
                        'assets/test.png',
                        width: 200,
                        height: 200,
                      ),
                    ),
                    onTap: getRecommendImage,
                  ),

getRecommendImage is Future.

In order to enable the animation to repeat forward and reverse, I use a timer to set.

bool _enbaleScale = true;

  @override
  void initState() {
    Timer.periodic(const Duration(seconds: 1), (timer) {
      setState(() {
        _enbaleScale = !_enbaleScale;
      });
    });

    super.initState();
  }

When I run the app, the GestureDetector‘s onTap is always fired, can anyone help? Thx.

TranslationAnimatedWidget bugs

animationFinished callback in your code is

..addStatusListener((status) {
        if (widget.animationFinished != null) {
          widget.animationFinished!(widget.enabled);
        }
      });

and it should be:

..addStatusListener((status) {
        if (status == AnimationStatus.completed) {
          if (widget.animationFinished != null) {
            widget.animationFinished!(widget.enabled);
          }
        }
      });

pls fix it

and others animations had same problems too

RotationAnimatedWidget.tween only works for the first enabled switch

My code

RotationAnimatedWidget.tween(
          enabled: userOwesFriend,
          duration: Duration(milliseconds: 250),
          rotationDisabled: Rotation.deg(z: 0),
          rotationEnabled: Rotation.deg(z: 180, x: 180),
          curve: Curves.easeOut,
          child: IconButton(
            color: userOwesFriend
                ? Colors.redAccent
                : Theme.of(context).primaryColor,
            icon: Icon(Icons.swap_horizontal_circle),
            enableFeedback: true,
            tooltip: "Tap to change who owes who",
            highlightColor: Colors.transparent,
            splashColor: Colors.transparent,
            onPressed: () {
              setState(() {
                userOwesFriend = !userOwesFriend;
              });
            },
          ),
        ),

It works perfectly well for the first onPress event, the rotation is perfect. But, after this first onPress the animation never returns to the rotationDisabled state. Package does exactly what I need if that can be resolved so thanks for making it!

Autostart

Great package!.. Thanks a lot.
Just one question.. there is a way to autostart the animation?

Set 'enabled: true' does not work..

Thanks

ShakeAnimatedWidget Reset

ShakeAnimatedWidget doesn't switch back to initial position if the bool switch went back to false.

The widget sometimes stops in a random angle.

TranslationAnimatedWidget.tween direction

First all I would like to say your package makes using animations a lot easier!

I am using TranslationAnimatedWidget.tween to stagger a list of items in a row.
It works fine but the movement is to slide from the bottom upwards. It is possible to change to the direction so that is slides from left to right?

Update:
Sorry I have changed my code and used an OpacityAnimatedWidget instead, so no need to reply to this issue.

AnimatedWidgets library calling using AnimationController methods after dispose

I'm using CustomAnimatedWidget. However, sometimes a frame-drop occurs and the app throws an exception saying that the AnimationController methods should not be used after calling dispose. The error originates in the library. Hoping to see a fix soon!

Code:

CustomAnimatedWidget(
      enabled: _isVisible,
      duration: Duration(milliseconds: 300),
      curve: Curves.easeOut,
      builder: (context, percent) {
        final double animatedScale = 1 * percent;
        final double animatedOpacity = 1 * percent;
        final double animatedClipHeightFactor = 0.7 + 0.3 * percent;

        return Transform.scale(
          scale: animatedScale,
          alignment: Alignment.center,
          child: ...
        );
      },
      animationFinished: (bool smthn) {
        Debugging.log("animation finished");
      },
    );

Error trace:

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: 'package:flutter/src/animation/animation_controller.dart': Failed assertion: line 455 pos 7: '_ticker != null': AnimationController.forward() called after AnimationController.dispose()
AnimationController methods should not be used after calling dispose.
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
#2 AnimationController.forward
package:flutter/…/animation/animation_controller.dart:455
#3 _CustomAnimatedWidget._updateAnimationState
package:animated_widgets/widgets/custom_animated.dart:65

#4 _CustomAnimatedWidget.didUpdateWidget
package:animated_widgets/widgets/custom_animated.dart:52
#5 StatefulElement.update
package:flutter/…/widgets/framework.dart:4690
#6 Element.updateChild
package:flutter/…/widgets/framework.dart:3201
#7 ComponentElement.performRebuild <…>

Change values without redrawing widget

Is there anyway to change the animation property values mid animation without actually redrawing the widget and its child?

for instance, I'm using ShakeAnimatedWidget and I'd like to change duration and shakeAngle while the animation is already in place.

Is there anyway to achieve this?

RotationAnimatedWidget is not working (disable) and strucked

i had use this widget on flutter web

flutter doctor :

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1110], locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Build Tools 2017 15.9.36)
    X Visual Studio 2019 or later is required.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.59.0)
[√] Connected device (3 available)


flutter -v log :

PS C:\Users\ASUS\Desktop\work_space\flutter_project\flutter client projects\aman_gupta_website> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1110], locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    X Android license status unknown.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Build Tools 2017 15.9.36)
    X Visual Studio 2019 or later is required.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.59.0)
PS C:\Users\ASUS\Desktop\work_space\flutter_project\flutter client projects\aman_gupta_website> flutter doctor -v
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1110], locale en-IN)
    • Flutter version 2.2.3 at C:\flutter
    • Framework revision f4abaa0735 (5 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) 
    • Android SDK at C:\Users\ASUS\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\android-studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop for Windows (Visual Studio Build Tools 2017 15.9.36)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
    • Visual Studio Build Tools 2017 version 15.9.28307.1525
    • Windows 10 SDK version 10.0.17763.0
    X Visual Studio 2019 or later is required.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\android-studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.59.0)
    • VS Code at C:\Users\ASUS\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.25.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.1110]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 92.0.4515.131
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 92.0.902.62

image

after pressing button
image

code i useded


  InkWell(
                      onTap: () {
                        print("updating");

                        isanimated ? isanimated = false : isanimated = true;
                        setState(() {});
                      },
                      child: RotationAnimatedWidget.tween(
                        enabled: isanimated,
                        curve: Curves.linear,
                        delay: Duration(microseconds: 10),
                        // rotationDisabled: Rotation.deg(y: 200),
                        // rotationEnabled: Rotation.radians(y: 10),
                        rotationDisabled: Rotation.deg(),
                        rotationEnabled: Rotation.deg(z: 90, x: 80),
                        child: Image.asset(CustomImg.splashplant),
                      ),
                    ),

the issue is the when changing the bool value the first time it was working but after the reverse is not working

plz help me
thank you

Kotlin Gradle Build issue

FAILURE: Build failed with an exception.

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
    The following dependencies do not satisfy the required version:
    project ':animated_widgets' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.