1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-12 07:48:55 +00:00

web/charts: Migrate to null safety (#921)

This commit is contained in:
Brett Morgan
2021-10-08 16:39:37 +11:00
committed by GitHub
parent d14e79b833
commit 8932e60976
106 changed files with 355 additions and 346 deletions

View File

@@ -25,10 +25,10 @@ import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
class DatumLegendOptions extends StatelessWidget {
final List<charts.Series> seriesList;
final bool animate;
final List<charts.Series<dynamic, int>> seriesList;
final bool? animate;
const DatumLegendOptions(this.seriesList, {this.animate, Key key})
const DatumLegendOptions(this.seriesList, {this.animate, Key? key})
: super(key: key);
factory DatumLegendOptions.withSampleData() {

View File

@@ -29,9 +29,9 @@ import 'package:charts_flutter/flutter.dart' as charts;
/// Also shows the option to provide a custom measure formatter.
class DatumLegendWithMeasures extends StatelessWidget {
final List<charts.Series<LinearSales, int>> seriesList;
final bool animate;
final bool? animate;
const DatumLegendWithMeasures(this.seriesList, {this.animate, Key key})
const DatumLegendWithMeasures(this.seriesList, {this.animate, Key? key})
: super(key: key);
factory DatumLegendWithMeasures.withSampleData() {
@@ -110,7 +110,7 @@ class DatumLegendWithMeasures extends StatelessWidget {
legendDefaultMeasure: charts.LegendDefaultMeasure.firstValue,
// Optionally provide a measure formatter to format the measure value.
// If none is specified the value is formatted as a decimal.
measureFormatter: (num value) {
measureFormatter: (num? value) {
return value == null ? '-' : '${value}k';
},
),

View File

@@ -21,10 +21,10 @@ import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
class DefaultHiddenSeriesLegend extends StatelessWidget {
final List<charts.Series> seriesList;
final bool animate;
final List<charts.Series<dynamic, String>> seriesList;
final bool? animate;
const DefaultHiddenSeriesLegend(this.seriesList, {this.animate, Key key})
const DefaultHiddenSeriesLegend(this.seriesList, {this.animate, Key? key})
: super(key: key);
factory DefaultHiddenSeriesLegend.withSampleData() {

View File

@@ -30,11 +30,11 @@ class IconRenderer extends charts.CustomSymbolRenderer {
@override
Widget build(BuildContext context,
{Size size, Color color, bool enabled = true}) {
{Size? size, Color? color, bool enabled = true}) {
// Lighten the color if the symbol is not enabled
// Example: If user has tapped on a Series deselecting it.
if (!enabled) {
color = color.withOpacity(0.26);
color = color!.withOpacity(0.26);
}
return SizedBox.fromSize(
@@ -43,10 +43,10 @@ class IconRenderer extends charts.CustomSymbolRenderer {
}
class LegendWithCustomSymbol extends StatelessWidget {
final List<charts.Series> seriesList;
final bool animate;
final List<charts.Series<dynamic, String>> seriesList;
final bool? animate;
const LegendWithCustomSymbol(this.seriesList, {this.animate, Key key})
const LegendWithCustomSymbol(this.seriesList, {this.animate, Key? key})
: super(key: key);
factory LegendWithCustomSymbol.withSampleData() {

View File

@@ -25,10 +25,10 @@ import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
class LegendOptions extends StatelessWidget {
final List<charts.Series> seriesList;
final bool animate;
final List<charts.Series<dynamic, String>> seriesList;
final bool? animate;
const LegendOptions(this.seriesList, {this.animate, Key key})
const LegendOptions(this.seriesList, {this.animate, Key? key})
: super(key: key);
factory LegendOptions.withSampleData() {

View File

@@ -29,10 +29,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
///
/// Also shows the option to provide a custom measure formatter.
class LegendWithMeasures extends StatelessWidget {
final List<charts.Series> seriesList;
final bool animate;
final List<charts.Series<dynamic, String>> seriesList;
final bool? animate;
const LegendWithMeasures(this.seriesList, {this.animate, Key key})
const LegendWithMeasures(this.seriesList, {this.animate, Key? key})
: super(key: key);
factory LegendWithMeasures.withSampleData() {
@@ -153,7 +153,7 @@ class LegendWithMeasures extends StatelessWidget {
showMeasures: true,
// Optionally provide a measure formatter to format the measure value.
// If none is specified the value is formatted as a decimal.
measureFormatter: (num value) {
measureFormatter: (num? value) {
return value == null ? '-' : '${value}k';
},
),

View File

@@ -21,10 +21,10 @@ import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
class SimpleDatumLegend extends StatelessWidget {
final List<charts.Series> seriesList;
final bool animate;
final List<charts.Series<dynamic, int>> seriesList;
final bool? animate;
const SimpleDatumLegend(this.seriesList, {this.animate, Key key})
const SimpleDatumLegend(this.seriesList, {this.animate, Key? key})
: super(key: key);
factory SimpleDatumLegend.withSampleData() {

View File

@@ -21,10 +21,10 @@ import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
class SimpleSeriesLegend extends StatelessWidget {
final List<charts.Series> seriesList;
final bool animate;
final List<charts.Series<dynamic, String>> seriesList;
final bool? animate;
const SimpleSeriesLegend(this.seriesList, {this.animate, Key key})
const SimpleSeriesLegend(this.seriesList, {this.animate, Key? key})
: super(key: key);
factory SimpleSeriesLegend.withSampleData() {