scrollable_timeline 1.0.4

SDKflutter
Platformandroidioswindowslinuxmacosweb

A scrollable and draggable timeline that can be driven by an external time stream, for example, the current playing time of a YouTube video.

Pub License GitHub stars

Scrollable Timeline

A scrollable and draggable timeline widget that can be driven by an external time stream, for example, the current playing time of a YouTube video. Multiple timelines can be kept synced and automatically stopped when any of them is dragged.

Examples

There are 3 different runnables samples that has been tested both on mobile and on web. Here is a recording of the most complete example, run on a Android device.

YouTube sample

Installation

See the install section at the package page.

Usage Example

ScrollableTimeline(
  lengthSecs: 100,
  stepSecs: 2,
  height: 120,
  rulerOutsidePadding: 10,
  showCursor: true,
  showMinutes: true,
  backgroundColor: Colors.lightBlue.shade50,
  activeItemTextColor: Colors.blue.shade800,
  itemTextColor: Colors.blue.shade300,
  onDragEnd: (double t) {
    print("*FLT* drag detected for ScrollableTimelineF to target time $t");
  }
)

Constructor Parameters Reference

ParameterDefault valueDescription
heightdouble the height of the timeline
backgroundColorColors.whitethe background color of the timeline
lengthSecsint the total number of seconds shown in the timeline
stepSecsint the time step to use between items in the timeline
shownSecsMultiples1int number of seconds between shown seconds marks
itemExtent60int width of each time mark item (with text of minutes and seconds)
itemTextColorColors.greyColor color for minutes and seconds texts in the time line
showMinutestruebool true if both minutes and seconds should be shown in each time mark
showCursortruebool true if the central cursor indicating the current selected time should be shown
cursorColorColors.redColor color for the central cursor indicating the current selected time
rulerSize8double size of the top and bottom ruler marks
rulerOutsidePadding10double outside padding of the the ruler marks: top for the top ruler marks, and bottom for the bottom ruler marks
rulerInsidePadding5double inside padding of the the ruler marks: bottom for the top ruler marks and top for the bottom ruler marks
timeStreamnullStream? an optional stream of time values. when a value is received the timeline is scrolled to the received time value.
onDragStartcallback when the user start dragging the timeline, called with the current time value when dragging started. When in the dragging state, updates from timeStream are ignored
onDragEndcallback when the user stops dragging the timeline, called with the selected time value when dragging ended.

Parameters Legend

  1. rulerOutsidePadding
  2. rulerSize
  3. rulerInsidePadding
  4. minutes text
  5. seconds text
  6. itemExtent
  7. cursor

params legend

License

Copyright 2022 Dario Elyasy, under the BSD 3-Clause License