serenader2014 / flutter_carousel_slider

A flutter carousel widget, support infinite scroll, and custom child widget.
https://pub.dev/packages/carousel_slider
MIT License
1.6k stars 582 forks source link

enlargeCenterPage: true causes #256

Open Ludonope opened 3 years ago

Ludonope commented 3 years ago

Using the null safe 4.0.0-nullsafety.0 version, I tried to use enlargeCenterPage: true and got the following error:

ScrollPosition.minScrollExtent (/Users/ludonope/Code/flutter/packages/flutter/lib/src/widgets/scroll_position.dart:134)
_PagePosition.page (/Users/ludonope/Code/flutter/packages/flutter/lib/src/widgets/page_view.dart:386)
PageController.page (/Users/ludonope/Code/flutter/packages/flutter/lib/src/widgets/page_view.dart:179)
CarouselSliderState.build.<anonymous closure>.<anonymous closure> (/Users/ludonope/Code/flutter/.pub-cache/hosted/pub.dartlang.org/carousel_slider-4.0.0-nullsafety.0/lib/carousel_slider.dart:299)
...

In scroll_position.dart it tries to call minScrollExtent which is null.

Settings enlargeCenterPage: false removes the exception.

Tell me if you need more details :)

radheyjat commented 3 years ago

Same error occured is there any way to resolve this issue

`The following _CastError was thrown building AnimatedBuilder(animation: PageController#faf09(one client, offset 0.0), dirty, state: _AnimatedState#1745d): Null check operator used on a null value

The relevant error-causing widget was: AnimatedBuilder file:///home/effcode/.pub-cache/hosted/pub.dartlang.org/carousel_slider-2.2.1/lib/carousel_slider.dart:249:16 When the exception was thrown, this was the stack:

0 ScrollPosition.minScrollExtent (package:flutter/src/widgets/scroll_position.dart:136:49)

1 CarouselSliderState.build.. (package:carousel_slider/carousel_slider.dart:263:57)

2 AnimatedBuilder.build (package:flutter/src/widgets/transitions.dart:1466:19)

3 _AnimatedState.build (package:flutter/src/widgets/transitions.dart:174:48)

4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)

...

======== Exception caught by widgets library ======================================================= Null check operator used on a null value The relevant error-causing widget was: AnimatedBuilder file:///home/effcode/.pub-cache/hosted/pub.dartlang.org/carousel_slider-2.2.1/lib/carousel_slider.dart:249:16 `

wer-mathurin commented 3 years ago

@serenader2014 Any news on this? This On the first build the minScrollExtent is null and this throwing the exception