-
Notifications
You must be signed in to change notification settings - Fork 4
fix: limit label text in Text Input Component to max 2 lines with ellipsis overflow (#333)(#50) #343
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
Merged
Merged
fix: limit label text in Text Input Component to max 2 lines with ellipsis overflow (#333)(#50) #343
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6fd1ae0
fix: limit label text in Text Input Component to max 2 lines and 1 li…
nouha06 fc9722b
fix: update changelog file
nouha06 835ae97
fix: focus text input
nouha06 4bbd786
Merge branch 'develop' into 333-bug-input-text-label-text-overflow
nouha06 6568d12
Merge branch 'develop' into 333-bug-input-text-label-text-overflow
nouha06 9128997
merge: fix conflict in changelog
nouha06 ceb9f38
fix: limit label text in Text Input Component to max 2 lines and 1 li…
nouha06 6bfe466
fix: update changelog file
nouha06 ba21594
fix: focus text input
nouha06 2474dc7
fix: add sizeLabelMaxHeight for label container
nouha06 7f14381
Merge remote-tracking branch 'origin/333-bug-input-text-label-text-ov…
nouha06 d3aea87
Merge branch 'refs/heads/develop' into 333-bug-input-text-label-text-…
nouha06 7511225
chore: centralize getLabelMaxLines function in utils
nouha06 9b4dec8
refactor: refactor class name
nouha06 5eed0da
chore: delete unused function
nouha06 4b7d094
fix: update change log file
nouha06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
|
|
||
| import 'package:flutter/cupertino.dart'; | ||
| import 'package:ouds_core/components/text_input/ouds_text_input.dart'; | ||
|
|
||
| /// A utility class for handling common input-related operations in Flutter. | ||
| class InputUtils { | ||
nouha06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /// Returns the maximum number of lines for a label based on the input state. | ||
| /// | ||
| /// Rules: | ||
| /// - If a hint text is provided, the label is limited to 1 line. | ||
| /// - If the input is focused, the label is limited to 1 line. | ||
| /// - If the controller has a non-empty text, the label is limited to 1 line. | ||
| /// - Otherwise, the label can use up to 2 lines. | ||
| /// | ||
| /// Parameters: | ||
| /// [decoration] The input decoration containing optional hint text. | ||
| /// [isFocused] Whether the input field is currently focused. | ||
| /// [controller] The text controller for the input field (optional). | ||
| /// | ||
| /// Returns: | ||
| /// `1` if any of the above conditions are true, otherwise `2`. | ||
| static int getLabelMaxLines({ | ||
| required OudsInputDecoration decoration, | ||
| required bool isFocused, | ||
| TextEditingController? controller, | ||
| }) { | ||
| return (decoration.hintText != null || | ||
| isFocused || | ||
| (controller != null && controller.text.isNotEmpty)) | ||
| ? 1 | ||
| : 2; | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.