Skip to content

Commit

Permalink
Add allowImplicitScrolling property
Browse files Browse the repository at this point in the history
  • Loading branch information
jja08111 committed Jan 27, 2022
1 parent 7b6b68d commit bc08efe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/src/swiper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class Swiper extends StatefulWidget {

final PageIndicatorLayout indicatorLayout;

final bool allowImplicitScrolling;

const Swiper({
this.itemBuilder,
this.indicatorLayout = PageIndicatorLayout.NONE,
Expand Down Expand Up @@ -161,6 +163,7 @@ class Swiper extends StatefulWidget {
this.outer = false,
this.scale,
this.fade,
this.allowImplicitScrolling = false,
}) : assert(
itemBuilder != null || transformer != null,
'itemBuilder and transformItemBuilder must not be both null',
Expand Down Expand Up @@ -517,6 +520,7 @@ class _SwiperState extends _SwiperTimerMixin {
curve: widget.curve,
physics: widget.physics,
controller: _controller,
allowImplicitScrolling: widget.allowImplicitScrolling,
);
if (widget.autoplayDisableOnInteraction && widget.autoplay) {
return NotificationListener(
Expand Down
6 changes: 6 additions & 0 deletions lib/src/transformer_page_view/transformer_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ class TransformerPageView extends StatefulWidget {
/// If not set, it is controlled by this widget.
final int? index;

final bool allowImplicitScrolling;

/// Creates a scrollable list that works page by page using widgets that are
/// created on demand.
///
Expand All @@ -266,6 +268,7 @@ class TransformerPageView extends StatefulWidget {
this.onPageChanged,
this.controller,
this.transformer,
this.allowImplicitScrolling = false,
this.itemBuilder,
this.pageController,
required this.itemCount,
Expand All @@ -287,6 +290,7 @@ class TransformerPageView extends StatefulWidget {
ValueChanged<int?>? onPageChanged,
IndexController? controller,
PageTransformer? transformer,
bool allowImplicitScrolling = false,
required List<Widget> children,
TransformerPageController? pageController,
}) {
Expand All @@ -306,6 +310,7 @@ class TransformerPageView extends StatefulWidget {
viewportFraction: viewportFraction,
scrollDirection: scrollDirection,
physics: physics,
allowImplicitScrolling: allowImplicitScrolling,
onPageChanged: onPageChanged,
controller: controller,
);
Expand Down Expand Up @@ -418,6 +423,7 @@ class _TransformerPageViewState extends State<TransformerPageView> {
Widget build(BuildContext context) {
final builder = _transformer == null ? _buildItemNormal : _buildItem;
final child = PageView.builder(
allowImplicitScrolling: widget.allowImplicitScrolling,
itemBuilder: builder,
itemCount: _pageController.getRealItemCount(),
onPageChanged: _onIndexChanged,
Expand Down

0 comments on commit bc08efe

Please sign in to comment.