Repository navigation
M3 TimePicker input mode has incorrect spacing and mode icon position is bit off #122471
Copy link
Copy link
Closed
Closed
Copy link
Labels
f: date/time pickerDate or time picker widgetsDate or time picker widgetsfound in release: 3.9Found to occur in 3.9Found to occur in 3.9frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages
Description
In the PM/AM time selection example, you can see that the two dots that are between the hour and minute selections are not centered, or the time entry fields are not stretched properly in width.
flutter doctor -v
[✓] Flutter (Channel master, 3.9.0-1.0.pre.121, on Microsoft Windows [Version 10.0.22621.1344], locale ru-UA)
• Flutter version 3.9.0-1.0.pre.121 on channel master at C:\Flutter-SDK\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ccfa0bd5a8 (2 days ago), 2023-03-09 08:24:17 -0500
• Engine revision a82207cee3
• Dart version 3.0.0 (build 3.0.0-312.0.dev)
• DevTools version 2.22.2
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\yablo\AppData\Local\Android\sdk
• Platform android-TiramisuPrivacySandbox, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.4.33403.182
• Windows 10 SDK version 10.0.22000.0
[✓] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
[✓] IntelliJ IDEA Community Edition (version 2022.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.1
• Flutter plugin version 72.0.4
• Dart plugin version 223.8617.8
[✓] VS Code (version 1.76.1)
• VS Code at C:\Users\yablo\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.60.0
[✓] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.1344]
• Chrome (web) • chrome • web-javascript • Google Chrome 110.0.5481.180
• Edge (web) • edge • web-javascript • Microsoft Edge 110.0.1587.69
[✓] Network resources
• All expected network resources are available.
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
f: date/time pickerDate or time picker widgetsDate or time picker widgetsfound in release: 3.9Found to occur in 3.9Found to occur in 3.9frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packages
Type
Projects
- StatusShow more project fieldsDone (PR merged)
- StatusShow more project fields✅ Done


Activity
huycozy commentedon Mar 13, 2023
Thanks for filing the issue, @MaxYablochkin
I can see this issue on the latest
masterchannel when using M3.There is also another issue with
Dial picker modeas well. On this mode, theTime selector separator(colon symbol) doesn't seem to be in the middle.M3 specs: https://m3.material.io/components/time-pickers/specs
Sample code
flutter doctor -v (master)
[-]Wrong location in TimePicker[/-][+]Wrong time selector separator alignment in TimePicker[/+]TahaTesser commentedon Mar 14, 2023
This was introduced in #116396
Looks like there are several spacing issues and mode icon position is also not right.
Update
This seems to be reproducing in 12-hour format.
Update 2
On Oneplus 8, TimePicker becomes scrollable due to this issue.
telegram-cloud-document-5-6089272497599941450.mp4
[-]Wrong time selector separator alignment in TimePicker[/-][+]M3 `TimePicker` input mode has incorrect spacing and mode icon position is bit off [/+]TahaTesser commentedon Mar 14, 2023
cc: @HansMuller
TahaTesser commentedon Mar 14, 2023
cc: @gspencergoog
This is due to this width condition in
_minDialogSizeflutter/packages/flutter/lib/src/material/time_picker.dart
Lines 2326 to 2345 in d8a7211
When using
timePickerWidth = _kTimePickerInputSize.width - defaultTheme.dayPeriodPortraitSize.width - 12;for 12-hour and 24-hour in_minDialogSize, Issue is fixed.But I'm not sure why this condition was added as it doesn't fail tests in
time_picker_test.dart.gspencergoog commentedon Mar 14, 2023
Hmm. I thought I had fixed that, but I guess not.
There is a condition for that because the am/pm entry mode is wider than the 24-hour mode to accommodate the day period (am/pm) selector.
However, if you use the same calculation for both, the colon is centered in am/pm mode, but that is because the dialog has shrunk past the point where it needs to be to remove all the extra spacing. Some fonts will be too constrained by that, and will wrap the numbers in the entry field.
This is closer to the spec, I think, and should remove the extra padding near the colon:
Really, I think
_kTimePickerInputSizeshould be a Material token, but there isn't one for that.TahaTesser commentedon Mar 14, 2023
@gspencergoog
Do you mind if I try this and add regression tests so this can be caught if modified.
gspencergoog commentedon Mar 14, 2023
@TahaTesser No, not at all! That would be great.
github-actions commentedon Apr 5, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.