-
Notifications
You must be signed in to change notification settings - Fork 34
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 Auth UI composables #256
Merged
Merged
Conversation
This file contains 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
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
# Conflicts: # gradle/libs.versions.toml
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
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.
What kind of change does this PR introduce?
Feature
What is the current behavior?
You had to make common Auth UI composables yourself.
What is the new behavior?
There is a new module providing Auth UI composables and Form validator for Material 3.
It currently has Email & Password fields in all variants. There are also icons in the front by default.
PasswordField
You can set
rules
for the password like this:Once set, the field will automatically display an error supporting text if the password doesn't match the criteria.
Note that the built-in roles also accept a custom description as a parameter.
You can also easily create your own rules:
EmailField
The email field has a validator parameter which defaults to a regex solution.
Example:
Phone Field
The phone field also has a validator parameter, which just checks whether the phone number only consists of digits.
On top of that you can provide a
mask
parameter, which changes how the phone number gets displayed. The value is just the raw number.Example with the default mask:
Example with custom mask: (you can also set it to null, if you don't want a mask)
Note: You can customize the fields completely, they just all have default values. They also have a `mandatory´ option, you can use that to have optional fields. It is also possible to make fields only mandatory (=validation enabled) once the field is not empty. (See example)
Provider Button
This module provides a function to generate the button content independently of the variation:
You can also only use the icon if you want a custom layout:
Custom Form Components
You can also easily make your own form components:
Mandatory changes whether the
AuthState#validForm
property is affected by this component.Auth Form
If the composables are in a
AuthForm
scope, they automatically change whether the form is valid & complete or not. That way you can easily check whether something is missing and e.g. disable the login button. (See example)Note: There are still more things coming here.
Here is an example using Compose for Desktop (Windows)
java_2023-08-22_16-48-18.mp4