aagarwal1012 / Animated-Text-Kit

🔔 A flutter package to create cool and beautiful text animations. [Flutter Favorite Package]
https://animated-text-kit.web.app
MIT License
1.66k stars 304 forks source link

Crash on hot reload with getPositionForOffset error #259

Closed khangahs closed 3 years ago

khangahs commented 3 years ago

Describe the bug getStack: WipError -32000 Cannot find context with specified id

To Reproduce Code Base:

Flexible(
                      flex: 2,
                      child: SizedBox(
                        height: 100,
                        child: AnimatedTextKit(
                            key: UniqueKey(),
                            repeatForever: true,
                            animatedTexts: [
                              TyperAnimatedText(
                                 'abcd'
                                      .toUpperCase(),
                                  speed: const Duration(milliseconds: 300),
                                  curve: Curves.easeInOut,
                                  textStyle: GoogleFonts.montserrat(
                                      backgroundColor: Colors.amber,
                                      color: Theme.of(context)
                                          .scaffoldBackgroundColor,
                                      fontWeight: FontWeight.bold,
                                      fontSize: Constants.forty * 2)),
                              FadeAnimatedText(
                                  'abcd'
                                      .toUpperCase(),
                                  textStyle: GoogleFonts.montserrat(
                                      color: Theme.of(context)
                                          .textTheme
                                          .bodyText1!
                                          .color,
                                      fontWeight: FontWeight.bold,
                                      fontSize: Constants.forty * 2)),
                            ]),
                      ),
                    ),
  1. Run debug or hot reload
  2. Crash:
    getStack: WipError -32000 Cannot find context with specified id

    text_painter.dart shows up:

    TextPosition getPositionForOffset(Offset offset) {
    assert(!_needsLayout);
    return _paragraph!.getPositionForOffset(offset);
    }

Expected behavior Animation Texts run smoothly without crash.

Flutter: latest stable Web

Dart: latest

khangahs commented 3 years ago

I'm using this with google_fonts package to style the texts. However, when I remove the package and implement the default way of changing fonts, the error disappears! I might investigate further.

khangahs commented 3 years ago

Seems like its the incompatible widget layout of google_fonts, I will close this issue thereof.

SirusCodes commented 3 years ago

Seems like its the incompatible widget layout of google_fonts, I will close this issue thereof.

Are you sure about it?

khangahs commented 3 years ago

Yes, I am sure. When I turn off the google_fonts widget, the error disappears and animated_text_kits widgets display properly.

On Fri, Jun 18, 2021 at 7:18 AM Darshan Rander @.***> wrote:

Seems like its the incompatible widget layout of google_fonts, I will close this issue thereof.

Are you sure about it?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/aagarwal1012/Animated-Text-Kit/issues/259#issuecomment-863641392, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUNRXMBV6ZTTSJEQ33H7BTTTKGFRANCNFSM46UYZEQA .