Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/progress_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
..strokeCap = strokeCap ?? StrokeCap.round
..style = PaintingStyle.stroke;
// If hasGap is true, draw the background arc with a gap.
if (hasGap && value! > _epsilon) {
if (hasGap && value != null && value! > _epsilon) {
final double arcRadius = arcActualSize.shortestSide / 2;
final double strokeRadius = strokeWidth / arcRadius;
final double gapRadius = trackGap! / arcRadius;
Expand Down
19 changes: 19 additions & 0 deletions packages/flutter/test/material/progress_indicator_theme_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,25 @@ void main() {
);
});

testWidgets(
'CircularProgressIndicator.year2023 set to false and provided circularTrackColor does not throw exception',
(WidgetTester tester) async {
const Color circularTrackColor = Color(0XFF0000FF);
final ThemeData theme = ThemeData(
progressIndicatorTheme: const ProgressIndicatorThemeData(
circularTrackColor: circularTrackColor,
year2023: false,
),
);

await tester.pumpWidget(
Theme(data: theme, child: const Center(child: CircularProgressIndicator())),
);

expect(tester.takeException(), null);
},
);

testWidgets(
'Opt into 2024 CircularProgressIndicator appearance with ProgressIndicatorThemeData.year2023',
(WidgetTester tester) async {
Expand Down