infinite view pager
flutter infinite view pager widget.
installation
dependencies:
infinite_view_pager: ^1.0.0
example
import 'package:infinite_view_pager/infinite_view_pager.dart';
class infiniteviewpagerdemo extends statefulwidget {
@override
_infiniteviewpagerdemostate createstate() => _infiniteviewpagerdemostate();
}
class _infiniteviewpagerdemostate extends state<infiniteviewpagerdemo> {
int index = 0;
widget _buildpage(buildcontext context, int direction) {
return container(
padding: edgeinsets.all(100.0),
child: card(
shape: roundedrectangleborder(
borderradius: borderradius.circular(20.0),
),
elevation: 10,
child: center(
child: text(
(index + direction).tostring(),
style: theme.of(context).texttheme.display4,
),
),
),
);
}
@override
widget build(buildcontext context) {
return container(
child: infiniteviewpager(
onpagechanged: (direction) {
index += direction;
},
pagebuilder: _buildpage,
scrolldirection: axis.vertical,
),
);
}
}
Comments are closed.