Add OTP field & unify popover touch/hover behavior#945
Open
Conversation
23a9b8b to
7f0cf50
Compare
Open
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new OTP input widget to Forui while aligning cursor behavior across text-like inputs, and simplifies popover submenu interaction by unifying hover/tap handling across platforms.
Changes:
- Introduce
FOtpField,FOtpController, OTP item/divider widgets, styles, docs snippets, and golden/unit tests. - Add
cursorWidthandcursorOpacityAnimatestoFTextFieldStyle(and propagate to related styles/usages). - Remove
hoverconfiguration fromFPopoverMenu/submenu APIs and adjust submenu trigger logic + tests accordingly.
Reviewed changes
Copilot reviewed 29 out of 62 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| forui/test/src/widgets/popover_menu/submenu_tile_test.dart | Updates submenu tile tests for unified hover/tap behavior and adds a regression test for tap on hover-opened submenu. |
| forui/test/src/widgets/popover_menu/submenu_item_test.dart | Updates submenu item tests for unified hover/tap behavior and adds a regression test for tap on hover-opened submenu. |
| forui/test/src/widgets/popover_menu/popover_menu_golden_test.dart | Updates popover menu golden tests to reflect removal of hover parameter. |
| forui/test/src/widgets/otp_field/otp_field_golden_test.dart | Adds comprehensive golden coverage for FOtpField across themes/states (divider/disabled/error/RTL/etc.). |
| forui/test/src/widgets/otp_field/otp_field_control_test.dart | Adds unit tests for FOtpController selection/focus/traversal behavior (incl. truncation cases). |
| forui/test/src/widgets/otp_field/caret_golden_test.dart | Adds golden tests for caret blinking behavior (animated opacity vs discrete blink). |
| forui/test/golden/macos/otp-field/neutral-light/single-item.png | Adds new macOS golden asset for OTP field. |
| forui/test/golden/macos/otp-field/neutral-light/basic.png | Adds new macOS golden asset for OTP field. |
| forui/test/golden/macos/otp-field/neutral-dark/basic.png | Adds new macOS golden asset for OTP field. |
| forui/test/golden/macos/otp-field/caret-opacity-animates.png | Adds new macOS golden asset for caret opacity animation. |
| forui/test/golden/macos/otp-field/caret-discrete-blink.png | Adds new macOS golden asset for discrete caret blink. |
| forui/lib/widgets/otp_field.dart | Adds public OTP field library exports (widget/control/style/items). |
| forui/lib/src/widgets/tile/tile_mixin.dart | Removes submenu hover plumbing from tile shorthand API. |
| forui/lib/src/widgets/text_field/text_field_style.dart | Adds cursor width + cursor opacity animation style knobs. |
| forui/lib/src/widgets/text_field/input/input.dart | Applies new cursor style knobs to underlying TextField and refactors dispose placement. |
| forui/lib/src/widgets/popover_menu/submenu_tile.dart | Removes hover parameter and updates trigger behavior to unify hover/tap handling. |
| forui/lib/src/widgets/popover_menu/submenu_item.dart | Removes hover parameter and updates trigger behavior to unify hover/tap handling. |
| forui/lib/src/widgets/popover_menu/popover_menu.dart | Removes hover configuration from menu/scope and unifies callbacks for hover + press. |
| forui/lib/src/widgets/otp_field/otp_item.dart | Implements OTP item scope + rendering and adds divider widget. |
| forui/lib/src/widgets/otp_field/otp_field_style.dart | Introduces FOtpFieldStyle + variant-driven item styling. |
| forui/lib/src/widgets/otp_field/otp_field_control.dart | Adds FOtpFieldControl and FOtpController selection/traversal logic. |
| forui/lib/src/widgets/otp_field/otp_field.dart | Implements FOtpField widget with form integration + error fade behavior. |
| forui/lib/src/widgets/otp_field/caret.dart | Adds custom caret widget to mimic platform cursor blink behaviors. |
| forui/lib/src/widgets/item/item_mixin.dart | Removes submenu hover plumbing from item shorthand API. |
| forui/lib/src/widgets/item/item.dart | Minor style cleanup (uses .fromSTEB shorthand). |
| forui/lib/src/widgets/autocomplete/autocomplete_style.dart | Propagates new cursor style knobs through autocomplete field style. |
| forui/lib/src/theme/theme_data.dart | Adds otpFieldStyle to theme data and lerp/delta plumbing. |
| forui/lib/forui.dart | Exports widgets/otp_field.dart from the package barrel. |
| forui/bin/commands/style/style.dart | Extends style CLI generation to include OTP field styles and new cursor style properties. |
| forui/CHANGELOG.md | Documents new OTP field and new text field cursor style properties; removes hover mention under popover menu. |
| docs_snippets/lib/usages/widgets/popover_menu.dart | Updates popover menu usage snippets to remove hover argument. |
| docs_snippets/lib/usages/widgets/otp_field.dart | Adds OTP field usage snippet for docs generation. |
| docs_snippets/lib/main.dart | Adds routes for OTP field examples in snippets app. |
| docs_snippets/lib/examples/widgets/otp_field.dart | Adds default + divider OTP field example pages. |
| docs/content/docs/form/otp-field.mdx | Adds OTP field documentation page with preview/code/CLI/usage/examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Documentation Preview
You're seeing this because the docs/samples were updated. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the changes
FOtpFieldwidget with support for dividers, labels, descriptions, error messages, and form validation.FOtpControllerfor programmatic control of OTP input state.Checklist