-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Use case
While working on #169130, adding a DiagnosticsProperty for SystemUiOverlayStyle requires declaring a very long description, to pass the test for implements debugFillProperties:
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(', ')})',
), 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 { |
ksokolovskyi
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Type
Projects
Status
Done (PR merged)