Elegant-Notification
Elegant-Notification copied to clipboard
animation != AnimationType.fromTop': is not true
full error
E/flutter ( 2884): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:elegant_notification/elegant_notification.dart': Failed assertion: line 167 pos 9: 'animation != AnimationType.fromRight &&
elegant_notification.dart:167
E/flutter ( 2884): animation != AnimationType.fromTop': is not true.
E/flutter ( 2884): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter ( 2884): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter ( 2884): #2 new ElegantNotification.success
elegant_notification.dart:167
E/flutter ( 2884): #3 showAppAddedToast
toasts.dart:38
E/flutter ( 2884): #4 getAllDeviceAppsWidgetRef.<anonymous closure>.<anonymous closure>
get_all_device_apps.dart:97
E/flutter ( 2884): #5 _InkResponseState.handleTap
ink_well.dart:1096
E/flutter ( 2884): #6 GestureRecognizer.invokeCallback
recognizer.dart:253
E/flutter ( 2884): #7 TapGestureRecognizer.handleTapUp
tap.dart:627
E/flutter ( 2884): #8 BaseTapGestureRecognizer._checkUp
tap.dart:306
E/flutter ( 2884): #9 BaseTapGestureRecognizer.acceptGesture
tap.dart:276
E/flutter ( 2884): #10 GestureArenaManager.sweep
arena.dart:163
E/flutter ( 2884): #11 GestureBinding.handleEvent
binding.dart:464
E/flutter ( 2884): #12 GestureBinding.dispatchEvent
binding.dart:440
E/flutter ( 2884): #13 RendererBinding.dispatchEvent
binding.dart:336
E/flutter ( 2884): #14 GestureBinding._handlePointerEventImmediately
binding.dart:395
E/flutter ( 2884): #15 GestureBinding.handlePointerEvent
binding.dart:357
E/flutter ( 2884): #16 GestureBinding._flushPointerEventQueue
binding.dart:314
E/flutter ( 2884): #17 GestureBinding._handlePointerDataPacket
binding.dart:295
E/flutter ( 2884): #18 _invoke1 (dart:ui/hooks.dart:164:13)
E/flutter ( 2884): #19 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:361:7)
E/flutter ( 2884): #20 _dispatchPointerDataPacket (dart:ui/hooks.dart:91:31)
Notification
showAppAddedToast(context, String appName) {
ElegantNotification.success(
toastDuration: const Duration(seconds: 2),
title: const Text("ADDED"),
// on adding this, it shows this error
notificationPosition: NotificationPosition.bottomLeft,
description: Text(
"$appName is added successfully",
),
).show(context);
}
this is causing this, I want to make notification show from bottom left. when I add this the error shows up.
notificationPosition: NotificationPosition.bottomLeft,
version
elegant_notification: ^1.7.0
flutter doctor
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.0, on Microsoft Windows [Version 10.0.19045.2486], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.6)
[√] Android Studio (version 2021.3)
[√] IntelliJ IDEA Community Edition (version 2022.3)
[√] Connected device (4 available)
[!] HTTP Host Availability```
@AbdulSamadgithub do you still get this issue ?
Getting a similar error but mine is "animation != AnimationType.fromBottom': is not true." using elegant_notification: ^1.11.2. This error only happens on iOS devices, android it works fine. My code.
ElegantNotification.error( description: const Text("Please select one or more practitioners to create availability."), autoDismiss: true, toastDuration: const Duration(seconds: 5), notificationPosition: NotificationPosition.bottomCenter, animation: AnimationType.fromBottom, ).show(context);
It appears on iOS you have to add the position property. My code above didn't work, adding the position property matching the notificationPosition and it works fine. No more error and notification displays.
ElegantNotification.error( description: const Text("Please select a location to create practitioner availability."), autoDismiss: true, toastDuration: const Duration(seconds: 5), position: Alignment.bottomCenter, notificationPosition: NotificationPosition.bottomCenter, animation: AnimationType.fromBottom, ).show(context);
@pqthealth
I recommend you migrate to the newer version 1.12.0 and use position
instead of notificationPosition
an example when the assert exception is shown when you create a notification with animation.fromTop
and the position is bottomCenter
.