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

scrolly tell flutter

a flutter package to implement scrolly telling in your flutter app. using scrolly tell you can have the background changing dynamically as you scroll. scrolly tell provides a mechanism to fully control this behaviour.

installing

dependencies:
  scrollytell: ^1.0.3

⚡️ import

import 'package:scrollytell/scrollytell.dart';

props

props type default value description
panels (required) list widget a list of panel widgets
panelstartcallback (required) function(num, function) called on start of new panel
panelendcallback (required) function(num, function) called on end of existing panel
panelprogresscallback (required) function(num, double, function) called every frame
opacity double 1 set opacity of the panels
lastpanelforcecomplete bool false set true if the last panel hits bottom of the screen and can’t be scrolled through
initialoverlaywidget widget none overlay widget before start of scrolling
guidelineposition guidelineposition guidelineposition.top set position of guideline
stickychartindex int null the panel of corresponding index will dock at center when scrolled past the center
showdebugconsole bool false show debug console (activepanelindex, progress) and debug line (guideline)

terminology and explanation

panel

panel is a widget. the list of panels form a scrolling sequence. in simple words, each panel is widget that remains in foreground while scrolling.

overlaywidget

the overlay widget is what you want to be dynamically changed as you scroll.
for example: in a simple story telling app, the panel will consist of a text portion of the story, while the overlaywidget shows a corresponding graphic.

guideline

guideline is an imaginary reference line. when the panel’s top coincide with the guideline we say panel has been ‘started’ or the panel is ‘active’ and panelstartcallback is called. similarily when panel’s bottom touch guideline we say panel is ended andpanelendcallback is called.
you can choose the guidelineposition to be either at scrollywidget’s top, center, bottom.

activepanelindex

an integer value corresponding to the panel that is “active”(coincides with the guideline).

progress (0,1)

a double value that depicts how much the panel has been scrolled past the guideline.
for example: when the center of panel reaches guideline progress is half.

�� how to use

declare a list of widgets

list<widget> panellist = [text('hello scrollytell'), text('hello flutter')];

declare an overlay widget

widget overlaywidget;

declare a scrollywidget

widget _scrollywidget = scrollywidget(
		   showdebugconsole: true,
  	           guidelineposition: guidelineposition.center,
                   panels: panellist,
                   panelstartcallback: (activepanelnumber, func){},
                   panelendcallback: (endingpanelnumber, func){},
                   panelprogresscallback: (activepanelnumber, progress, func){
    
                // set properties of overlay widget using activepanelnumber and progress
        
                       double rad = (progress <= 0.5) ? progress * 200 : 200 - progress * 200;
                       overlaywidget = center(
                           child: container(
                               width: 200,
                               height: 200,
                               decoration: boxdecoration(
                                   borderradius: borderradius.all(
                                       radius.circular(rad),
                                   ),
                               color: colors.red,
                               ),
                           ),
                       );
        
                // then pass it into the function
        
                       func(overlaywidget)
                   },
               )

now wrap it in either expanded, flexible or container

option 1 : wrap in expanded for covering the remaining screen.

expanded(child: _scrollywidget)

option 2 : wrap in flexible

flexible(child: _scrollywidget)

option 3 : wrap in container to give it desired size.

container(height: 500, width: 300, child: _scrollywidget)

or use it directly as body of scaffold.

scaffold(body: _scrollywidget)

for more info, refer to the basic_usage app in the example.

some usage tips for beginners

setting the overlay widget.

  • the overlaywidget will continue to be the one which was last set in the callback(s) unless you explicitly change it.
  • when you do not want to display anything at overlaywidget set it to be container()

adding a “fake panel”

  • sometimes you may want to include want to include containers at start (maybe a heading) and want it
    to scroll with your actual panels. the best option is to add it as a panel in the panellist and not
    manipulate the overlaywidget when activepanelindex is 1.
  • a similar approach can be applied when you want include containers (like large empty spaces) in between
    you actual panels (like, text portions of story). just include the container at the appropriate position in the panellist
    and not manipulate the overlaywidget when activepanelindex is corresponding index.

�� showcase

scrolly tell flutter

�� bugs/requests

if you encounter any problems feel free to open an issue. if you feel the library is
missing a feature, please raise a issue(label:enhancement) on github and we will look into it.
pull requests are most welcome.


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.