Skip to content

Commit e92fd3b

Browse files
formatter
1 parent 9a06043 commit e92fd3b

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

lib/src/chart.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ class _ChartState extends State<Chart> with TickerProviderStateMixin {
101101
controller: _controller,
102102
layers: widget.layers,
103103
oldLayers: oldLayers,
104-
onUpdateTouchableShapes: (shapes) => _touchableShapes = shapes,
104+
onUpdateTouchableShapes: (shapes) =>
105+
_touchableShapes = shapes,
105106
padding: widget.padding,
106107
touchedData: _touchedData,
107108
),

lib/src/models/highlight/shape/chart_highlight_line_shape.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
part of 'chart_highlight_shape.dart';
22

33
/// Provides highlight line shape.
4-
class ChartHighlightLineShape<T extends ChartDataItem> extends ChartHighlightShape {
4+
class ChartHighlightLineShape<T extends ChartDataItem>
5+
extends ChartHighlightShape {
56
/// The background color of shape.
67
final Color backgroundColor;
78

@@ -25,7 +26,8 @@ class ChartHighlightLineShape<T extends ChartDataItem> extends ChartHighlightSha
2526

2627
/// Draw highlight line shape.
2728
@override
28-
void draw(Canvas canvas, ChartPainterData painterData, ChartTouchCallbackData touchedData, double tolerance) {
29+
void draw(Canvas canvas, ChartPainterData painterData,
30+
ChartTouchCallbackData touchedData, double tolerance) {
2931
final T item = touchedData.selectedItem as T;
3032
final Offset currentValuePos = currentPos(item);
3133
final Offset pos = Offset(

lib/src/models/highlight/shape/chart_highlight_shape.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ abstract class ChartHighlightShape {
1010
const ChartHighlightShape();
1111

1212
/// Draw custom shape.
13-
void draw(Canvas canvas, ChartPainterData painterData, ChartTouchCallbackData touchedData, double tolerance);
13+
void draw(Canvas canvas, ChartPainterData painterData,
14+
ChartTouchCallbackData touchedData, double tolerance);
1415
}

lib/src/models/tooltip/shape/chart_tooltip_bar_shape.dart

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ class ChartTooltipBarShape<T extends ChartDataItem> extends ChartTooltipShape {
4949

5050
/// Draw tooltip bar shape.
5151
@override
52-
void draw(Canvas canvas, ChartPainterData painterData, ChartTouchCallbackData touchedData, double tolerance) {
52+
void draw(Canvas canvas, ChartPainterData painterData,
53+
ChartTouchCallbackData touchedData, double tolerance) {
5354
final T item = touchedData.selectedItem as T;
5455
final Offset currentValuePos = currentPos(item);
5556
final Size currentValueSize = currentSize(item);
56-
final Offset itemPos = Offset(currentValuePos.dx + currentValueSize.width / 2.0, currentValuePos.dy);
57+
final Offset itemPos = Offset(
58+
currentValuePos.dx + currentValueSize.width / 2.0, currentValuePos.dy);
5759
final TextPainter textPainter = TextPainter(
5860
text: TextSpan(
5961
text: onTextValue(item),
@@ -63,7 +65,11 @@ class ChartTooltipBarShape<T extends ChartDataItem> extends ChartTooltipShape {
6365
)..layout();
6466
final Offset pos = Offset(
6567
itemPos.dx - textPainter.width / 2.0,
66-
itemPos.dy - textPainter.height - padding.vertical / 2.0 - marginBottom - triangleSideLength * 0.5,
68+
itemPos.dy -
69+
textPainter.height -
70+
padding.vertical / 2.0 -
71+
marginBottom -
72+
triangleSideLength * 0.5,
6773
);
6874
final Offset rectPos = Offset(
6975
pos.dx - padding.horizontal / 2.0,
@@ -76,15 +82,22 @@ class ChartTooltipBarShape<T extends ChartDataItem> extends ChartTooltipShape {
7682
final Offset offsetRectAndText = Offset(
7783
painterData.position.dx - tolerance > rectPos.dx
7884
? -(painterData.position.dx - tolerance - rectPos.dx)
79-
: painterData.position.dx + tolerance + painterData.size.width < rectPos.dx + rectSize.width
80-
? -(painterData.position.dx + painterData.size.width + tolerance - rectPos.dx - rectSize.width)
85+
: painterData.position.dx + tolerance + painterData.size.width <
86+
rectPos.dx + rectSize.width
87+
? -(painterData.position.dx +
88+
painterData.size.width +
89+
tolerance -
90+
rectPos.dx -
91+
rectSize.width)
8192
: 0.0,
8293
rectPos.dy < 0 ? rectPos.dy : 0.0,
8394
);
8495
final Path rectanglePath = Path()
8596
..addRRect(
8697
RRect.fromRectAndRadius(
87-
Offset(rectPos.dx - offsetRectAndText.dx, rectPos.dy - offsetRectAndText.dy) & rectSize,
98+
Offset(rectPos.dx - offsetRectAndText.dx,
99+
rectPos.dy - offsetRectAndText.dy) &
100+
rectSize,
88101
Radius.circular(radius),
89102
),
90103
);

0 commit comments

Comments
 (0)