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

Error: type 'BoxValueConstraints<SliverStickyHeaderState?>' is not a subtype of type 'BoxValueConstraints<SliverStickyHeaderState>' in type cast #62

Closed
amitkot opened this issue Apr 21, 2021 · 4 comments

Comments

@amitkot
Copy link
Contributor

amitkot commented Apr 21, 2021

Getting this error while using SliverStickyHeader:

flutter: type 'BoxValueConstraints<SliverStickyHeaderState?>' is not a subtype of type
flutter: 'BoxValueConstraints<SliverStickyHeaderState>' in type cast
flutter:
flutter: The relevant error-causing widget was:
flutter:   SliverStickyHeader

Using flutter_sticky_header: ^0.6.0.

More log info:

flutter: The following RenderObject was being processed when the exception was fired: _RenderValueLayoutBuilder<SliverStickyHeaderState>#4d71a relayoutBoundary=up4:
flutter:   creator: ValueLayoutBuilder<SliverStickyHeaderState> ← SliverStickyHeader ← ItemsAvailabilitySection
flutter:     ← MultiSliver ← ItemsByAvailability ← SliverOffstage ← Viewport ← IgnorePointer-[GlobalKey#d3e0b]
flutter:     ← Semantics ← Listener ← _GestureSemantics ←
flutter:     RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#aaeef] ← ⋯
flutter:   parentData: paintOffset=Offset(0.0, -0.0) (can use size)
flutter:   constraints: BoxConstraints(w=428.0, 0.0<=h<=Infinity)
flutter:   size: Size(428.0, 56.0)
flutter: This RenderObject had the following descendants (showing up to depth 5):
flutter:     child: RenderPadding#e0f35 relayoutBoundary=up5
flutter:       child: RenderParagraph#27526 relayoutBoundary=up6
flutter:         text: TextSpan
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following _CastError was thrown during performLayout():
flutter: type 'BoxValueConstraints<SliverStickyHeaderState?>' is not a subtype of type
flutter: 'BoxValueConstraints<SliverStickyHeaderState>' in type cast
flutter:
flutter: The relevant error-causing widget was:
flutter:   SliverStickyHeader
flutter:   file:///xxx.dart:19:31
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0      RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1894:72)
flutter: #1      PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:915:15)
flutter: #2      RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1894:14)
flutter: #3      RenderConstrainedLayoutBuilder.rebuildIfNecessary (package:flutter/src/widgets/layout_builder.dart:225:7)
flutter: #4      _RenderValueLayoutBuilder.performLayout (package:value_layout_builder/src/value_layout_builder.dart:101:5)
flutter: #5      RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
flutter: #6      RenderSliverStickyHeader.performLayout (package:flutter_sticky_header/src/rendering/sliver_sticky_header.dart:273:19)
flutter: #7      RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
flutter: #8      RenderMultiSliver.layoutChild (package:sliver_tools/src/rendering/multi_sliver.dart:293:13)
flutter: #9      RenderMultiSliver._layoutChildSequence (package:sliver_tools/src/rendering/multi_sliver.dart:155:31)
flutter: #10     RenderMultiSliver.performLayout (package:sliver_tools/src/rendering/multi_sliver.dart:90:24)
flutter: #11     RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
flutter: #12     RenderSliverOffstage.performLayout (package:flutter/src/rendering/proxy_sliver.dart:316:12)
flutter: #13     RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
flutter: #14     RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:512:13)
flutter: #15     RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1570:12)
flutter: #16     RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1479:20)
flutter: #17     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1641:7)
flutter: #18     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:884:18)
flutter: #19     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:453:19)
flutter: #20     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:874:13)
flutter: #21     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
flutter: #22     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
flutter: #23     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
flutter: #24     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:998:5)
flutter: #28     _invoke (dart:ui/hooks.dart:161:10)
flutter: #29     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:253:5)
flutter: #30     _drawFrame (dart:ui/hooks.dart:120:31)
flutter: (elided 3 frames from dart:async)
@Peng-Qian
Copy link

please fix this type bug

UnderKoen added a commit to UnderKoen/flutter_sticky_header that referenced this issue Jun 16, 2021
…cky header (currently one one inside one other works).

Also solves letsar#62
@yasinarik
Copy link

@UnderKoen already made a PR for this package. I think it should be merged. Until then, if you want to fix this issue (and also want to use multiple slivers as a child):

  1. Go to your project's pubspec.yaml
  # flutter_sticky_header: ^0.6.0 --> Commented this line
  # Added the below lines which basically points to UnderKoen's repo.
  flutter_sticky_header: 
  - git:
  - - url: https://github.com/UnderKoen/flutter_sticky_header

Thanks a lot @UnderKoen!

@prakashjaganathan
Copy link

Multiple sticky headers works fine... but the issue is, click action not working for bottom placed childs... If I scroll up the same child to top, then click action is working fine... can anyone fix this issue?

@letsar
Copy link
Owner

letsar commented Mar 1, 2022

Fixed in 0.6.1, thank you @amitkot

@letsar letsar closed this as completed Mar 1, 2022
cgestes pushed a commit to jotshq/flutter_sticky_header that referenced this issue Apr 7, 2022
…cky header (currently one one inside one other works).

Also solves letsar#62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants