Skip to content

Commit

Permalink
chore: Update sdk & resolve lints
Browse files Browse the repository at this point in the history
  • Loading branch information
lsaudon authored and imaNNeo committed Oct 10, 2022
1 parent a7058be commit ce70d6e
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 80 deletions.
3 changes: 1 addition & 2 deletions lib/src/chart/bar_chart/bar_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ class BarChart extends ImplicitlyAnimatedWidget {
const BarChart(
this.data, {
this.chartRendererKey,
Key? key,
super.key,
Duration swapAnimationDuration = const Duration(milliseconds: 150),
Curve swapAnimationCurve = Curves.linear,
}) : super(
key: key,
duration: swapAnimationDuration,
curve: swapAnimationCurve,
);
Expand Down
9 changes: 3 additions & 6 deletions lib/src/chart/bar_chart/bar_chart_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class BarChartData extends AxisChartData with EquatableMixin {
BarTouchData? barTouchData,
double? maxY,
double? minY,
double? baselineY,
super.baselineY,
FlGridData? gridData,
FlBorderData? borderData,
super.borderData,
RangeAnnotations? rangeAnnotations,
Color? backgroundColor,
super.backgroundColor,
}) : barGroups = barGroups ?? const [],
groupsSpace = groupsSpace ?? 16,
alignment = alignment ?? BarChartAlignment.spaceEvenly,
Expand All @@ -58,17 +58,14 @@ class BarChartData extends AxisChartData with EquatableMixin {
),
),
gridData: gridData ?? FlGridData(),
borderData: borderData,
rangeAnnotations: rangeAnnotations ?? RangeAnnotations(),
backgroundColor: backgroundColor,
touchData: barTouchData ?? BarTouchData(),
minX: 0,
maxX: 1,
maxY: maxY ??
BarChartHelper.calculateMaxAxisValues(barGroups ?? []).maxY,
minY: minY ??
BarChartHelper.calculateMaxAxisValues(barGroups ?? []).minY,
baselineY: baselineY,
);

/// [BarChart] draws [barGroups] that each of them contains a list of [BarChartRodData].
Expand Down
3 changes: 1 addition & 2 deletions lib/src/chart/bar_chart/bar_chart_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import 'package:flutter/cupertino.dart';

/// Low level BarChart Widget.
class BarChartLeaf extends LeafRenderObjectWidget {
const BarChartLeaf({Key? key, required this.data, required this.targetData})
: super(key: key);
const BarChartLeaf({super.key, required this.data, required this.targetData});

final BarChartData data;
final BarChartData targetData;
Expand Down
7 changes: 3 additions & 4 deletions lib/src/chart/base/axis_chart/axis_chart_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ abstract class AxisChartData extends BaseChartData with EquatableMixin {
double? baselineY,
FlClipData? clipData,
Color? backgroundColor,
FlBorderData? borderData,
required FlTouchData touchData,
super.borderData,
required super.touchData,
}) : gridData = gridData ?? FlGridData(),
rangeAnnotations = rangeAnnotations ?? RangeAnnotations(),
baselineX = baselineX ?? 0,
baselineY = baselineY ?? 0,
clipData = clipData ?? FlClipData.none(),
backgroundColor = backgroundColor ?? Colors.transparent,
super(borderData: borderData, touchData: touchData);
backgroundColor = backgroundColor ?? Colors.transparent;
final FlGridData gridData;
final FlTitlesData titlesData;
final RangeAnnotations rangeAnnotations;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/chart/base/axis_chart/axis_chart_scaffold_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import 'package:flutter/material.dart';

class AxisChartScaffoldWidget extends StatelessWidget {
const AxisChartScaffoldWidget({
Key? key,
super.key,
required this.chart,
required this.data,
}) : super(key: key);
});
final Widget chart;
final AxisChartData data;

Expand Down
4 changes: 2 additions & 2 deletions lib/src/chart/base/axis_chart/axis_chart_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import 'package:flutter/widgets.dart';
/// You can also fill [angle] in radians if you need to rotate your widget.
class SideTitleWidget extends StatelessWidget {
const SideTitleWidget({
Key? key,
super.key,
required this.child,
required this.axisSide,
this.space = 8.0,
this.angle = 0.0,
}) : super(key: key);
});
final AxisSide axisSide;
final double space;
final Widget child;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import 'package:flutter/rendering.dart';
/// Inspired from [Flex]
class SideTitlesFlex extends MultiChildRenderObjectWidget {
SideTitlesFlex({
Key? key,
super.key,
required this.direction,
required this.axisSideMetaData,
List<AxisSideTitleWidgetHolder> widgetHolders =
const <AxisSideTitleWidgetHolder>[],
}) : axisSideTitlesMetaData = widgetHolders.map((e) => e.metaData).toList(),
super(key: key, children: widgetHolders.map((e) => e.widget).toList());
super(children: widgetHolders.map((e) => e.widget).toList());

final Axis direction;
final AxisSideMetaData axisSideMetaData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import 'package:flutter/material.dart';

class SideTitlesWidget extends StatelessWidget {
const SideTitlesWidget({
Key? key,
super.key,
required this.side,
required this.axisChartData,
required this.parentSize,
}) : super(key: key);
});
final AxisSide side;
final AxisChartData axisChartData;
final Size parentSize;
Expand Down Expand Up @@ -221,11 +221,10 @@ class SideTitlesWidget extends StatelessWidget {

class _AxisTitleWidget extends StatelessWidget {
const _AxisTitleWidget({
Key? key,
required this.axisTitles,
required this.side,
required this.axisViewSize,
}) : super(key: key);
});
final AxisTitles axisTitles;
final AxisSide side;
final double axisViewSize;
Expand Down
3 changes: 1 addition & 2 deletions lib/src/chart/line_chart/line_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ class LineChart extends ImplicitlyAnimatedWidget {
const LineChart(
this.data, {
this.chartRendererKey,
Key? key,
super.key,
Duration swapAnimationDuration = const Duration(milliseconds: 150),
Curve swapAnimationCurve = Curves.linear,
}) : super(
key: key,
duration: swapAnimationDuration,
curve: swapAnimationCurve,
);
Expand Down
32 changes: 12 additions & 20 deletions lib/src/chart/line_chart/line_chart_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ class LineChartData extends AxisChartData with EquatableMixin {
LineTouchData? lineTouchData,
List<ShowingTooltipIndicators>? showingTooltipIndicators,
FlGridData? gridData,
FlBorderData? borderData,
super.borderData,
RangeAnnotations? rangeAnnotations,
double? minX,
double? maxX,
double? baselineX,
super.baselineX,
double? minY,
double? maxY,
double? baselineY,
super.baselineY,
FlClipData? clipData,
Color? backgroundColor,
super.backgroundColor,
}) : lineBarsData = lineBarsData ?? const [],
betweenBarsData = betweenBarsData ?? const [],
extraLinesData = extraLinesData ?? ExtraLinesData(),
Expand All @@ -67,25 +67,21 @@ class LineChartData extends AxisChartData with EquatableMixin {
super(
gridData: gridData ?? FlGridData(),
touchData: lineTouchData ?? LineTouchData(),
borderData: borderData,
titlesData: titlesData ?? FlTitlesData(),
rangeAnnotations: rangeAnnotations ?? RangeAnnotations(),
clipData: clipData ?? FlClipData.none(),
backgroundColor: backgroundColor,
minX: minX ??
LineChartHelper.calculateMaxAxisValues(lineBarsData ?? const [])
.minX,
maxX: maxX ??
LineChartHelper.calculateMaxAxisValues(lineBarsData ?? const [])
.maxX,
baselineX: baselineX,
minY: minY ??
LineChartHelper.calculateMaxAxisValues(lineBarsData ?? const [])
.minY,
maxY: maxY ??
LineChartHelper.calculateMaxAxisValues(lineBarsData ?? const [])
.maxY,
baselineY: baselineY,
);

/// [LineChart] draws some lines in various shapes and overlaps them.
Expand Down Expand Up @@ -1076,14 +1072,13 @@ class HorizontalLine extends FlLine with EquatableMixin {
HorizontalLineLabel? label,
Color? color,
double? strokeWidth,
List<int>? dashArray,
super.dashArray,
this.image,
this.sizedPicture,
}) : label = label ?? HorizontalLineLabel(),
super(
color: color ?? Colors.black,
strokeWidth: strokeWidth ?? 2,
dashArray: dashArray,
);

/// Draws from left to right of the chart using the [y] value.
Expand Down Expand Up @@ -1144,14 +1139,13 @@ class VerticalLine extends FlLine with EquatableMixin {
VerticalLineLabel? label,
Color? color,
double? strokeWidth,
List<int>? dashArray,
super.dashArray,
this.image,
this.sizedPicture,
}) : label = label ?? VerticalLineLabel(),
super(
color: color ?? Colors.black,
strokeWidth: strokeWidth ?? 2,
dashArray: dashArray,
);

/// Draws from bottom to top of the chart using the [x] value.
Expand Down Expand Up @@ -1237,16 +1231,14 @@ class HorizontalLineLabel extends FlLineLabel with EquatableMixin {
/// /// [show] determines showing label or not.
HorizontalLineLabel({
EdgeInsets? padding,
TextStyle? style,
super.style,
Alignment? alignment,
bool show = false,
super.show = false,
String Function(HorizontalLine)? labelResolver,
}) : labelResolver =
labelResolver ?? HorizontalLineLabel.defaultLineLabelResolver,
super(
show: show,
padding: padding ?? const EdgeInsets.all(6),
style: style,
alignment: alignment ?? Alignment.topLeft,
);

Expand Down Expand Up @@ -1758,11 +1750,11 @@ class LineBarSpot extends FlSpot with EquatableMixin {
/// A [LineBarSpot] that holds information about the event that selected it
class TouchLineBarSpot extends LineBarSpot {
TouchLineBarSpot(
LineChartBarData bar,
int barIndex,
FlSpot spot,
super.bar,
super.barIndex,
super.spot,
this.distance,
) : super(bar, barIndex, spot);
);

/// Distance in pixels from where the user taped
final double distance;
Expand Down
7 changes: 5 additions & 2 deletions lib/src/chart/line_chart/line_chart_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import 'package:flutter/material.dart';

/// Low level LineChart Widget.
class LineChartLeaf extends LeafRenderObjectWidget {
const LineChartLeaf({Key? key, required this.data, required this.targetData})
: super(key: key);
const LineChartLeaf({
super.key,
required this.data,
required this.targetData,
});

final LineChartData data;
final LineChartData targetData;
Expand Down
3 changes: 1 addition & 2 deletions lib/src/chart/pie_chart/pie_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ class PieChart extends ImplicitlyAnimatedWidget {
/// which default is [Curves.linear].
const PieChart(
this.data, {
Key? key,
super.key,
Duration swapAnimationDuration = defaultDuration,
Curve swapAnimationCurve = Curves.linear,
}) : super(
key: key,
duration: swapAnimationDuration,
curve: swapAnimationCurve,
);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/chart/pie_chart/pie_chart_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import 'package:flutter/services.dart';
/// Low level PieChart Widget.
class PieChartLeaf extends MultiChildRenderObjectWidget {
PieChartLeaf({
Key? key,
super.key,
required this.data,
required this.targetData,
}) : super(key: key, children: targetData.sections.toWidgets());
}) : super(children: targetData.sections.toWidgets());

final PieChartData data;
final PieChartData targetData;
Expand Down
3 changes: 1 addition & 2 deletions lib/src/chart/radar_chart/radar_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ class RadarChart extends ImplicitlyAnimatedWidget {
/// which default is [Curves.linear].
const RadarChart(
this.data, {
Key? key,
super.key,
Duration swapAnimationDuration = const Duration(milliseconds: 150),
Curve swapAnimationCurve = Curves.linear,
}) : super(
key: key,
duration: swapAnimationDuration,
curve: swapAnimationCurve,
);
Expand Down
3 changes: 1 addition & 2 deletions lib/src/chart/radar_chart/radar_chart_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class RadarChartData extends BaseChartData with EquatableMixin {
BorderSide? tickBorderData,
BorderSide? gridBorderData,
RadarTouchData? radarTouchData,
FlBorderData? borderData,
super.borderData,
}) : assert(dataSets != null && dataSets.hasEqualDataEntriesLength),
assert(
tickCount == null || tickCount >= 1,
Expand All @@ -82,7 +82,6 @@ class RadarChartData extends BaseChartData with EquatableMixin {
tickBorderData = tickBorderData ?? const BorderSide(width: 2),
gridBorderData = gridBorderData ?? const BorderSide(width: 2),
super(
borderData: borderData,
touchData: radarTouchData ?? RadarTouchData(),
);

Expand Down
7 changes: 5 additions & 2 deletions lib/src/chart/radar_chart/radar_chart_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import 'package:flutter/cupertino.dart';

/// Low level RadarChart Widget.
class RadarChartLeaf extends LeafRenderObjectWidget {
const RadarChartLeaf({Key? key, required this.data, required this.targetData})
: super(key: key);
const RadarChartLeaf({
super.key,
required this.data,
required this.targetData,
});

final RadarChartData data;
final RadarChartData targetData;
Expand Down
3 changes: 1 addition & 2 deletions lib/src/chart/scatter_chart/scatter_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ class ScatterChart extends ImplicitlyAnimatedWidget {
const ScatterChart(
this.data, {
this.chartRendererKey,
Key? key,
super.key,
Duration swapAnimationDuration = const Duration(milliseconds: 150),
Curve swapAnimationCurve = Curves.linear,
}) : super(
key: key,
duration: swapAnimationDuration,
curve: swapAnimationCurve,
);
Expand Down
Loading

0 comments on commit ce70d6e

Please sign in to comment.