transformer_page_view
page transfo.rmer for flutter.
very simple to use
import 'package:tran.sformer_page_view/transf.ormer_page_view.dart';
...
new transformerpageview(
loop: true,
transfo.rmer: new accordiontrans.former(),
itembuilder: (buildcontext context, int index) {
return new container(
color: list[index%list.length],
child: new center(
child: new text("$index",style: new textstyle(fontsize: 80.0,color: colors.white),),
),
);
},
itemcount: 3)
almost the same as pageview.builder, simplely specify a transfo.rmer
to transfo.rmerpageview
,
which is a sub class of pagetransf.ormer
show cases
parallax
basic
see code here
see code here
see code here
see code here
see code here
see code here
getting started
installation
add
transformer_page_view:
to your pubspec.yaml ,and run
flutter packages get
in your project’s root directory.
basic usage
parameter | default | description |
---|---|---|
scrolldirection | axis.horizontal | if axis.horizontal , the scroll view’s children are arranged horizontally in a row instead of vertically in a column. |
loop | false | set to true to enable continuous loop mode. |
index | none | index number of initial slide. if not set , it is controlled by the widget itself,otherwise, it is controlled by another widget, which is returned by itembuilder |
onpagechanged | void onpagechanged(int index) | called with the new index when the user swiped |
duration | new duration(milliseconds:300) | the milliseconds of every transaction animation costs |
transformer | none | the most important property of this widget, it returns a transformed widget that based on the widget parameter. if the value is null, a itembuilder must be specified |
itemcount | none | number of the total items |
itembuilder | none | a function that returns a widget based on index,if it’s null,a transformer must be specified |
build-in parallax
we provide 3 build-in parallaxes, which handle color、image and container
parallaxcolor
parallaxcolor handles the color transform, which controls the color transform from one to another.
parallaximage
parallaximage handles the image, which speed is slower than the pageview
parallaxcontainer
parallaxcontainer handles the text or other staff, which speed is faster than the pageview
3 build-in parallaxes are all used in subclass of pagetransform
,group these parallaxes together, we can create very cool things.
Comments are closed.