Skip to content

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

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

Activity

  1. changed the title [-]The comment of CircularProgressIndicator.adaptive() is misleading.[/-] [+]The comment of the CircularProgressIndicator.adaptive() is misleading.[/+] on Jan 7, 2023
  2. darshankawar commented on Jan 9, 2023

    @darshankawar
    Member

    Thanks for the report. Using below code sample, the listed property values are rendered for CircularProgressIndicator:

    Screenshot 2023-01-09 at 1 20 32 PM

    body: Center(
              child: CircularProgressIndicator(
                backgroundColor: Colors.blue,
                value: 0.5,
                valueColor: AlwaysStoppedAnimation(Colors.green),
                strokeWidth: 50,
              ),
          ),
    

    For CircularProgessIndicator.adaptive(), though, except backgroundColor, all other properties don't render:

    Screenshot 2023-01-09 at 1 20 49 PM

    Maybe a similar fix needed: #81427

    /cc @darrenaustin

  3. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    d: api docsIssues with https://api.flutter.dev/
    and removed
    in triagePresently being triaged by the triage team
    on Jan 9, 2023
  4. IsseiKanda commented on Jan 11, 2023

    @IsseiKanda
    Author

    Thank you for confirming the feature. I don't know if it's an expected feature but being able to change the backgroundColor is useful for my case.

  5. MitchellGoodwin commented on Jan 19, 2023

    @MitchellGoodwin
    Contributor

    Merged in

  6. added
    r: fixedIssue is closed as already fixed in a newer version
    on Jan 20, 2023
  7. github-actions commented on Mar 4, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

d: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesr: 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