TimelineThemeData class
Defines the configuration of the overall visual TimelineTheme for a Timeline or a widget subtree within the app.
The Timeline theme property can be used to configure the appearance of the entire timeline. Widget subtree's within an timeline can override the timeline's theme by including a TimelineTheme widget at the top of the subtree.
Widgets whose appearance should align with the overall theme can obtain the current theme's configuration with TimelineTheme.of.
The static TimelineTheme.of method finds the TimelineThemeData value specified for the nearest BuildContext ancestor. This lookup is inexpensive, essentially just a single HashMap access. It can sometimes be a little confusing because TimelineTheme.of can not see a TimelineTheme widget that is defined in the current build method's context. To overcome that, create a new custom widget for the subtree that appears below the new TimelineTheme, or insert a widget that creates a new BuildContext, like Builder.
{@tool snippet} In this example, the Container widget uses Theme.of to retrieve the color from the theme's color to draw an amber square. The Builder widget separates the parent theme's BuildContext from the child's BuildContext.
TimelineTheme(
data: TimelineThemeData(
color: Colors.red,
),
child: Builder(
builder: (BuildContext context) {
return Container(
width: 100,
height: 100,
color: TimelineTheme.of(context).color,
);
},
),
)
{@end-tool}
{@tool snippet}
- Mixed in types
- Annotations
Constructors
- TimelineThemeData({Axis? direction, Color? color, double? nodePosition, bool? nodeItemOverlap, double? indicatorPosition, IndicatorThemeData? indicatorTheme, ConnectorThemeData? connectorTheme})
-
Create a TimelineThemeData that's used to configure a TimelineTheme.
factory
- TimelineThemeData.fallback()
-
The default direction theme. Same as
new TimelineThemeData.vertical
.factory - TimelineThemeData.horizontal()
-
A default horizontal theme.
factory
- TimelineThemeData.raw({required Axis direction, required Color color, required double nodePosition, required bool nodeItemOverlap, required double indicatorPosition, required IndicatorThemeData indicatorTheme, required ConnectorThemeData connectorTheme})
-
Create a TimelineThemeData given a set of exact values. All the values
must be specified. They all must also be non-null.
const
- TimelineThemeData.vertical()
-
A default vertical theme.
factory
Properties
- color → Color
-
The color for major parts of the timeline (indicator, connector, etc)
final
- connectorTheme → ConnectorThemeData
-
A theme for customizing the appearance and layout of
ThemedConnectorComponent widgets.
final
- direction → Axis
-
The axis along which the timeline scrolls.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- indicatorPosition → double
-
The position for indicator in TimelineNode.
final
- indicatorTheme → IndicatorThemeData
-
A theme for customizing the appearance and layout of
ThemedIndicatorComponent widgets.
final
- nodeItemOverlap → bool
-
Determine whether each connectors and indicator will overlap in
TimelineNode.
final
- nodePosition → double
-
The position for TimelineNode in TimelineTile.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{Axis? direction, Color? color, double? nodePosition, bool? nodeItemOverlap, double? indicatorPosition, IndicatorThemeData? indicatorTheme, ConnectorThemeData? connectorTheme}) → TimelineThemeData - Creates a copy of this theme but with the given fields replaced with the new values.
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
lerp(
TimelineThemeData a, TimelineThemeData b, double t) → TimelineThemeData - Linearly interpolate between two themes.