Skip to content

Commit fc00ea5

Browse files
author
LowLevelSubmarine
committed
fix: CenterPageEnlargeStrategyy.zoom not working correctly with scrollDirection: vertical
1 parent b67cf00 commit fc00ea5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/carousel_slider.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,11 @@ class CarouselSliderState extends State<CarouselSlider>
235235
}
236236
if (widget.options.enlargeStrategy == CenterPageEnlargeStrategy.zoom) {
237237
late Alignment alignment;
238+
final bool horizontal = options.scrollDirection == Axis.horizontal;
238239
if (itemOffset > 0) {
239-
alignment = Alignment.centerRight;
240+
alignment = horizontal? Alignment.centerRight : Alignment.bottomCenter;
240241
} else {
241-
alignment = Alignment.centerLeft;
242+
alignment = horizontal? Alignment.centerLeft : Alignment.topCenter;
242243
}
243244
return Transform.scale(child: child, scale: scale, alignment: alignment);
244245
}

0 commit comments

Comments
 (0)