Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WavyAnimatedTextKit crash on page load. #125

Closed
hashem78 opened this issue Oct 14, 2020 · 4 comments · Fixed by #126
Closed

WavyAnimatedTextKit crash on page load. #125

hashem78 opened this issue Oct 14, 2020 · 4 comments · Fixed by #126

Comments

@hashem78
Copy link

hashem78 commented Oct 14, 2020

Description
Crash on page load with NestedScrollView and SliverAppBar
To Reproduce
Steps to reproduce the behavior:
--> See error

Expected behavior
Animation should start without a crash but instead crashes and then starts.

flutter doctor -v

**[✓] Flutter (Channel beta, 1.22.0-13.0.pre.1, on Linux, locale en_US.UTF-8)
• Flutter version 1.22.0-13.0.pre.1 at /home/mythi/snap/flutter/common/flutter
• Framework revision 89244148cd (18 hours ago), 2020-10-13 22:25:05 +0300
• Engine revision 75bef9f6c8
• Dart version 2.10.1

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/mythi/Android
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = /home/mythi/Android
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01)
• All Android licenses accepted.

Additional context

NestedScrollView(
        headerSliverBuilder: (_, __) {
          return <Widget>[
            SliverAppBar(
              expandedHeight: 20,
              primary: true,
              elevation: 0,
              backgroundColor: kausBlue,
              title: Container(
                width: 40,
                height: 30,
                child: WavyAnimatedTextKit(
                  speed: Duration(milliseconds: 200),
                  isRepeatingAnimation: true,
                  text: ["Explore..."],
                  textStyle:
                      TextStyle(fontSize: 32.0, fontWeight: FontWeight.bold),
                ),
              ),
              centerTitle: true,
              actions: [
                Hero(
                  tag: "auFlag",
                  child: Image.asset('assests/images/au.png'),
                ),
              ],
            ),
          ];
        },
Error/Crash log:

════════ Exception caught by widgets library ═══════════════════════════════════
The following NoSuchMethodError was thrown building AnimatedBuilder(animation: AnimationController#e63f3(▶ 0.034), dependencies: [MediaQuery], state: _AnimatedState#34271):
The method '-' was called on null.
Receiver: null
Tried calling: -(null)

The relevant error-causing widget was
    WavyAnimatedTextKit 
lib/widgets/sized_tile.dart:121
When the exception was thrown, this was the stack
#0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:51:5))
#1      _WTextPainter.calculateMove 
package:animated_text_kit/src/wavy.dart:236
#2      _WTextPainter.shouldRepaint 
package:animated_text_kit/src/wavy.dart:228
#3      RenderCustomPaint._didUpdatePainter 
package:flutter/…/rendering/custom_paint.dart:440
#4      RenderCustomPaint.foregroundPainter= 
package:flutter/…/rendering/custom_paint.dart:430
...
════════════════════════════════════════════════════════════════════════════════

@awhitford
Copy link
Collaborator

Looks like percent or txtInMoInd is null? Why are these static?

void calculateMove() {
double height = _textLayoutInfo[0].height;
double _percent = percent - txtInMoInd;
int txtInMoOdd = (percent - .5).floor();
int txtInMoEven = txtInMoInd * 2;

@hashem78
Copy link
Author

Looks like percent or txtInMoInd is null? Why are these static?

void calculateMove() {
double height = _textLayoutInfo[0].height;
double _percent = percent - txtInMoInd;
int txtInMoOdd = (percent - .5).floor();
int txtInMoEven = txtInMoInd * 2;

Not sure, I spent an hour looking into it yesterday but it totally went over my head that the mentioned method in the error is operator-.

You got any idea what these values represent? I could be using some kind of widget that's messing with the values or something of sort.

@SirusCodes
Copy link
Collaborator

Looks like percent or txtInMoInd is null? Why are these static?

void calculateMove() {
double height = _textLayoutInfo[0].height;
double _percent = percent - txtInMoInd;
int txtInMoOdd = (percent - .5).floor();
int txtInMoEven = txtInMoInd * 2;

It was set static because every time shouldRepaint was called and percent is set in paint I'm working it...

@SirusCodes
Copy link
Collaborator

@awhitford I have created a PR #126 by removing the use of static fields this should solve the problem I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants