Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
form validation with kotlin flow,stateFlow
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/txtErrorMessage"
android:layout_width="0dp"
android:layout_marginTop="16dp"
android:textColor="#F36060"
android:layout_marginHorizontal="24dp"
android:textSize="16sp"
android:textAlignment="center"
tools:text="Error Message"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/txtEmail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="56dp"
android:layout_marginHorizontal="24dp"
android:hint="email"
android:textAlignment="center"
android:textColor="#1B1717"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtErrorMessage" />
<EditText
android:id="@+id/txtPassword"
android:layout_marginHorizontal="24dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="Password"
android:inputType="textPassword"
android:textAlignment="center"
android:textColor="#1B1717"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtEmail" />
<EditText
android:layout_marginHorizontal="24dp"
android:id="@+id/txtPasswordAgain"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="Password Again"
android:inputType="textPassword"
android:textAlignment="center"
android:textColor="#1B1717"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtPassword" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnLogin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:insetTop="0dp"
android:insetBottom="0dp"
android:letterSpacing="0"
android:text="Login"
android:textAllCaps="false"
android:layout_marginHorizontal="24dp"
app:cornerRadius="30dp"
android:layout_marginTop="36dp"
app:backgroundTint="#171B17"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtPasswordAgain" />
</androidx.constraintlayout.widget.ConstraintLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment