loop_page_view 1.2.0
loop_page_view: ^1.2.0 copied to clipboard
A simple Flutter PageView builder constructor wrapper that allows for endless scrolling on both directions.
loop_page_view #
A simple PageView builder constructor wrapper that allows for “indefinitely” scrolling on both directions.
Usage #
Import the package into your code:
import 'package:loop_page_view/loop_page_view.dart';
It works exactly as a PageView builder constructor would, but it always requires an item count, and it requires a LoopPageController as its controller. LoopPageController also works just as a PageController would, but it correctly handles LoopPageView endless scrollable list.
An animateJumpToPage method was added to LoopPageController in order to animate a jump to any page without building the pages in between if viewportFraction is 1.0.
Installation #
dependencies:
loop_page_view: ^1.2.0
Example #
import 'package:flutter/material.dart';
import 'package:loop_page_view/loop_page_view.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Loop Page View Demo'),
),
body: Center(
child: LoopPageView.builder(
itemCount: 2,
itemBuilder: (_, index) {
return Card(
child: Center(
child: Text('$index'),
),
);
},
),
),
),
);
}
}