Skip to content

SystemUiOverlayStyle should be a Diagnosticable subclass #169248

Closed

Description

@huycozy

Use case

While working on #169130, adding a DiagnosticsProperty for SystemUiOverlayStyle requires declaring a very long description, to pass the test for implements debugFillProperties:

https://github.com/flutter/flutter/pull/169130/files#diff-05d6650782d071fca6c2bd8e02381b8748b13ca70af9f189c2e4789690b0ab42R587-R595:

properties.add(
      DiagnosticsProperty<SystemUiOverlayStyle>(
        'systemOverlayStyle',
        systemOverlayStyle,
        defaultValue: null,
        description:
            systemOverlayStyle == null
                ? null
                : 'SystemUiOverlayStyle(${<String>[if (systemOverlayStyle?.systemNavigationBarColor != null) 'systemNavigationBarColor: ${systemOverlayStyle?.systemNavigationBarColor}', if (systemOverlayStyle?.systemNavigationBarDividerColor != null) 'systemNavigationBarDividerColor: ${systemOverlayStyle?.systemNavigationBarDividerColor}', if (systemOverlayStyle?.systemNavigationBarIconBrightness != null) 'systemNavigationBarIconBrightness: ${systemOverlayStyle?.systemNavigationBarIconBrightness}', if (systemOverlayStyle?.statusBarColor != null) 'statusBarColor: ${systemOverlayStyle?.statusBarColor}', if (systemOverlayStyle?.statusBarBrightness != null) 'statusBarBrightness: ${systemOverlayStyle?.statusBarBrightness}', if (systemOverlayStyle?.statusBarIconBrightness != null) 'statusBarIconBrightness: ${systemOverlayStyle?.statusBarIconBrightness}', if (systemOverlayStyle?.systemStatusBarContrastEnforced != null) 'systemStatusBarContrastEnforced: ${systemOverlayStyle?.systemStatusBarContrastEnforced}', if (systemOverlayStyle?.systemNavigationBarContrastEnforced != null) 'systemNavigationBarContrastEnforced: ${systemOverlayStyle?.systemNavigationBarContrastEnforced}'].where((s) => s.isNotEmpty).join(', ')})',
      ),

https://github.com/flutter/flutter/pull/169130/files#diff-309c2663b436860c5e1be1ed6ecd3b8bb5194960ec5b45366e35041a25dc007dR1168-R1217:

    final List<String> description =
        builder.properties
            .where((DiagnosticsNode node) => !node.isFiltered(DiagnosticLevel.info))
            .map((DiagnosticsNode node) => node.toString())
            .toList();

    expect(
      description,
      equalsIgnoringHashCodes(<String>[
        'backgroundColor: ${const Color(0xff000000)}',
        'foregroundColor: ${const Color(0xff000001)}',
        'elevation: 8.0',
        'scrolledUnderElevation: 3.0',
        'shadowColor: ${const Color(0xff000002)}',
        'surfaceTintColor: ${const Color(0xff000003)}',
        'shape: StadiumBorder(BorderSide(width: 0.0, style: none))',
        'iconTheme: IconThemeData#00000(color: ${const Color(0xff000004)})',
        'actionsIconTheme: IconThemeData#00000(color: ${const Color(0xff000004)})',
        'centerTitle: true',
        'titleSpacing: 40.0',
        'leadingWidth: 96.0',
        'toolbarHeight: 96.0',
        'toolbarTextStyle: TextStyle(inherit: true, color: ${const Color(0xff000005)})',
        'titleTextStyle: TextStyle(inherit: true, color: ${const Color(0xff000006)})',
        'systemOverlayStyle: SystemUiOverlayStyle#00000(systemNavigationBarColor: ${const Color(0xff000007)})',
        'actionsPadding: EdgeInsets(8.0, 0.0, 8.0, 0.0)',
      ]),
    );

Proposal

SystemUIOverlayStyle should implement Diagnosticable and provide its own debugFillProperties, similar to some other styles, like AnimationStyle:

class AnimationStyle with Diagnosticable {

or TextStyle:

class TextStyle with Diagnosticable {

Activity

  1. added
    in triagePresently being triaged by the triage team
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on May 22, 2025
  2. self-assigned this
    on May 22, 2025
  3. moved this from To do to In progress in Nevercodeon May 22, 2025
  4. added
    P2Important issues not at the top of the work list
    on Jun 4, 2025
  5. moved this from In progress to To do in Nevercodeon Jul 28, 2025
  6. moved this from To do to In progress in Nevercodeon Aug 19, 2025
  7. moved this from In progress to PR submitted in Nevercodeon Aug 19, 2025
  8. moved this from PR submitted to Done (PR merged) in Nevercodeon Aug 26, 2025
  9. added
    r: fixedIssue is closed as already fixed in a newer version
    on Aug 26, 2025
  10. github-actions commented on Sep 9, 2025

    @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.

  11. locked as resolved and limited conversation to collaborators on Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

  • Status
    Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions