Skip to content

SegmentedButton displays wrong style on rebuild if disabled #140746

@jpwoodbu

Description

@jpwoodbu

Steps to reproduce

https://dartpad.dev/?id=fbfa77b9488f667f29c87ab672cdcea4 demonstrates the issue simply.

A two segment SegmentedButton widget has a null value for onSelectionChanged and when the widget is rebuilt when setState() is called, the widget changes its style even though no actual state was [changed.](url)

Expected results

The SegmentedButton widget should maintain its "disabled" style on rebuild.

Actual results

The SegmentedButton widget, on rebuild, has a style that appears it's enabled.

Code sample

https://dartpad.dev/?id=fbfa77b9488f667f29c87ab672cdcea4

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Dartpad reports "Based on Flutter 3.16.5 Dart SDK 3.2.3"

On my local installation, where I first discovered this:

$ flutter doctor -v
[✓] Flutter (Channel stable, 3.16.5, on Ubuntu 22.04.3 LTS 6.2.0-39-generic, locale en_US.UTF-8)
    • Flutter version 3.16.5 on channel stable at /home/jpwoodbu/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (10 days ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/jpwoodbu/Android/Sdk/
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /opt/google/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1.1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2023.1)
    • Android Studio at /opt/google/android-studio
    • Flutter plugin version 77.1.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.85.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.80.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.3 LTS 6.2.0-39-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 120.0.6099.129

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.found in release: 3.16Found to occur in 3.16found in release: 3.18Found to occur in 3.18frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions