3

Component

The timeline timeline is often used in business development to record data operation records, etc. Here I encapsulate a relatively common timeline component.

Example

parameter

parametertypeRequiredillustrate
timelineListListYesTimeline data
lineColorColorYesTimeline axis color
heightdoublenoThe height of the container on the right side of the timeline (default 80)
titleStyleTextStylenoTimeline title style (with defined initial value, no need to pass parameters if there is no special style)
subtitleStyleTextStylenoThe color of the subtitle of the timeline will not be displayed if the List data does not contain the subtitle parameter
descriptionStyleTextStylenoTimeline description style
leftContentboolnoWhen displaying the left time true-displaying false-not displaying the default true

timelineList

parametertypeillustrate
titleStringHeader data
subtitleStringSubtitle data
descriptionStringDescription (if remark is not empty, it will not be displayed)
remarkStringRemarks are displayed as bubbles
dayStringThe time column on the left is like 09-20
timeStringThe time on the left is like 11:40

Call example

import '@/timeline/timeline.dart';
final list = [
    {
      'day': '07-08',
      'time': '13:20',
      'remark': "备注:降价1000客户可考虑,辛苦再撮合备注:降价1000客户可考虑,辛苦再撮合备注:降价1000客户可考虑",
      'description': '',
      'subtitle': '齐本安(主播)',
      'title': "新建工单"
    },
    {
      'id': "2",
      'day': '07-08',
      'time': '13:20',
      'description': "备注:降价1000客户可考虑,辛苦再撮合备注:降价1000客户可考虑",
      'subtitle': '吴雄飞(销售专员)',
      'title': "联系客户"
    },
    {
      'id': "3",
      'day': '07-08',
      'time': '13:20',
      'description': "备注:降价1000客户可考虑,辛苦再撮合备注:降价1000客户可考虑,辛苦再撮合备注:降价1000客户可考虑,辛苦再撮合",
      'title': "新建工单"
    },
    {
      'id': "4",
      'day': '07-08',
      'time': '13:20',
      'description': "备注:降价1000客户可考虑,辛苦再撮合备注:降价1000客户可考虑,辛苦再撮合备注:降价1000客户可考虑,辛苦再撮合",
      'subtitle': '齐本安(主播)',
      'title': "新建工单"
    },
    {
      'id': "5",
      'day': '07-08',
      'time': '13:20',
      'description': "备注:降价1000客户可考虑",
      'subtitle': '吴雄飞(主播)',
      'title': "新建工单"
    }
  ];
TimelineComponent(
  timelineList: list,
  lineColor: WBColors.color_cccccc,
  leftContent: false,
  height: 80.0,
)

Source address: https://github.com/gongchenghuigch/flutterComponent/tree/main/timeline


兰俊秋雨
5.1k 声望3.5k 粉丝

基于大前端端技术的一些探索反思总结及讨论