Skip to content

Added MaterialStatesController, updated InkWell et al.#103167

Merged
HansMuller merged 11 commits intoflutter:masterfrom
HansMuller:material_states_controller
May 27, 2022
Merged

Added MaterialStatesController, updated InkWell et al.#103167
HansMuller merged 11 commits intoflutter:masterfrom
HansMuller:material_states_controller

Conversation

@HansMuller
Copy link
Contributor

@HansMuller HansMuller commented May 6, 2022

The new MaterialStatesController class is just a trivial ValueNotifier that manages a set of MaterialStates. InkWell and the ButtonStyle button classes use the statesController they're given to track state changes. If one is not provided then they create it.

A stateful widget that wants to track button or InkWell state changes itself, or add support for additional states, can do so by creating a private MaterialStatesController and passing it along. The example included in this PR demonstrates how support for MaterialState.selected can be added to a TextButton to turn it into a "toggle" button.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems c: contributor-productivity Team-specific productivity, code health, technical debt. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants