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

Click listener throws an assert error #451

Open
ngoc-quoc-huynh opened this issue Feb 2, 2025 · 0 comments
Open

Click listener throws an assert error #451

ngoc-quoc-huynh opened this issue Feb 2, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@ngoc-quoc-huynh
Copy link

Description

Creating a click listener in Rive and using it in Flutter results in the error below, although the animation works fine.

======== Exception caught by gesture library =======================================================
The following assertion was thrown while dispatching a pointer event:
'package:flutter/src/gestures/multidrag.dart': Failed assertion: line 254 pos 12: '!_pointers!.containsKey(event.pointer)': is not true.


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.yml

When the exception was thrown, this was the stack: 
#2      MultiDragGestureRecognizer.addAllowedPointer (package:flutter/src/gestures/multidrag.dart:254:12)
#3      GestureRecognizer.addPointer (package:flutter/src/gestures/recognizer.dart:254:7)
#4      RiveRenderObject.handleEvent.<anonymous closure> (package:rive/src/rive.dart:286:23)
#5      RiveRenderObject._hitHelper (package:rive/src/rive.dart:213:15)
#6      RiveRenderObject.handleEvent (package:rive/src/rive.dart:282:7)
#7      GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:482:22)
#8      RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:457:11)
#9      GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:427:7)
#10     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:390:5)
#11     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:337:7)
#12     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:306:9)
#13     _invoke1 (dart:ui/hooks.dart:328:13)
#14     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:450:7)
#15     _dispatchPointerDataPacket (dart:ui/hooks.dart:262:31)
(elided 2 frames from class _AssertionError)
Event: PointerDownEvent#32cb6(position: Offset(211.8, 377.9))
  position: Offset(211.8, 377.9)
Target: RiveRenderObject#c8232
  parentData: offset=Offset(0.0, 0.0) (can use size)
  constraints: BoxConstraints(0.0<=w<=392.7, 0.0<=h<=781.1)
  size: Size(392.7, 781.1)
====================================================================================================

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create a new flutter project
  2. Add rive 0.13.20 as dependency
  3. Add the test.riv to the assets
  4. Run the following flutter app
void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Rive Click Example"),
        ),
        body: Center(
          child: RiveAnimation.asset(
            'assets/test.riv',
            onInit: _onInit,
            stateMachines: ['State Machine'],
          ),
        ),
      ),
    );
  }

  void _onInit(Artboard artboard) {
    final controller =
        StateMachineController.fromArtboard(artboard, 'State Machine')!;
    artboard.addController(controller);
  }
}
  1. Click on the artboard
  2. Receive an error in the terminal

Source .riv/.rev file

Archiv.zip

Expected behavior

No error should be thrown.

Device & Versions (please complete the following information)

  • Device: Xiaomi Mi 12 Lite
  • OS: Android SDK API Level 34
Flutter 3.27.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 17025dd882 (vor 7 Wochen) • 2024-12-17 03:23:09 +0900
Engine • revision cb4b5fff73
Tools • Dart 3.6.0 • DevTools 2.40.2
@ngoc-quoc-huynh ngoc-quoc-huynh added the bug Something isn't working label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant