carousel_slider_x 7.0.0
carousel_slider_x: ^7.0.0 copied to clipboard
A carousel slider widget, support infinite scroll and auto play, enlarge mode.
7.0.0 #
Breaking #
- Auto play has one rule:
autoPlayIntervalis the period between slides, and a tick that lands while the carousel is held or already moving waits for the next one.pauseAutoPlayOnTouch,pauseAutoPlayOnManualNavigate,pauseAutoPlayInFiniteScroll,CarouselControllerX.startAutoPlayandstopAutoPlayare removed. A finite carousel always wraps; to stop at the last item, watchonPageChangedand rebuild withautoPlay: false. CarouselPageChangedReasonis removed;onPageChangedis nowvoid Function(int index).CarouselOptions.disableGestureis removed. UsescrollPhysics: const NeverScrollableScrollPhysics().- Drags are accepted from every
PointerDeviceKind, not just touch and mouse. Narrow the set with the newCarouselOptions.dragDevices. - A drag moves the carousel from its first pixel; the removed
GestureDetectorused to discard the first ~20px. jumpToPage,animateToPageandinitialPagebring an out-of-range page into range — wrapping whenenableInfiniteScrollis on, clamping otherwise.- A carousel with one item no longer scrolls, and
scrollPhysicsis ignored at that size. CarouselControllerX.setupCallbacksloses itsonStartAutoPlayandonStopAutoPlayparameters.
Fixed #
CenterPageEnlargeStrategy.heightdid nothing at all. It now shrinks the side items across the scroll axis.CenterPageEnlargeStrategy.zoomanchored side items away from the centre underreverseand under a right-to-leftDirectionality.- An infinite carousel built before its items arrived could not scroll backwards afterwards; a finite one ignored
initialPage. - A
viewportFractionchange emittedonScrolledfrom inside the build phase, so asetStatemade from it threw. - Auto play fought its own slide when
autoPlayIntervalwas shorter thanautoPlayAnimationDuration, and did not wait for a swipe. WithpadEnds: falseand aviewportFractionbelow 1 it also stopped at the last item: the position cannot reach a wholeitemCount - 1there, so the wrap never fired. onPageChangedwent silent when the list changed length under the reader, leaving the last index it reported naming an item that was no longer there.CarouselControllerX.nextPageandpreviousPagemoved a carousel with one item, which has nowhere to go.- A
CarouselControllerXyou own was cleared when its carousel was disposed, leaving a replacement carousel undrivable. - The carousel could be left with its position past the end it can reach, drawing nothing there.
const CarouselSlider(items: [...])did not compile.CarouselSliderthrew when built without aPageStorageancestor.- Every visible slide was built twice at mount.
- The README's carousel controller sample used the removed
RaisedButtonand an undefined variable.
Other #
- Imports
package:flutter/widgets.dartrather thanpackage:flutter/material.dart. onScrolledreports the page view's own position — fractional, and counting from a virtual offset on an infinite carousel.onPageChangedreports an item index.dragDevicesgoverns dragging only: a mouse wheel is routed past it byScrollable, and controller calls and auto play do not consult it.pageViewKeyand theheight/aspectRatiopair are meant to be set once. Changing either while the carousel is on screen rebuilds the page view and loses the reader's place.- Asserts on
aspectRatio,viewportFraction,height,CarouselSlider.builder'sitemCount, and both auto play durations. - Stops following the scroll position when
enlargeCenterPageis off. - The semantics tree no longer advertises
scrollUp/scrollDownon a horizontal carousel.
6.3.0 #
- Fix
carouselControllernot working when it is replaced without changingoptions. - Keep the
PageControllerand its scroll position when the changed options do not affect it. - Fix a new
autoPlayIntervalnot being applied while auto play is running. - Fix
CenterPageEnlargeStrategy.zoomanchoring an item on the wrong edge while scrolling, which made it jump once the scroll settled. - Remove the
equatabledependency.CarouselOptionsno longer exposesprops. - Use
ListenableBuilderinstead ofAnimatedBuilder. - Remove unreachable dead code in
getIndexInLength.
6.2.0 #
- Flutter 3.32/Dart 3.8
- equatable ^2.1.0
- flutter_lints ^6.0.0
6.1.2 #
- Remove unreachable dead code in gesture handling and auto play timer.
- Deprecate
CarouselPageChangedReason.restore(no longer used). - Improve test coverage to 100%.
6.1.1 #
- Fix
animateToClosestbackward wrap bug.
6.1.0 #
- Fix initial page position issue.
- Add unit tests.
6.0.7 #
- Fix animation when
enlargeCenterPageistrue
6.0.6 #
- Fix initial position when
enlargeCenterPageisfalse
6.0.5 #
- Notify position regardless of enlargeCenterPage value
6.0.4 #
- Fixed restore process with PageStorageKey
6.0.3 #
- Fix current page issue when the device is rotated
6.0.2 #
- Fix
_currentPagenullable issue
6.0.1 #
- Add a
mountedcheck before thesetStatecall
6.0.0 #
- Rename
CarouselControllertoCarouselControllerX
5.0.5 #
- Fix assertion error when
PageController.jumpToPageis called
5.0.4 #
- Fix layout error when the widget is hide
didUpdateWidget
5.0.3 #
- Fix position in callback when infinite scroll is disabled
5.0.2 #
- Fix
CarouselOptions.initialPageupdate issue
5.0.1 #
- Support equatability for
CarouselOptions - Fix
didUpdateWidgetforCarouselSlider
5.0.0 #
Forked and renamed the library.
- Migrate to dart 3.0
- Move following properties from
CarouselOptionstoCarouselSlideronPageChangedonScrolled
- Move the following properties from
CarouselSlidertoCarouselOptionsdisableGesture
- Change
CarouselOptionsto immutable class - Nullability cleanup
- Cleanup state management
- Recreate example project by Flutter 3.22
4.2.1 #
- [FIX] temporary remove
PointerDeviceKind.trackpad - [FIX] fix
'double?'type
4.2.0 #
-
[Add]
enlargeFactoroption -
[Add]
CenterPageEnlargeStrategy.zoomoption -
[Add]
animateToClosestoption -
[FIX] clear timer if widget was unmounted
-
[FIX] scroll carousel using touchpad
4.1.1 #
- Fix code formatting
4.1.0 #
4.0.0 #
- Support null safety (Null safety isn't a breaking change and is Backward compatible meaning you can use it with non-null safe code too)
- Update example code to null safety and add Dark theme support and controller support to indicators in on of the examples and also fix overflow errors.
3.0.0 #
2.3.3 #
- Fix code formatting
2.3.2 #
2.3.1 #
- Fix code formatting
2.3.0 #
2.2.0 #
Add #
disableCenteroption
This option controls whether the carousel slider item should be wrapped in a Center widget or not.
enlargeStrategyoption
This option allow user to set which enlarge strategy to enlarge the center slide. Use CenterPageEnlargeStrategy.height
if you want to improve the performance.
Fix #
- Fixed
CarousePageChangedReason.manualnever being emitted
2.1.0 #
Add #
pauseAutoPlayOnTouchoption
This option controls whether the carousel slider should pause the auto play function when user is touching the slider
pauseAutoPlayOnManualNavigateoption
This option controls whether the carousel slider should pause the auto play function when user is calling controller's method.
pauseAutoPlayInFiniteScrolloption
This option decide the carousel should go to the first item when it reach the last item or not.
pageViewKeyoption
This option is useful when you want to keep the pageview's position when it was recreated.
Fix #
- Fix
CarouselPageChangedReasonbug
Other updates #
- Use
Transform.scaleinstead ofSizedBoxto wrap the slider item
2.0.0 #
Breaking change #
Instead of passing all the options to the CarouselSlider, now you'll need to pass these option to CarouselOptions:
CarouselSlider(
CarouselOptions(height: 400.0),
items: [1,2,3,4,5].map((i) {
return Builder(
builder: (BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 5.0),
decoration: BoxDecoration(
color: Colors.amber
),
child: Text('text $i', style: TextStyle(fontSize: 16.0),)
);
},
);
}).toList(),
)
Add #
CarouselController
Since v2.0.0, carousel_slider plugin provides a way to pass your own CaourselController, and you can
use CaouselController instance to manually control the carousel's position. For a more detailed example please refer
to example project.
CarouselPageChangedReason
Now you can receive a CarouselPageChangedReason in onPageChanged callback.
Remove #
pauseAutoPlayOnTouch
pauseAutoPlayOnTouch option is removed, because it doesn't fix the problem we have. Currently, when we enable the autoPlay feature, we can not stop sliding when the user interact with the carousel. This is a flutter's issue.
1.3.0 #
0.0.2 #
Remove useless dependencies, add changelog.
0.0.1 #
Initial version.