@@ -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