Skip to content

The comment of the CircularProgressIndicator.adaptive() is misleading. #118144

@IsseiKanda

Description

@IsseiKanda

Here's a comment of the CircularProgressIndicator.adaptive()

 /// Creates an adaptive progress indicator that is a
 /// [CupertinoActivityIndicator] in iOS and [CircularProgressIndicator] in
 /// material theme/non-iOS.
 ///
 /// The [value], [backgroundColor], [valueColor], [strokeWidth],
 /// [semanticsLabel], and [semanticsValue] will be ignored in iOS.
 ///
 /// {@macro flutter.material.ProgressIndicator.ProgressIndicator}
 const CircularProgressIndicator.adaptive({
   super.key,
   super.value,
   super.backgroundColor,
   super.valueColor,
   this.strokeWidth = 4.0,
   super.semanticsLabel,
   super.semanticsValue,
 }) : _indicatorType = _ActivityIndicatorType.adaptive;

I noticed that comment says that

/// The [value], [backgroundColor], [valueColor], [strokeWidth],
/// [semanticsLabel], and [semanticsValue] will be ignored in iOS.

but it is actually not true. The backgroundColor changes the color of the CircularProgressIndicator in IOS.
This comment is misleading so it should be changed.

Steps to Reproduce

  1. Execute flutter run on the code sample

Expected results:

CircularProgressIndicator with no backgroundColor

Actual results:

CircularProgressIndicator with a red backgroundColor

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(
          child: CircularProgressIndicator.adaptive(
        backgroundColor: Colors.red,
      )),
    );
  }
}

Simulator Screen Shot - iPhone 14 - 2023-01-08 at 03 01 00

Metadata

Metadata

Labels

d: api docsIssues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions