-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Add focusNode
, focusColor
, onFocusChange
, autofocus
to CupertinoButton
#150721
Add focusNode
, focusColor
, onFocusChange
, autofocus
to CupertinoButton
#150721
Conversation
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.
While reading this Cupertino PR for learning purpose, I spotted some minor formatting issues (missing commas).
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.
Some minor feedback. Nice to see CupertinoButton
is getting some treatment.
final Color effectiveFocusOutlineColor = widget.focusColor ?? | ||
HSLColor | ||
.fromColor((backgroundColor ?? CupertinoColors.activeBlue).withOpacity(0.80)) | ||
.withLightness(0.69).withSaturation(0.835) |
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.
.withLightness(0.69).withSaturation(0.835) | |
.withLightness(0.69).withSaturation(0.835) |
We should also document what's happening here in the focusColor
property docs.
/// {@macro flutter.widgets.Focus.focusNode} | ||
final FocusNode? focusNode; | ||
|
||
/// {@macro flutter.material.inkwell.onFocusChange} |
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.
/// {@macro flutter.material.inkwell.onFocusChange} | |
/// {@macro flutter.material.inkwell.onFocusChange} |
This references material lnkwell onFocusChange. When we just to document onFocusChange
, unrelated to inkwell itself. I wonder other Cupertino widgets contain onFocusChange
and how it's documented there. Otherwise we should have specific documentation here instead of InkWell reference.
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 only other place I saw it done in the Cupertino library was in CupertinoSwitch
:
/// {@macro flutter.material.inkwell.onFocusChange} |
The macro is defined here:
flutter/packages/flutter/lib/src/material/ink_well.dart
Lines 577 to 582 in a796770
/// {@template flutter.material.inkwell.onFocusChange} | |
/// Handler called when the focus changes. | |
/// | |
/// Called with true if this widget's node gains focus, and false if it loses | |
/// focus. | |
/// {@endtemplate} |
Considering the definition is very generic, what the pros and cons are in reusing the macro here instead of duplicating?
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.
Couple of concerns regarding this.
- InkWell reference comes from Material library,, if updated in the future it will have implications in the Cupertino library where InkWell cannot be used without
Material
widget surface. The references seems out of place. - If more Cupertino widgets are expected to use
onFocusChange
callback, we should have similar yet independent docs.
I suggest since this is using FocusableActionDetector
from widgets
library, we can make these doc reuse FocusableActionDetector.onFocusChange
docs (turn into a template) or write original docs for the CupertinoButton
. I would lean towards writing original docs based on this discussion #142516 (comment) on a similar PR.
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
@TahaTesser I have another PR out for |
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!
Co-authored-by: Taha Tesser <tessertaha@gmail.com>
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!
auto label is removed for flutter/flutter/150721, due to - The status or check suite Linux customer_testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
* master: (23 commits) Roll pub packages (flutter#150810) Remove reference to `MaterialApp` and `showCupertinoModalPopup` from `CupertinoAlertDialog` (flutter#150725) Read `AndroidManifest.xml` and emit `manifest-impeller-(enabled|disabled)` analytics (flutter#150791) [flutter_tools] Shut down Chromium cleanly using a command sent through the debug protocol (flutter#150645) Reland fix inputDecorator hint color on M3 (flutter#150278) Roll Flutter Engine from 62e0b5f9c340 to 94023d711db3 (7 revisions) (flutter#150797) Fix collapsed InputDecorator minimum height (flutter#150770) Add more warm up frame docs (flutter#150464) Roll pub packages (flutter#150739) Add `focusNode`, `focusColor`, `onFocusChange`, `autofocus` to `CupertinoButton` (flutter#150721) Document RenderObject._relayoutBoundary and its invariant; small refactors (flutter#150527) Roll Flutter Engine from 6313b1e5afd7 to 62e0b5f9c340 (1 revision) (flutter#150790) fix a typo (flutter#150682) Fix link in RenderObjectWidget doc comment (flutter#150600) Roll Flutter Engine from fbd92055f3a6 to 6313b1e5afd7 (1 revision) (flutter#150781) [tool] make `ErrorHandlingFileSystem.deleteIfExists` catch error code 3 (`ERROR_PATH_NOT_FOUND` on Windows) (flutter#150741) Roll Packages from 711b4ac to 03f5f6d (21 revisions) (flutter#150779) Roll Flutter Engine from afa7ce19bca8 to fbd92055f3a6 (1 revision) (flutter#150777) Reland Add tests for form_text_field.1.dart (flutter#150481) (flutter#150696) (flutter#150750) Add an example for CupertinoPopupSurface (flutter#150357) ...
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
…o `CupertinoButton` (flutter/flutter#150721)
Manual roll Flutter from e726eb4 to 15f95ce (48 revisions) Manual roll requested by dit@google.com flutter/flutter@e726eb4...15f95ce 2024-06-28 engine-flutter-autoroll@skia.org Roll Flutter Engine from ddd4814b9d40 to 94591ffb20df (5 revisions) (flutter/flutter#150968) 2024-06-27 34871572+gmackall@users.noreply.github.com Manual engine roll to ddd4814 (flutter/flutter#150952) 2024-06-27 reidbaker@google.com local lint copy gradle task config (flutter/flutter#150957) 2024-06-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from b42c80460538 to d1506c12808e (3 revisions) (flutter/flutter#150951) 2024-06-27 andrewrkolos@gmail.com [tool] make the `systemTempDirectory` getter on `ErrorHandlingFileSystem` wrap the underlying filesystem's temp directory in a`ErrorHandlingDirectory` (flutter/flutter#150876) 2024-06-27 jacksongardner@google.com Have flutter.js load local canvaskit instead of the CDN when appropriate (flutter/flutter#150806) 2024-06-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from a9194f0f01f4 to b42c80460538 (10 revisions) (flutter/flutter#150940) 2024-06-27 jhy03261997@gmail.com [a11y] Reland [#149375 ] Update semantics in dropdown.dart (flutter/flutter#150578) 2024-06-27 goderbauer@google.com Bump dartdoc to 8.0.9+1 (flutter/flutter#150935) 2024-06-27 yjbanov@google.com add onFocus to text fields (flutter/flutter#150648) 2024-06-27 louisehsu@google.com Fixes `flutter build ipa` failure: Command line name "app-store" is deprecated. Use "app-store-connect" (flutter/flutter#150407) 2024-06-27 github@ricardoboss.de Copy any previous `IconThemeData` instead of overwriting it in CupertinoButton (flutter/flutter#149777) 2024-06-27 hans.muller@gmail.com Improve the behavior of scrollbar drag-scrolls triggered by the trackpad (flutter/flutter#150275) 2024-06-27 15272073+Fernthedev@users.noreply.github.com feat: Add autofocus for `MenuItemButton` (flutter/flutter#139396) 2024-06-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1d5e3cc55a75 to a9194f0f01f4 (7 revisions) (flutter/flutter#150888) 2024-06-26 34871572+gmackall@users.noreply.github.com Reland "Remove dual_screen from new_gallery integration test" (flutter/flutter#150873) 2024-06-26 parlough@gmail.com Switch to more reliable flutter.dev link destinations in the tool (flutter/flutter#150587) 2024-06-26 goderbauer@google.com Adding `@docImport`s to the `animation` library (flutter/flutter#150798) 2024-06-26 magder@google.com Remove CODEOWNERS trailing whitespace (flutter/flutter#150882) 2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from e03cf86c4170 to 1d5e3cc55a75 (3 revisions) (flutter/flutter#150875) 2024-06-26 matanlurey@users.noreply.github.com Remind folks we are moving. (flutter/flutter#150872) 2024-06-26 jacksongardner@google.com Remove `bringup: true` from web test shard. (flutter/flutter#150785) 2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from c0017bed42c2 to e03cf86c4170 (1 revision) (flutter/flutter#150867) 2024-06-26 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Remove `dual_screen` from `new_gallery` integration test (#150808)" (flutter/flutter#150871) 2024-06-26 34871572+gmackall@users.noreply.github.com Remove `dual_screen` from `new_gallery` integration test (flutter/flutter#150808) 2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from d4624a36712b to c0017bed42c2 (4 revisions) (flutter/flutter#150865) 2024-06-26 swrenn@gmail.com Fixes for Style Guide for Flutter Repo (flutter/flutter#150167) 2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from da62c629ed5c to d4624a36712b (3 revisions) (flutter/flutter#150852) 2024-06-26 sigurdm@google.com Use `Isolate.packageConfigSync! to locate the packageconfig of flutter tools (flutter/flutter#150340) 2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from 25af762ffbb3 to da62c629ed5c (2 revisions) (flutter/flutter#150829) 2024-06-26 polinach@google.com Fix leaky tests. (flutter/flutter#150817) 2024-06-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from 94023d711db3 to 25af762ffbb3 (4 revisions) (flutter/flutter#150818) 2024-06-26 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#150810) 2024-06-25 dkwingsmt@users.noreply.github.com Remove reference to `MaterialApp` and `showCupertinoModalPopup` from `CupertinoAlertDialog` (flutter/flutter#150725) 2024-06-25 matanlurey@users.noreply.github.com Read `AndroidManifest.xml` and emit `manifest-impeller-(enabled|disabled)` analytics (flutter/flutter#150791) 2024-06-25 jason-simmons@users.noreply.github.com [flutter_tools] Shut down Chromium cleanly using a command sent through the debug protocol (flutter/flutter#150645) 2024-06-25 bruno.leroux@gmail.com Reland fix inputDecorator hint color on M3 (flutter/flutter#150278) 2024-06-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 62e0b5f9c340 to 94023d711db3 (7 revisions) (flutter/flutter#150797) 2024-06-25 bruno.leroux@gmail.com Fix collapsed InputDecorator minimum height (flutter/flutter#150770) 2024-06-25 737941+loic-sharma@users.noreply.github.com Add more warm up frame docs (flutter/flutter#150464) 2024-06-25 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#150739) 2024-06-25 victorsanniay@gmail.com Add `focusNode`, `focusColor`, `onFocusChange`, `autofocus` to `CupertinoButton` (flutter/flutter#150721) 2024-06-25 greg@zulip.com Document RenderObject._relayoutBoundary and its invariant; small refactors (flutter/flutter#150527) 2024-06-25 engine-flutter-autoroll@skia.org Roll Flutter Engine from 6313b1e5afd7 to 62e0b5f9c340 (1 revision) (flutter/flutter#150790) ...
…o `CupertinoButton` (flutter/flutter#150721)
This should have been added with #150721.
This should have been added with flutter#150721.
This should have been added with flutter#150721.
Before:
before.fix.focus.mov
After:
after.fix.focus.mov
Fixes #144385
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.