-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Migrated Checkbox to Material 3 - Added Error State
#111153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrated Checkbox to Material 3 - Added Error State
#111153
Conversation
cd2bb82 to
9c3af95
Compare
HansMuller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| // so that they can be lerped between. | ||
| final Set<MaterialState> activeStates = states..add(MaterialState.selected); | ||
| final Set<MaterialState> inactiveStates = states..remove(MaterialState.selected); | ||
| final Set<MaterialState> errorState = states..add(MaterialState.error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing to read because states refers to a getter that constructs a new set rather than a local variable or a field. The code appears to be side-effecting the same set of states in each statement, rather than implicitly generating a new one each time that states appears in an expression. No need to fix this now, however if we refactor this code in the future...
| setState(() { | ||
| isChecked = value; | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing commas can be added here and elsewhere
| expect(focusNode.hasPrimaryFocus, isFalse); | ||
| expect( | ||
| Material.of(tester.element(find.byType(Checkbox))), | ||
| paints..path(color: theme.colorScheme.error)..path(color: theme.colorScheme.onError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove indent
This PR added an error state for the Checkbox. Fixes #104446
In order to use the Checkbox with the new Material 3 defaults, turn on the useMaterial3 flag in the ThemeData:
This PR adds a new property
isErrorforCheckbox. To show a checkbox in an error state, setisErrorto true.Pre-launch Checklist
///).