MarcelGarus / marquee

A Flutter widget that scrolls text infinitely. Provides many customizations including custom scroll directions and velocities, pausing after every round and specifying custom durations and curves for accelerating and decelerating.
MIT License
274 stars 113 forks source link

Error when wrapping the widget with "SelectionArea" #89

Open reza00farjam opened 1 year ago

reza00farjam commented 1 year ago

Hi, thanks for this great package.

Faced an issue when wrapping a Marquee widget with a SelectionArea widget. It results in following error:

The following TypeErrorImpl was thrown building Marquee(dirty, dependencies: [DefaultSelectionStyle,
DefaultTextStyle, MediaQuery, SelectionRegistrarScope], state: _MarqueeState#0b2e1):
Expected a value of type 'RichText', but got one of type 'MouseRegion'

The relevant error-causing widget was:
  Marquee

Stack:

dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49      throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 99:3        castError
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 485:10  cast
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart 638:14     as_C
packages/marquee/marquee.dart 690:59                                              [_getTextWidth]
packages/marquee/marquee.dart 578:48                                              [_initialize]
packages/marquee/marquee.dart 704:5                                               build
packages/flutter/src/widgets/framework.dart 5080:27                               build
packages/flutter/src/widgets/framework.dart 4968:15                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 6377:14                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 6512:36                               inflateWidget
packages/flutter/src/widgets/framework.dart 6524:32                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 6512:36                               inflateWidget
packages/flutter/src/widgets/framework.dart 6524:32                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 6512:36                               inflateWidget
packages/flutter/src/widgets/framework.dart 6524:32                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 6377:14                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 6512:36                               inflateWidget
packages/flutter/src/widgets/framework.dart 6524:32                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 6377:14                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 6512:36                               inflateWidget
packages/flutter/src/widgets/framework.dart 6524:32                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 6377:14                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 6377:14                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 6377:14                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 6377:14                               mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 5133:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5124:11                               [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/framework.dart 4993:16                               performRebuild
packages/flutter/src/widgets/framework.dart 4690:5                                rebuild
packages/flutter/src/widgets/framework.dart 4950:5                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 4944:5                                mount
packages/flutter/src/widgets/framework.dart 3953:15                               inflateWidget
packages/flutter/src/widgets/framework.dart 3682:18                               updateChild
packages/flutter/src/widgets/sliver.dart 1451:37                                  updateChild
packages/flutter/src/widgets/sliver.dart 1436:20                                  <fn>
packages/flutter/src/widgets/framework.dart 2682:19                               buildScope
packages/flutter/src/widgets/sliver.dart 1428:5                                   createChild
packages/flutter/src/rendering/sliver_multi_box_adaptor.dart 353:23               <fn>
packages/flutter/src/rendering/object.dart 2300:59                                <fn>
packages/flutter/src/rendering/object.dart 1056:15
[_enableMutationsToDirtySubtrees]
packages/flutter/src/rendering/object.dart 2300:7                                 invokeLayoutCallback
packages/flutter/src/rendering/sliver_multi_box_adaptor.dart 342:5                [_createOrObtainChild]
packages/flutter/src/rendering/sliver_multi_box_adaptor.dart 490:5                insertAndLayoutChild
packages/flutter/src/rendering/sliver_fixed_extent_list.dart 250:17               performLayout
packages/flutter/src/rendering/object.dart 2189:7                                 layout
packages/flutter/src/rendering/sliver_padding.dart 149:5                          performLayout
packages/flutter/src/widgets/sliver_fill.dart 166:11                              performLayout
packages/flutter/src/rendering/object.dart 2189:7                                 layout
packages/flutter/src/rendering/viewport.dart 550:12                               layoutChildSequence
packages/flutter/src/rendering/viewport.dart 1634:12                              [_attemptLayout]
packages/flutter/src/rendering/viewport.dart 1541:20                              performLayout
packages/flutter/src/rendering/object.dart 2027:7                                 [_layoutWithoutResize]
packages/flutter/src/rendering/object.dart 1020:17                                flushLayout
packages/flutter/src/rendering/binding.dart 516:19                                drawFrame
packages/flutter/src/widgets/binding.dart 865:13                                  drawFrame
packages/flutter/src/rendering/binding.dart 381:5
[_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1289:15                               [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1218:9                                handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1076:5                                [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1168:13                               invoke
lib/_engine/engine/platform_dispatcher.dart 218:5                                 invokeOnDrawFrame
lib/_engine/engine/initialization.dart 190:45                                     <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39  dcall
philippbeck commented 7 months ago

I have the same problem in flutter web.

philipd97 commented 1 month ago

Have the same problem. For temporary solution, may wrap the marquees widget with SelectionContainer.disabled() widget.

SelectionContainer.disabled(
 child: Marquee(
    text: 'sample text',
  ),
)

For more info - https://api.flutter.dev/flutter/widgets/SelectableRegion-class.html