Skip to content

Provide Diagnosticable mixin to ButtonStyleButton buttons #99975

@TahaTesser

Description

@TahaTesser

Context: #99753 (comment)

Description

When refactoring FAB to include a ElevatedButton, flutter/dev/integration_tests/flutter_gallery/test/smoke_test.dart test fail with the following error, source

00:25 +33 ~1: /b/s/w/ir/x/w/flutter/dev/integration_tests/flutter_gallery/test/smoke_test.dart: Flutter Gallery app smoke test with semantics
debugDumpApp : /pesto : line 1790 of 1828 : found a class that does not have its own toString; nearby lines were:
└Offstage(offstage: false, renderObject: RenderOffstage#595a2 relayoutBoundary=up6)
└TickerMode(dependencies: [_EffectiveTickerMode], state: _TickerModeState#0b837(requested mode: enabled))
 └_EffectiveTickerMode(effective mode: enabled)
  └KeyedSubtree-[GlobalKey#c3307]
   └ElevatedButton(style: ButtonStyle#e700f(textStyle: MaterialStateProperty.all(TextStyle(debugLabel: (((englishLike labelLarge 2014).merge(blackMountainView labelLarge)).copyWith).copyWith, inherit: false, color: Color(0xffffffff), family: Roboto, size: 14.0, weight: 500, letterSpacing: 1.2, baseline: alphabetic, decoration: TextDecoration.none)), backgroundColor: MaterialStateProperty.all(MaterialAccentColor(primary value: Color(0xffff5252))), foregroundColor: MaterialStateProperty.all(Color(0xffffffff)), overlayColor: Instance of '_MaterialStatePropertyWith<Color?>', elevation: _EffectiveElevation#b22b4, padding: MaterialStateProperty.all(EdgeInsets.zero), minimumSize: MaterialStateProperty.all(Size(56.0, 56.0)), maximumSize: MaterialStateProperty.all(Size(56.0, 56.0)), shape: MaterialStateProperty.all(CircleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none))), mouseCursor: MaterialStateProperty.all(null), visualDensity: VisualDensity#bdc2a(h: 0.0, v: 0.0), tapTargetSize: padded, animationDuration: 0:00:00.200000, enableFeedback: true), dependencies: [MediaQuery, _LocalizationsScope-[GlobalKey#4bd84], _InheritedTheme], state: _ButtonStyleState#dc507(materialStates: {}))
    └Semantics(container: true, properties: SemanticsProperties, renderObject: RenderSemanticsAnnotations#9f356 relayoutBoundary=up7)
     └_InputPadding(renderObject: _RenderInputPadding#429a8 relayoutBoundary=up8)
      └ConstrainedBox(BoxConstraints(w=56.0, h=56.0), renderObject: RenderConstrainedBox#ead6b relayoutBoundary=up9)
       └Material(type: button, elevation: 6.0, color: MaterialAccentColor(primary value: Color(0xffff5252)), shadowColor: Color(0xff000000), textStyle.debugLabel: ((((englishLike labelLarge 2014).merge(blackMountainView labelLarge)).copyWith).copyWith).copyWith, textStyle.inherit: false, textStyle.color: Color(0xffffffff), textStyle.family: Roboto, textStyle.size: 14.0, textStyle.weight: 500, textStyle.letterSpacing: 1.2, textStyle.baseline: alphabetic, textStyle.decoration: TextDecoration.none, shape: CircleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none)), dependencies: [_LocalizationsScope-[GlobalKey#4bd84], _InheritedTheme], state: _MaterialState#5e512)
        └_MaterialInterior(duration: 200ms, shape: CircleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none)), elevation: 6.0, color: MaterialAccentColor(p

Solution

Provide Diagnosticable mixin to ButtonStyleButton buttons

Result after solution

✓ Flutter Gallery app smoke test (variant: TargetPlatform.android)
✓ Flutter Gallery app smoke test (variant: TargetPlatform.macOS)
✓ Flutter Gallery app smoke test with semantics

Metadata

Metadata

Assignees

Labels

a: tests"flutter test", flutter_test, or one of our testsf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions