Skip to content

Commit

Permalink
feat(bar_chart): add List<InlineSpan>? children parameter to
Browse files Browse the repository at this point in the history
BarTooltipItem for enhanced styling
  • Loading branch information
jrc2139 committed Mar 20, 2021
1 parent e1de73f commit a521525
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lib/src/chart/bar_chart/bar_chart_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -709,23 +709,24 @@ class BarTooltipItem with EquatableMixin {
/// TextStyle of the showing content.
final TextStyle textStyle;

/// List<TextSpan>
final List<TextSpan>? textSpanChildren;
/// List<InlineSpan> add further style and format to the text of the tooltip
final List<InlineSpan>? children;

/// content of the tooltip, is a [text] String with a [textStyle].
/// content of the tooltip, is a [text] String with a [textStyle]
BarTooltipItem(
String text,
TextStyle textStyle, {
List<TextSpan>? textSpanChildren,
List<InlineSpan>? children,
}) : text = text,
textStyle = textStyle,
textSpanChildren = textSpanChildren;
children = children;

/// Used for equality check, see [EquatableMixin].
@override
List<Object?> get props => [
text,
textStyle,
children,
];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/chart/bar_chart/bar_chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class BarChartPainter extends AxisChartPainter<BarChartData> with TouchHandler<B
final span = TextSpan(
style: tooltipItem.textStyle,
text: tooltipItem.text,
children: tooltipItem.textSpanChildren,
children: tooltipItem.children,
);

final tp = TextPainter(
Expand Down

0 comments on commit a521525

Please sign in to comment.