-
Notifications
You must be signed in to change notification settings - Fork 4
feat: create component PIN code input #308
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
Changes from 13 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
cbddae0
feat: prepare the Pin Code Input Component in core
nouha06 d4857aa
feat:add token textInput
nouha06 e7fc30c
feat: add textField for code pin input
nouha06 2b241f9
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 77f41a7
chore: add pin code input component in lib
nouha06 24f8f25
feat: add pin code input component in app demo
nouha06 1056439
fix: delete unused import
nouha06 b7ee172
feat: fix hint text
nouha06 f7a2401
feat: add variant pin code input in demo app
nouha06 f1547e5
feat: add OudsDigitInput
nouha06 53dc338
feat: refactor code and add verification code in demo app
nouha06 3c3e52c
feat: refactor
nouha06 c3f77a7
feat: refactor code and documentation, and add verification state in …
nouha06 5be86f1
feat: prepare the Pin Code Input Component in core
nouha06 4a04334
feat:add token textInput
nouha06 829fd82
feat: add textField for code pin input
nouha06 237772f
chore: add pin code input component in lib
nouha06 7b0887e
feat: add pin code input component in app demo
nouha06 11cab16
fix: delete unused import
nouha06 b22b17f
feat: fix hint text
nouha06 b28f497
feat: add variant pin code input in demo app
nouha06 a9a5f76
feat: add OudsDigitInput
nouha06 08b13f2
feat: refactor code and add verification code in demo app
nouha06 b62b0cf
feat: refactor
nouha06 9ae0a63
feat: refactor code and documentation, and add verification state in …
nouha06 2850478
Merge branch '307-create-component---pin-code-input' of https://githu…
nouha06 b3aebfc
review : review code
nouha06 2749813
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 292e254
feat : update dart doc options
nouha06 42a4baf
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 4928f8b
review : update the documentation of digit input and pin code input
nouha06 f2affe4
chore: delete the style option from the pin code input component and …
nouha06 8dfc231
review : refactor code for the component and fix some issues in demo app
nouha06 8837f7c
review : add use pin code input control state instead of text input c…
nouha06 e2c6fc3
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 28a93bf
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 d1e56f7
review : update helper text value according to the number of digit in…
nouha06 1627e3f
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 6e426cc
Merge branch 'refs/heads/develop' into 307-create-component---pin-cod…
nouha06 714a345
fix: separate Pin Code Input from generic Input component in componen…
nouha06 d1d2069
fix : digit padding changed according to the length of Pin Code input…
nouha06 3c6909e
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 23a40ec
review : fix PIN code input error handling
nouha06 c548616
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 c4cae68
fix: update accessibility
nouha06 ec3ee02
fix: update accessibility for pin code input
nouha06 b33449f
fix: Pin Code Input behavior and component ordering
nouha06 8d1b942
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 9ecab5b
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 f1bf73b
review: Ensure component pages are listed in alphabetical order
nouha06 bafd7a2
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 2f9ccac
review: allow replacing existing digit without deleting first
nouha06 dda86cd
Merge branch 'develop' into 307-create-component---pin-code-input
Tayebsed93 3d2858c
Merge branch 'develop' into 307-create-component---pin-code-input
nouha06 30392b0
Merge remote-tracking branch 'origin/307-create-component---pin-code-…
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
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
80 changes: 80 additions & 0 deletions
80
app/lib/ui/components/text_input/pin_code_input/pin_code_input_code_generator.dart
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,80 @@ | ||
| /* | ||
| * // Software Name: OUDS Flutter | ||
| * // SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
| * // SPDX-License-Identifier: MIT | ||
| * // | ||
| * // This software is distributed under the MIT license, | ||
| * // the text of which is available at https://opensource.org/license/MIT/ | ||
| * // or see the "LICENSE" file for more details. | ||
| * // | ||
| * // Software description: Flutter library of reusable graphical components | ||
| * // | ||
| */ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:ouds_flutter_demo/l10n/app_localizations.dart'; | ||
| import 'package:ouds_flutter_demo/ui/components/text_input/pin_code_input/pin_code_input_enum.dart'; | ||
| import 'package:ouds_flutter_demo/ui/components/text_input/text_input_customization.dart'; | ||
| import 'package:ouds_flutter_demo/ui/components/text_input/text_input_customization_utils.dart'; | ||
|
|
||
| class PinCodeInputCodeGenerator { | ||
| static String updateCode(BuildContext context) { | ||
| final TextInputCustomizationState? state = TextInputCustomization.of(context); | ||
|
|
||
| if (state == null) return "OudsPinCodeInput(),"; | ||
|
|
||
| List<String> lines = []; | ||
|
|
||
| lines.add(" controllers: controllers,"); | ||
|
|
||
| if (state.hasHelperText && !state.hasError) { | ||
| lines.add( | ||
| ' helperText: "${TextInputCustomizationUtils.getPinCodeHelperText(state, PinCodeLengthEnum.getHelperText(context, state.selectedPinCodeLength))}",'); | ||
| } | ||
|
|
||
| if (state.hasError) { | ||
| lines.add(" isError: ${state.hasError},"); | ||
| lines.add(' errorText: "${TextInputCustomizationUtils.getPinCodeErrorText(state,context.l10n.app_components_pin_code_input_error_label)}",'); | ||
| } | ||
|
|
||
| final length = TextInputCustomizationUtils.getLength(state.selectedPinCodeLength); | ||
| lines.add(' length: $length,'); | ||
|
|
||
| lines.add(' onCompleted: (value) {\n //handle completed pin code\n},'); | ||
| lines.add(' onError: (isError) {\n // handle error state\n},'); | ||
|
|
||
| final String decoration = _digitDecorationCode(state); | ||
|
|
||
| return [ | ||
| "OudsPinCodeInput(", | ||
| ...lines, | ||
| decoration, | ||
| ")," | ||
| ].join("\n"); | ||
| } | ||
|
|
||
| static String _digitDecorationCode(TextInputCustomizationState state) { | ||
| List<String> props = []; | ||
|
|
||
| if (state.pinCodePlaceholderText.isNotEmpty) { | ||
| final hint = TextInputCustomizationUtils.getPinCodePlaceholderText(state); | ||
| props.add(' hintText: "$hint",'); | ||
| } | ||
|
|
||
| if (state.hasRoundedCorner) { | ||
| props.add(' roundedCorner: ${state.hasRoundedCorner},'); | ||
| } | ||
|
|
||
| if (state.hasHiddenPassword) { | ||
| props.add(' hiddenPassword: ${state.hasHiddenPassword},'); | ||
| } | ||
|
|
||
| final style = TextInputCustomizationUtils.getStyle(state.selectedStyle); | ||
| props.add(' style: $style,'); | ||
|
|
||
| if (props.isEmpty) { | ||
| return "digitInputDecoration: OudsDigitInputDecoration(),"; | ||
| } | ||
|
|
||
| return "digitInputDecoration: OudsDigitInputDecoration(\n${props.join("\n")}\n),"; | ||
| } | ||
| } |
Oops, something went wrong.
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.