From cdacdb7d235707901ef75fe3ef8eed58cd11f338 Mon Sep 17 00:00:00 2001 From: FIRST_NAME LAST_NAME Date: Thu, 18 Feb 2021 17:19:47 +0330 Subject: [PATCH] Migrate base_chart_painter, axis_chart_painter --- .../chart/base/axis_chart/axis_chart_painter.dart | 12 ++++-------- .../chart/base/base_chart/base_chart_painter.dart | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/src/chart/base/axis_chart/axis_chart_painter.dart b/lib/src/chart/base/axis_chart/axis_chart_painter.dart index 4106a3b22..1ce35667b 100644 --- a/lib/src/chart/base/axis_chart/axis_chart_painter.dart +++ b/lib/src/chart/base/axis_chart/axis_chart_painter.dart @@ -17,12 +17,12 @@ import 'axis_chart_data.dart'; /// [data] is the currently showing data (it may produced by an animation using lerp function), /// [targetData] is the target data, that animation is going to show (if animating) abstract class AxisChartPainter extends BaseChartPainter { - Paint _gridPaint, _backgroundPaint; + late Paint _gridPaint, _backgroundPaint; /// [_rangeAnnotationPaint] draws range annotations; - Paint _rangeAnnotationPaint; + late Paint _rangeAnnotationPaint; - AxisChartPainter(D data, D targetData, {double textScale}) + AxisChartPainter(D data, D targetData, {required double textScale}) : super(data, targetData, textScale: textScale) { _gridPaint = Paint()..style = PaintingStyle.stroke; @@ -200,7 +200,7 @@ abstract class AxisChartPainter extends BaseChartPainte } void _drawGrid(CanvasWrapper canvasWrapper) { - if (!data.gridData.show || data.gridData == null) { + if (!data.gridData.show) { return; } final viewSize = canvasWrapper.size; @@ -291,10 +291,6 @@ abstract class AxisChartPainter extends BaseChartPainte } void _drawRangeAnnotation(CanvasWrapper canvasWrapper) { - if (data.rangeAnnotations == null) { - return; - } - final viewSize = canvasWrapper.size; final chartUsableSize = getChartUsableDrawSize(viewSize); diff --git a/lib/src/chart/base/base_chart/base_chart_painter.dart b/lib/src/chart/base/base_chart/base_chart_painter.dart index 58e3a6bc6..620936934 100644 --- a/lib/src/chart/base/base_chart/base_chart_painter.dart +++ b/lib/src/chart/base/base_chart/base_chart_painter.dart @@ -10,7 +10,7 @@ import 'touch_input.dart'; abstract class BaseChartPainter extends CustomPainter { final D data; final D targetData; - Paint _borderPaint; + late Paint _borderPaint; double textScale; /// Draws some basic things line border