Skip to content

Tri-state Checkbox - #14611

Merged
HansMuller merged 6 commits into
flutter:masterfrom
HansMuller:indeterminate_checkbox
Feb 13, 2018
Merged

HansMuller merged 6 commits into
flutter:masterfrom
HansMuller:indeterminate_checkbox

Conversation

@HansMuller

Copy link
Copy Markdown
Contributor

Added optional support for tri-state checkboxes, i.e. a checkbox whose value can be true, false, or null.

The checkboxes on the right were created with triState: true, value: null.

checkbox

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[triState] and [value] on the last line

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[tryState]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably spell this "tristate", since "tri" isn't a word, but a prefix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[onChanged]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[value]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you mean by "applied to" in this paragraph

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. I think that phrasing would be confusing to our less mathematically-inclined users. I'd probably just say "will be called with the value" or some such.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what "applied to" means here either

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: missing newline after last argument

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[triState]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[triState], [value]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[triState], [value]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to convey the null state to the accessibility system

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to defer that to a separate PR. I've discussed it with @goderbauer; support for tristates isn't trivial.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave a TODO here and/or file a bug?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general we should have the rule that all new widgets support accessibility, text scaling, localization, and bidi out of the box, but if there's a reason to make an exception here then ok.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a TODO and filed #14677

@Hixie Hixie Feb 12, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if tristate is true, this doesn't seem to give the user a way to get back to the indeterminate state. It seems like if tristate is true, this should go in the loop false -> true -> indeterminate -> false.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was intentional however I see that HTML tristates do cycle this way. So we can too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason to do it this way is that if someone doesn't want this behaviour, they can easily just set tristate to false once the value isn't null, but if they do want this behaviour, there's nothing they can do if we don't implement it by default.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should verify that animations correctly handle:

true -> false
true -> indeterminate
false -> true
false -> indeterminate
indeterminate -> true
indeterminate -> false

@HansMuller

Copy link
Copy Markdown
Contributor Author

Added a TODO and filed #14674 for smooth segues for cases where the checkbox value changes in the middle its animation cycle

@Hixie

Hixie commented Feb 13, 2018

Copy link
Copy Markdown
Contributor

LGTM

@HansMuller
HansMuller merged commit 2aa9bb2 into flutter:master Feb 13, 2018
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants