timelinetile
a package to help build customisable timelines in flutter.
example
- you can access the example project for a timeline showcase.
- the beautiful timelines contains real world design examples.
- or try the web demo
some use cases:
timeline showcase |
football timeline |
activity timeline |
success timeline |
delivery timeline |
weather timeline |
getting started
a timeline consists in a group of timelinetiles. to build a tile you can simply use:
timelinetile()
this will build a default tile that aligns to the left, with a height
of 100:
there are 4 types of alignment.
timelinealign.left
timelinealign.right
timelinealign.center
timelinealign.manual
the left
and right
alignment allows a child in their opposite sides. on the other hand, both center
and manual
allows children on both sides. for example, one tile widh alignment to the center:
timelinetile(
alignment: timelinealign.center,
rightchild: container(
constraints: const boxconstraints(
minheight: 120,
),
color: colors.lightgreenaccent,
),
leftchild: container(
color: colors.amberaccent,
),
);
when providing children to the tile the height will be as minimum as possible, so you can control it with a height constraint (at least minheight). this way the tile knows how to size it properly.
manual aligning the idicator
with timelinealign.manual you can provide the linex, which allows you to specify a value from 0.0 to 1.0, that represents a widht percentage. for example, aligning at 30% of the widht:
timelinetile(
alignment: timelinealign.manual,
linex: 0.3,
rightchild: container(
constraints: const boxconstraints(
minheight: 120,
),
color: colors.lightgreenaccent,
),
leftchild: container(
color: colors.amberaccent,
),
);
is it the first or the last?
you can decide if a tile is the first os the last in a timeline. this way you control whether a top or bottom line must be rendered.
see the implementation here
start to make a timeline
you can finally start to combine some tiles to make a timeline. the flag hasindicator
can control whether an indicator should or shouldn’t be rendered.
see the implementation here
customize the indicator as you wish
the default indicator is a circle, and you can customize it as you wish. with indicatorstyle
you can change the color, the y position based on values from 0.0 to 1.0 or give it a padding. you must explicitly provide its width though.
see the implementation here
give an icon to the indicator
with iconstyle
you can provide an icon to be rendered inside the default indicator.
see the implementation here
or provide your custom indicator
with the indicator parameter you can customize the tile with your own indicator. however, you must control its size through both width and height parameters.
see the implementation here
customize the tile’s line
with linestyle
you can customize both topline and bottomline.
see the implementation here
connect tiles with timelinedivider
the timelinedivider
widget allows you to connect tiles that are aligned in different x axis, when combined with timelinealign.manual
.
see the implementation here
Comments are closed.