mirror of
https://github.com/flutter/samples.git
synced 2026-04-25 08:22:16 +00:00
web/charts: Migrate to null safety (#921)
This commit is contained in:
@@ -36,10 +36,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
/// RTL.flipAxisLocations is set.
|
||||
class BarChartWithSecondaryAxis extends StatelessWidget {
|
||||
static const secondaryMeasureAxisId = 'secondaryMeasureAxisId';
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const BarChartWithSecondaryAxis(this.seriesList, {this.animate, Key key})
|
||||
const BarChartWithSecondaryAxis(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory BarChartWithSecondaryAxis.withSampleData() {
|
||||
|
||||
@@ -30,10 +30,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
/// RTL.flipAxisLocations is set.
|
||||
class BarChartWithSecondaryAxisOnly extends StatelessWidget {
|
||||
static const secondaryMeasureAxisId = 'secondaryMeasureAxisId';
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const BarChartWithSecondaryAxisOnly(this.seriesList, {this.animate, Key key})
|
||||
const BarChartWithSecondaryAxisOnly(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory BarChartWithSecondaryAxisOnly.withSampleData() {
|
||||
|
||||
@@ -22,10 +22,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class CustomAxisTickFormatters extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, DateTime>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const CustomAxisTickFormatters(this.seriesList, {this.animate, Key key})
|
||||
const CustomAxisTickFormatters(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
/// Creates a [TimeSeriesChart] with sample data and no transition.
|
||||
|
||||
@@ -26,10 +26,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
/// There are many axis styling options in the SmallTickRenderer allowing you
|
||||
/// to customize the font, tick lengths, and offsets.
|
||||
class CustomFontSizeAndColor extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const CustomFontSizeAndColor(this.seriesList, {this.animate, Key key})
|
||||
const CustomFontSizeAndColor(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory CustomFontSizeAndColor.withSampleData() {
|
||||
|
||||
@@ -25,10 +25,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomMeasureTickCount extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, DateTime>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const CustomMeasureTickCount(this.seriesList, {this.animate, Key key})
|
||||
const CustomMeasureTickCount(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
/// Creates a [TimeSeriesChart] with sample data and no transition.
|
||||
|
||||
@@ -29,10 +29,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
/// Note: primary and secondary may flip left and right positioning when
|
||||
/// RTL.flipAxisLocations is set.
|
||||
class FlippedVerticalAxis extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const FlippedVerticalAxis(this.seriesList, {this.animate, Key key})
|
||||
const FlippedVerticalAxis(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory FlippedVerticalAxis.withSampleData() {
|
||||
|
||||
@@ -21,10 +21,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class GridlineDashPattern extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, DateTime>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const GridlineDashPattern(this.seriesList, {this.animate, Key key})
|
||||
const GridlineDashPattern(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
/// Creates a [TimeSeriesChart] with sample data and no transition.
|
||||
|
||||
@@ -22,10 +22,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
|
||||
/// Example of hiding both axis.
|
||||
class HiddenTicksAndLabelsAxis extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const HiddenTicksAndLabelsAxis(this.seriesList, {this.animate, Key key})
|
||||
const HiddenTicksAndLabelsAxis(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory HiddenTicksAndLabelsAxis.withSampleData() {
|
||||
|
||||
@@ -36,11 +36,11 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
/// RTL.flipAxisLocations is set.
|
||||
class HorizontalBarChartWithSecondaryAxis extends StatelessWidget {
|
||||
static const secondaryMeasureAxisId = 'secondaryMeasureAxisId';
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const HorizontalBarChartWithSecondaryAxis(this.seriesList,
|
||||
{this.animate, Key key})
|
||||
{this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory HorizontalBarChartWithSecondaryAxis.withSampleData() {
|
||||
|
||||
@@ -26,10 +26,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class IntegerOnlyMeasureAxis extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, DateTime>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const IntegerOnlyMeasureAxis(this.seriesList, {this.animate, Key key})
|
||||
const IntegerOnlyMeasureAxis(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
/// Creates a [TimeSeriesChart] with sample data and no transition.
|
||||
|
||||
@@ -28,10 +28,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DisjointMeasureAxisLineChart extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, num>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const DisjointMeasureAxisLineChart(this.seriesList, {this.animate, Key key})
|
||||
const DisjointMeasureAxisLineChart(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
/// Creates a [LineChart] with sample data and no transition.
|
||||
@@ -263,8 +263,8 @@ class DisjointMeasureAxisLineChart extends StatelessWidget {
|
||||
/// Sample linear data type.
|
||||
class LinearClicks {
|
||||
final int year;
|
||||
final int clickCount;
|
||||
final double clickRate;
|
||||
final int? clickCount;
|
||||
final double? clickRate;
|
||||
|
||||
LinearClicks(this.year, {this.clickCount, this.clickRate});
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
/// Example of using a custom primary measure replacing the renderSpec with one
|
||||
/// that aligns the text under the tick and left justifies.
|
||||
class MeasureAxisLabelAlignment extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const MeasureAxisLabelAlignment(this.seriesList, {this.animate, Key key})
|
||||
const MeasureAxisLabelAlignment(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory MeasureAxisLabelAlignment.withSampleData() {
|
||||
|
||||
@@ -22,10 +22,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NonzeroBoundMeasureAxis extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, DateTime>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const NonzeroBoundMeasureAxis(this.seriesList, {this.animate, Key key})
|
||||
const NonzeroBoundMeasureAxis(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
/// Creates a [TimeSeriesChart] with sample data and no transition.
|
||||
|
||||
@@ -29,10 +29,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NumericInitialViewport extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, num>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const NumericInitialViewport(this.seriesList, {this.animate, Key key})
|
||||
const NumericInitialViewport(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
/// Creates a [LineChart] with sample data and no transition.
|
||||
|
||||
@@ -29,10 +29,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OrdinalInitialViewport extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const OrdinalInitialViewport(this.seriesList, {this.animate, Key key})
|
||||
const OrdinalInitialViewport(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
/// Creates a [BarChart] with sample data and no transition.
|
||||
|
||||
@@ -27,10 +27,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
/// There are many axis styling options in the SmallTickRenderer allowing you
|
||||
/// to customize the font, tick lengths, and offsets.
|
||||
class ShortTickLengthAxis extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const ShortTickLengthAxis(this.seriesList, {this.animate, Key key})
|
||||
const ShortTickLengthAxis(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory ShortTickLengthAxis.withSampleData() {
|
||||
|
||||
@@ -34,10 +34,10 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||
/// For datetime axis, the [StaticDateTimeTickProviderSpec] can be used by
|
||||
/// passing in a list of ticks defined with [TickSpec] of datetime.
|
||||
class StaticallyProvidedTicks extends StatelessWidget {
|
||||
final List<charts.Series> seriesList;
|
||||
final bool animate;
|
||||
final List<charts.Series<dynamic, String>> seriesList;
|
||||
final bool? animate;
|
||||
|
||||
const StaticallyProvidedTicks(this.seriesList, {this.animate, Key key})
|
||||
const StaticallyProvidedTicks(this.seriesList, {this.animate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
factory StaticallyProvidedTicks.withSampleData() {
|
||||
|
||||
Reference in New Issue
Block a user