-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Increase TimePicker touch targets #32053
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
Increase TimePicker touch targets #32053
Conversation
- Increased the AM/PM, minute and hour buttons to at least 48x48 - Added InkWells to all of them - Adjusted the landscape layout for the AM/PM buttons to be horizontal - Added a test to ensure the regions are at least 48x48
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
| class _DayPeriodControl extends StatelessWidget { | ||
| const _DayPeriodControl({ | ||
| @required this.fragmentContext, | ||
| @required this.orientation, |
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.
Looks like these values are assumed to be non-null; should assert that here
| child: Material( | ||
| type: MaterialType.transparency, | ||
| child: InkWell( | ||
| onTap: Feedback.wrapForTap(() => _setAm(context), context), |
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.
The => is usually reserved for one-liners that return a value. This is OK:
Feedback.wrapForTap(() { _setAm(context); }, context),
Here and below
| _TimePickerHeaderFormat _buildHeaderFormat( | ||
| TimeOfDayFormat timeOfDayFormat, | ||
| _TimePickerFragmentContext context, | ||
| Orientation orientation |
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.
need a trailing comma
| }); | ||
|
|
||
| testWidgets('header touch regions are large enough', (WidgetTester tester) async { | ||
| await mediaQueryBoilerplate(tester, false); |
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.
Someday we should give this function a more meaningful name.
Description
This PR increases the remaining touch target sizes in the Material Time Picker that weren't handled in #19936. The AM/PM, minute and hour buttons have all be increased to at least 48x48dp. In addition I have added an InkWell to each of them for better user feedback.
Examples of the new layouts:

Related #Issues
Fixes: #18130
Tests
I added a test to ensure the size of all the header touch targets are at least 48x48.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?