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

Critical: 'package:flutter/src/rendering/sliver_fixed_extent_list.dart': Failed assertion: line 270 pos 12: 'firstIndex == 0 || childScrollOffset(firstChild!)! - scrollOffset <= precisionErrorTolerance': is not true. #419

Open
EArminjon opened this issue Sep 13, 2023 · 4 comments

Comments

@EArminjon
Copy link

EArminjon commented Sep 13, 2023

flutter 3.7.12
carousel_slider: ^4.2.1

Reproduction step : Click on this carousel example and see console log.

final CarouselController _controller = CarouselController();

GestureDetector(
  onTap: () {
     _controller.animateToPage(2);
  },
  child: AbsorbPointer(
    absorbing: true,
    child: CarouselSlider.builder(
      carouselController: _controller,
      options: CarouselOptions(
        viewportFraction: 1,
        enableInfiniteScroll: true,
        disableCenter: true,
      ),
      itemCount: 5,
      itemBuilder: (BuildContext context, int index, int realIndex) {
        return const SizedBox.square(
          dimension: 100,
          child: Center(child: Text("test")),
        );
      },
    ),
  ),
),
======== Exception caught by rendering library =====================================================
The following assertion was thrown during performLayout():
'package:flutter/src/rendering/sliver_fixed_extent_list.dart': Failed assertion: line 270 pos 12: 'firstIndex == 0 || childScrollOffset(firstChild!)! - scrollOffset <= precisionErrorTolerance': 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.md

The relevant error-causing widget was: 
  CarouselSlider CarouselSlider:file:///Users/earminjon/Documents/projects/flutter/medias/carousel.dart:92:39
When the exception was thrown, this was the stack: 
#2      RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:270:12)
#3      RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#4      RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:149:12)
#5      _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver_fill.dart:166:11)
#6      RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#7      RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:550:13)
#8      RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1634:12)
#9      RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1541:20)
#10     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2027:7)
#11     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1020:18)
#12     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:516:19)
#13     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:865:13)
#14     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:381:5)
#15     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1289:15)
#16     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1218:9)
#17     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1076:5)
#18     _invoke (dart:ui/hooks.dart:145:13)
#19     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:338:5)
#20     _drawFrame (dart:ui/hooks.dart:112:31)
(elided 2 frames from class _AssertionError)
The following RenderObject was being processed when the exception was fired: RenderSliverFillViewport#16fd8 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE
...  needs compositing
...  parentData: paintOffset=Offset(0.0, 0.0) (can use size)
...  constraints: SliverConstraints(AxisDirection.right, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 4114697.1, remainingPaintExtent: 411.4, crossAxisExtent: 231.4, crossAxisDirection: AxisDirection.down, viewportMainAxisExtent: 411.4, remainingCacheExtent: 411.4, cacheOrigin: 0.0)
...  geometry: SliverGeometry(scrollExtent: Infinity, paintExtent: 411.4, maxPaintExtent: Infinity, hasVisualOverflow: true, cacheExtent: 411.4)
...    scrollExtent: Infinity
...    paintExtent: 411.4
...    maxPaintExtent: Infinity
...    hasVisualOverflow: true
...    cacheExtent: 411.4
...  currently live children: 10001 to 10001
RenderObject: RenderSliverFillViewport#16fd8 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE
  needs compositing
  parentData: paintOffset=Offset(0.0, 0.0) (can use size)
  constraints: SliverConstraints(AxisDirection.right, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 4114697.1, remainingPaintExtent: 411.4, crossAxisExtent: 231.4, crossAxisDirection: AxisDirection.down, viewportMainAxisExtent: 411.4, remainingCacheExtent: 411.4, cacheOrigin: 0.0)
  geometry: SliverGeometry(scrollExtent: Infinity, paintExtent: 411.4, maxPaintExtent: Infinity, hasVisualOverflow: true, cacheExtent: 411.4)
    scrollExtent: Infinity
    paintExtent: 411.4
    maxPaintExtent: Infinity
    hasVisualOverflow: true
    cacheExtent: 411.4
  currently live children: 10001 to 10001
...  child with index 10001: RenderIndexedSemantics#b2383
...    needs compositing
...    parentData: index=10001; layoutOffset=4114697.1
...    constraints: BoxConstraints(w=411.4, h=231.4)
...    size: Size(411.4, 231.4)
...    index: 10001
...    child: RenderRepaintBoundary#34957
...      needs compositing
...      parentData: <none> (can use size)
...      constraints: BoxConstraints(w=411.4, h=231.4)
...      layer: OffsetLayer#0e70d
...        engine layer: OffsetEngineLayer#e768f
...        handles: 2
...        offset: Offset(91.4, 0.0)
...      size: Size(411.4, 231.4)
...      metrics: 80.0% useful (1 bad vs 4 good)
...      diagnosis: this is a useful repaint boundary and should be kept
...      child: RenderTransform#7e70b
...        parentData: <none> (can use size)
...        constraints: BoxConstraints(w=411.4, h=231.4)
...        size: Size(411.4, 231.4)
...        transform matrix: [0] 1.0,0.0,0.0,0.0
[1] 0.0,1.0,0.0,0.0
[2] 0.0,0.0,1.0,0.0
[3] 0.0,0.0,0.0,1.0
...        origin: null
...        alignment: Alignment.center
...        textDirection: ltr
...        transformHitTests: true
...        child: RenderConstrainedBox#9a23d
...          parentData: <none> (can use size)
...          constraints: BoxConstraints(w=411.4, h=231.4)
...          size: Size(411.4, 231.4)
...          additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=231.4)
====================================================================================================
@SeriousMonk
Copy link

Same here

@WilliamKose
Copy link

Yep, I'm with the same problem

@hamidput
Copy link

hamidput commented Feb 16, 2024

same here......Any one is there is there solution for it.

@PardeepKumar816
Copy link

any one find solution for this......

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