项目作者: furkantektas

项目描述 :
Timeline widget for flutter
高级语言: Dart
项目地址: git://github.com/furkantektas/timeline_list.git
创建时间: 2019-01-10T10:03:42Z
项目社区:https://github.com/furkantektas/timeline_list

开源协议:MIT License

下载


Flutter Timeline Widget

pub package Flutter Timeline List Web Demo

A highly customizable Flutter widget for displaying vertical timelines with custom markers, icons, and flexible positioning options.

Flutter Timeline List Screenshot

[!WARNING]
🦚 The documentation was created using LLMs. If you notice any errors or typos, please submit a Pull Request or create an issue.

Features

  • 🎯 Three timeline positions: start (left), center, or end (right)
  • 🎨 Fully customizable markers with any widget as content or icon
  • 📍 Flexible icon alignment: top, center, or bottom of markers
  • 🎯 Individual marker positioning for centered timelines
  • 🔄 Support for reversed timeline order
  • 📱 Custom scroll physics and controller support

Installation

Add this to your package’s pubspec.yaml file:

  1. dependencies:
  2. timeline_list: ^0.1.0

Usage

Simple Timeline

Flutter Simple Timeline List Screenshot

  1. import 'package:timeline_list/timeline_list.dart';
  2. Timeline(
  3. children: [
  4. Marker(child: Text("Step 1")),
  5. Marker(child: Text("Step 2")),
  6. Marker(child: Text("Step 3"))
  7. ],
  8. )

Onboarding Example

Here’s a more advanced example showing an onboarding timeline with custom icons:

Flutter Onboarding Timeline List Screenshot

  1. var checkIcon = Container(
  2. width: 16,
  3. height: 16,
  4. decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.green),
  5. child: Icon(Icons.check, color: Colors.white, size: 12));
  6. var emptyIcon = Container(
  7. width: 16,
  8. height: 16,
  9. decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.grey));
  10. return Scaffold(
  11. appBar: AppBar(title: const Text("Onboarding example")),
  12. body: Column(children: [
  13. Timeline.builder(
  14. context: context,
  15. markerCount: 10,
  16. properties: TimelineProperties(
  17. iconAlignment: MarkerIconAlignment.center,
  18. iconSize: 16,
  19. timelinePosition: TimelinePosition.start),
  20. markerBuilder: (context, index) => Marker(
  21. child: Padding(
  22. padding: const EdgeInsets.all(8.0),
  23. child: Text("Step ${index + 1}"),
  24. ),
  25. icon: index >= 8 ? emptyIcon : checkIcon,
  26. position: MarkerPosition.left,
  27. ),
  28. ),
  29. ]));

Customization

Timeline Properties

  • timelinePosition: Controls the overall timeline position (start, center, end)
  • iconAlignment: Sets icon alignment relative to marker content
  • iconSize: Defines the size of marker icons
  • lineWidth: Sets the width of connecting lines
  • lineColor: Customizes the color of connecting lines
  • itemGap: Controls spacing between markers
  • iconGap: Sets gap between icon and marker content

Marker Properties

  • child: The main content widget of the marker
  • icon: Optional custom icon widget
  • position: Marker position for centered timelines (left, right)
  • onTap: Optional callback for marker tap events
  • maxWidth: Maximum width constraint for marker content

Examples

Check out the example/ folder for complete sample applications, including:

  • Fully featured timeline with custom icons and widgets
  • Simple onboarding flow

Contributing

This repo is looking for maintainers. Contributions are welcome! Please feel free to submit a Pull Request.

Thank you for all the contributors!


Sponsored by: