LabelTheme class
Defines the visual styling for connection labels.
Connection labels can be positioned anywhere along a connection path using an anchor value (0.0-1.0) and a perpendicular offset. Labels use ConnectionLabel instances which contain their own positioning information.
LabelTheme controls the appearance of the label text and its background container, including colors, borders, and padding.
Usage Example
const labelTheme = LabelTheme(
textStyle: TextStyle(
color: Colors.black,
fontSize: 12.0,
fontWeight: FontWeight.w500,
),
backgroundColor: Colors.white,
border: Border.all(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.all(Radius.circular(4.0)),
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
);
See also:
- ConnectionLabel for label positioning and content
- Connection for applying labels to connections
- NodeFlowTheme for overall theme configuration
Constructors
- LabelTheme({TextStyle textStyle = const TextStyle(fontSize: 12.0), Color? backgroundColor, BoxBorder? border, BorderRadius borderRadius = const BorderRadius.all(Radius.circular(4.0)), EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 2), double maxWidth = double.infinity, int? maxLines, double offset = 0.0, double labelGap = 8.0})
-
Creates a label theme with the specified styling properties.
const
Properties
- backgroundColor → Color?
-
Background color of the label container.
final
- border → BoxBorder?
-
Border decoration for the label container.
final
- borderRadius → BorderRadius
-
Border radius for rounded corners.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- labelGap → double
-
Minimum gap from connection endpoints when label anchor is at 0.0 or 1.0.
final
- maxLines → int?
-
Maximum number of lines for the label text.
final
- maxWidth → double
-
Maximum width before text wraps to multiple lines.
final
- offset → double
-
Default perpendicular offset from the connection path.
final
- padding → EdgeInsets
-
Padding inside the label container.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textStyle → TextStyle
-
Text style for the label text.
final
Methods
-
copyWith(
{TextStyle? textStyle, Color? backgroundColor, BoxBorder? border, BorderRadius? borderRadius, EdgeInsets? padding, double? maxWidth, int? maxLines, double? offset, double? labelGap}) → LabelTheme - Creates a copy of this theme with the given fields replaced with new values.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- dark → const LabelTheme
- Predefined dark theme for labels.
- light → const LabelTheme
- Predefined light theme for labels.