koukibadr / Elegant-Notification

https://pub.dev/packages/elegant_notification
MIT License
46 stars 30 forks source link

Field '_offsetAnimation' has not been initialized. #116

Open redDwarf03 opened 5 months ago

redDwarf03 commented 5 months ago

Hello,

i have an error sometimes when many notifications should be displayed but sorry, i don't find exactly the use case to reproduce it... Here is the version i used and the associated error

Version:

  elegant_notification:
    git:
      url: https://github.com/koukibadr/Elegant-Notification.git
      ref: dev

Error:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following LateError was thrown building ElegantNotification(state:
ElegantNotificationState#83b8e(ticker inactive)):
LateInitializationError: Field '_offsetAnimation' has not been initialized.

The relevant error-causing widget was:
  ElegantNotification

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3       throw_
packages/elegant_notification/elegant_notification.dart 393:26                    get [_offsetAnimation]
packages/elegant_notification/elegant_notification.dart 628:24                    build
koukibadr commented 5 months ago

@redDwarf03 could you please try to reproduce this error and send me more details how you integrated the package

charansoma3001 commented 5 months ago

I also have the same issue, not sure why it's throwing that error, and I'm not finding how to fix it.

koukibadr commented 5 months ago

@charansoma3001 you are using the latest version ?

charansoma3001 commented 5 months ago

Hi @koukibadr, yes I'm using the latest version

koukibadr commented 4 months ago

@charansoma3001 @redDwarf03 I've published a new version check it out

charansoma3001 commented 4 months ago
body: Container(
      color: LavenderPalette.background, // Using lavender background color
      child: Column(
        children: [ 
          const SizedBox(
            height: 8,
          ),
          ElegantNotification(
            toastDuration: const Duration(seconds: 15),
            title: const Text(
              'Finish all 6 questions within this session.',
              style: TextStyle(
                color: LavenderPalette.main_page_text,
              ),
            ),
            description: const Text(
              'On time out, the session will be closed automatically and the final score will be recorded.',
            ),
            icon: const Icon(
              Icons.alarm,
              color: LavenderPalette.main_page_text,
            ),
            progressIndicatorColor: LavenderPalette.main_page_text,
            autoDismiss: true,
            isDismissable: true,
            onProgressFinished: () {
              context.pop(
                ScaffoldMessenger
                .of(context)
                .showSnackBar(
                  const SnackBar(
                    content: Text('Thank you for taking the quiz!')
                  )
                )
              );
            },
          ),
        ],
      ),
    ) 

@koukibadr Am I missing anything in this, or am I including something that conflicts with ElegantNotifications? Cuz it still throws the same error of offset animation not initialised.

https://github.com/koukibadr/Elegant-Notification/assets/55019184/bdca9c24-17a4-415d-9040-82a7285aaef8

koukibadr commented 4 months ago

@charansoma3001 what version are you using ?

charansoma3001 commented 4 months ago

@charansoma3001 what version are you using ?

The one you've just released, 2.1.2, and this is on web platform by the way, not on android...

koukibadr commented 4 months ago

@charansoma3001 I've tried the example you sent on web version, can you provide the output of flutter doctor -v

charansoma3001 commented 4 months ago

Hi @koukibadr, here's the output of flutter doctor -v 👇

[√] Flutter (Channel stable, 3.16.7, on Microsoft Windows [Version 10.0.22631.3447], locale en-IN) • Flutter version 3.16.7 on channel stable at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ef1af02aea (3 months ago), 2024-01-11 15:19:26 -0600 • Engine revision 4a585b7929 • Dart version 3.2.4 • DevTools version 2.28.5

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\Users\chara\AppData\Local\Android\sdk • Platform android-34, build-tools 34.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314) • All Android licenses accepted.

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

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.4) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.8.34408.163 • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2023.1) • Android Studio at C:\Program Files\Android\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 17.0.7+0-b2043.56-10550314)

[√] VS Code (version 1.88.1) • VS Code at C:\Users\chara\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.86.0

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

[√] Network resources • All expected network resources are available.

• No issues found!