draggable home
a draggable flutter widget that makes implementing a sliding up and fully-stretchable much easier! based on the scaffold and sliver.
usage
make sure to check out examples for more details.
installation
add the following line to pubspec.yaml
:
dependencies:
draggable_home: ^1.0.0
basic setup
draggablehome requires you to provide title
, headerwidget
and body
:
title
widget is basically for title in appbar. for no title in appbar, simply put an empty contnainer.headerwidget
is the expanded widget just above body when not fully expanded.body
is in the form of column which requires list of widget or a widget. do not add any verically scrollable widge or you may just disable the scroll.
physics: const neverscrollablescrollphysics()
sample code
draggablehome(
title: text("ttitle"),
headerwidget: headerwidget(),
body: [
container(...),
(...),
]
);
arguments
there are several options that allow for more control:
properties | description |
---|---|
leading |
a widget to display before the toolbar’s title. |
action |
a list of widgets to display in a row after the title widget. |
drawer |
drawers are typically used with the scaffold.drawer property. |
centertitle |
allows toggling of title from the center. by default title is in the center. |
headerexpandedheight |
height of the header widget. the height is a double between 0.0 and 1.0. the default value of height is 0.35 and should be less than stretchmaxheight |
headerwidget |
a widget to display header above body. |
backgroundcolor |
the color of the material widget that underlies the entire draggablehome body. |
curvedbodyradius |
creates a border top left and top right radius of body, default radius of the body is 20.0. for no radius simply set value to 0. |
fullystretchable |
allows toggling of fully expand draggability of the draggablehome. set this to true to allow the user to fully expand the header. |
stretchtriggeroffset |
the offset of overscroll required to fully expand the header. |
expandedbody |
a widget to display when fully expanded as header or expandedbody above body. |
stretchmaxheight |
height of the expandedbody widget. the height is a double between 0.0 and 0.95. the default value of height is 0.9 and should be greater than headerexpandedheight |
floatingactionbutton |
a floating action button is a circular icon button that hovers over content to promote a primary action in the application. |
floatingactionbuttonlocation |
an object that defines a position for the floatingactionbutton based on the scaffold’s scaffoldprelayoutgeometry. |
floatingactionbuttonanimator |
provider of animations to move the floatingactionbutton between floatingactionbuttonlocations. |
sample code for listview.builder
draggablehome(
title: text("ttitle"),
headerwidget: headerwidget(),
body: [
container(...),
// shrinkwrap true required for listview.builder()
// disable the scroll for any verically scrollable widget
listview.builder(
physics: neverscrollablescrollphysics(),
shrinkwrap: true,
itemcount: list.length,
itembuilder: (context, index) => card(
child: listtile(
title: text("$index"),
),
),
),
(...),
]
);
Comments are closed.