Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter flutter logo parallax image

parallax image is a flutter widget that paints an image and moves it at a slower speed than the main scrolling content.

parallax-image
parallax image – paint & move

installation

add dependency to your pubspec.yaml:

dependencies:
  parallax_image: ^0.2.0

usage

parallaximage can be used with any scrollable (listview for instance).
when created, it subscribes to scroll updates on nearest scrollable ancestor.
it is also possible to specify custom scrollcontroller in which case this
widget subscribes to updates on scrollcontroller.position (assumes that
controller is attached to only one scrollable).

class mywidget extends statefulwidget {
  @override
  mywidgetstate createstate() => new mywidgetstate();
}

class mywidgetstate extends state<mywidget> {
  final _controller = new scrollcontroller();

  @override
  widget build(buildcontext context) {
    return new listview(controller: _controller, children: [
      new parallaximage(
        image: new assetimage('images/january.jpg'),
        // extent of this widget in scroll direction.
        // in this case it is vertical scroll so extent defines
        // the height of this widget.
        // the image is scaled with boxfit.fitwidth which makes it
        // occupy full width of this widget.
        // after image is scaled it should normally have height greater
        // than this value to allow for parallax effect to be
        // visible.
        extent: 100.0,
        // optionally specify child widget.
        child: new text('january'),
        // optinally specify scroll controller.
        controller: _controller,
      ),
      // ...add more list items
    ]);
  }
}

see example/ folder for a complete demo.

download the full project for this post from the following button

this source is fully free for all time

download as zip


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.