fix(treewide): migrate to sound null safety
Signed-off-by: Sphericalkat <me@kat.bio>
This commit is contained in:
12 files changed
+86
-86
No files matched your search
@@ -57,7 +57,7 @@ class _AnimatedPieChartExampleState extends State<AnimatedPieChartExample> {
|
||||
setState(() {
|
||||
sampleIndex++;
|
||||
List<CircularStackEntry> data = _quarterlyProfitPieData[sampleIndex % 3];
|
||||
_chartKey.currentState.updateData(data);
|
||||
_chartKey.currentState!.updateData(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@ class _AnimatedRadialChartExampleState extends State<AnimatedRadialChartExample>
|
||||
final _chartSize = const Size(200.0, 200.0);
|
||||
|
||||
double value = 50.0;
|
||||
Color labelColor = Colors.blue[200];
|
||||
Color? labelColor = Colors.blue[200];
|
||||
|
||||
void _increment() {
|
||||
setState(() {
|
||||
value += 10;
|
||||
List<CircularStackEntry> data = _generateChartData(value);
|
||||
_chartKey.currentState.updateData(data);
|
||||
_chartKey.currentState!.updateData(data);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ class _AnimatedRadialChartExampleState extends State<AnimatedRadialChartExample>
|
||||
setState(() {
|
||||
value -= 10;
|
||||
List<CircularStackEntry> data = _generateChartData(value);
|
||||
_chartKey.currentState.updateData(data);
|
||||
_chartKey.currentState!.updateData(data);
|
||||
});
|
||||
}
|
||||
|
||||
List<CircularStackEntry> _generateChartData(double value) {
|
||||
Color dialColor = Colors.blue[200];
|
||||
Color? dialColor = Colors.blue[200];
|
||||
if (value < 0) {
|
||||
dialColor = Colors.red[200];
|
||||
} else if (value < 50) {
|
||||
@@ -78,7 +78,7 @@ class _AnimatedRadialChartExampleState extends State<AnimatedRadialChartExample>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
TextStyle _labelStyle =
|
||||
Theme.of(context).textTheme.headline6.merge(TextStyle(color: labelColor));
|
||||
Theme.of(context).textTheme.headline6!.merge(TextStyle(color: labelColor));
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -19,7 +19,7 @@ class _RandomizedRadialChartExampleState extends State<RandomizedRadialChartExam
|
||||
final GlobalKey<AnimatedCircularChartState> _chartKey = GlobalKey<AnimatedCircularChartState>();
|
||||
final _chartSize = const Size(300.0, 300.0);
|
||||
final Math.Random random = Math.Random();
|
||||
List<CircularStackEntry> data;
|
||||
List<CircularStackEntry>? data;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -32,7 +32,7 @@ class _RandomizedRadialChartExampleState extends State<RandomizedRadialChartExam
|
||||
void _randomize() {
|
||||
setState(() {
|
||||
data = _generateRandomData();
|
||||
_chartKey.currentState.updateData(data);
|
||||
_chartKey.currentState!.updateData(data!);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class _RandomizedRadialChartExampleState extends State<RandomizedRadialChartExam
|
||||
List<CircularStackEntry> data = List.generate(stackCount, (i) {
|
||||
int segCount = random.nextInt(10);
|
||||
List<CircularSegmentEntry> segments = List.generate(segCount, (j) {
|
||||
Color randomColor = ColorPalette.primary.random(random);
|
||||
Color? randomColor = ColorPalette.primary.random(random);
|
||||
return CircularSegmentEntry(random.nextDouble(), randomColor);
|
||||
});
|
||||
return CircularStackEntry(segments);
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:math';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ColorPalette {
|
||||
static final ColorPalette primary = ColorPalette(<Color>[
|
||||
static final ColorPalette primary = ColorPalette(<Color?>[
|
||||
Colors.blue[400],
|
||||
Colors.blue[200],
|
||||
Colors.red[400],
|
||||
@@ -21,15 +21,15 @@ class ColorPalette {
|
||||
Colors.black,
|
||||
]);
|
||||
|
||||
ColorPalette(List<Color> colors) : _colors = colors {
|
||||
ColorPalette(List<Color?> colors) : _colors = colors {
|
||||
assert(colors.isNotEmpty);
|
||||
}
|
||||
|
||||
final List<Color> _colors;
|
||||
final List<Color?> _colors;
|
||||
|
||||
Color operator [](int index) => _colors[index % length];
|
||||
Color? operator [](int index) => _colors[index % length];
|
||||
|
||||
int get length => _colors.length;
|
||||
|
||||
Color random(Random random) => this[random.nextInt(length)];
|
||||
Color? random(Random random) => this[random.nextInt(length)];
|
||||
}
|
||||
Reference in new issue
Block a user