From 1b53fd861064ee70b6edbdf7eeb5af7c5b632d3f Mon Sep 17 00:00:00 2001 From: softmarshmallow Date: Wed, 26 Aug 2020 16:52:21 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20added=20indicator=20position.=20jus?= =?UTF-8?q?t=20for=20skeleton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/pubspec.lock | 2 +- lib/indicator_position.dart | 5 +++++ lib/timeline_theme_data.dart | 14 ++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 lib/indicator_position.dart diff --git a/example/pubspec.lock b/example/pubspec.lock index 3e485d9..d6d537b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -73,7 +73,7 @@ packages: path: ".." relative: true source: path - version: "0.0.4+2" + version: "0.0.4+4" matcher: dependency: transitive description: diff --git a/lib/indicator_position.dart b/lib/indicator_position.dart new file mode 100644 index 0000000..5845b28 --- /dev/null +++ b/lib/indicator_position.dart @@ -0,0 +1,5 @@ +enum IndicatorPosition{ + top, + center, + bottom +} \ No newline at end of file diff --git a/lib/timeline_theme_data.dart b/lib/timeline_theme_data.dart index 5cbc216..6cc74cf 100644 --- a/lib/timeline_theme_data.dart +++ b/lib/timeline_theme_data.dart @@ -1,7 +1,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_timeline/indicator_position.dart'; -@immutable +/// [TimelineThemeData] is passed through [TimelineTheme], works like general flutter theme object. class TimelineThemeData with Diagnosticable { TimelineThemeData({ this.gutterSpacing = 12.0, @@ -11,6 +12,7 @@ class TimelineThemeData with Diagnosticable { this.strokeCap = StrokeCap.butt, this.lineColor = Colors.lightBlueAccent, this.style = PaintingStyle.stroke, + this.indicatorPosition = IndicatorPosition.center, }) : assert(itemGap >= 0), assert(lineGap >= 0); @@ -22,6 +24,9 @@ class TimelineThemeData with Diagnosticable { final double itemGap; final double gutterSpacing; + /// the position of the indicator. this affects the placing of the indicator, and following line measurement + final IndicatorPosition indicatorPosition; + /// Whether all the properties of this object are non-null. bool get isConcrete => lineColor != null; // && @@ -35,11 +40,8 @@ class TimelineThemeData with Diagnosticable { strokeWidth = 4.0, style = PaintingStyle.stroke, itemGap = 24.0, - gutterSpacing = 12.0; - -// : color = const Color(0xFF000000), -// _opacity = 1.0, -// size = 24.0; + gutterSpacing = 12.0, + indicatorPosition = IndicatorPosition.center; TimelineThemeData copyWith( {Color lineColor, StrokeCap strokeCap, double strokeWidth}) {