feat: login api
This commit is contained in:
@@ -8,6 +8,7 @@ class AppPasswordTextFormField extends StatefulWidget {
|
||||
this.hintText,
|
||||
required this.prefixIcon,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
});
|
||||
|
||||
final TextEditingController? controller;
|
||||
@@ -15,6 +16,7 @@ class AppPasswordTextFormField extends StatefulWidget {
|
||||
final String? hintText;
|
||||
final IconData prefixIcon;
|
||||
final String? Function(String?)? validator;
|
||||
final Function(String)? onChanged;
|
||||
|
||||
@override
|
||||
State<AppPasswordTextFormField> createState() =>
|
||||
@@ -42,6 +44,7 @@ class _AppPasswordTextFormFieldState extends State<AppPasswordTextFormField> {
|
||||
cursorColor: AppColor.primary,
|
||||
obscureText: _obscurePassword,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textPrimary),
|
||||
onChanged: widget.onChanged,
|
||||
decoration: InputDecoration(
|
||||
hintText: widget.hintText,
|
||||
prefixIcon: LineIcon(
|
||||
|
||||
@@ -8,6 +8,7 @@ class AppTextFormField extends StatelessWidget {
|
||||
this.hintText,
|
||||
required this.prefixIcon,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
});
|
||||
|
||||
final TextEditingController? controller;
|
||||
@@ -15,6 +16,7 @@ class AppTextFormField extends StatelessWidget {
|
||||
final String? hintText;
|
||||
final IconData prefixIcon;
|
||||
final String? Function(String?)? validator;
|
||||
final Function(String)? onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -33,6 +35,7 @@ class AppTextFormField extends StatelessWidget {
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
cursorColor: AppColor.primary,
|
||||
onChanged: onChanged,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textPrimary),
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:another_flushbar/flushbar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
class AppFlushbar {
|
||||
static void showSuccess(BuildContext context, String message) {
|
||||
@@ -40,4 +41,14 @@ class AppFlushbar {
|
||||
margin: const EdgeInsets.all(12),
|
||||
).show(context);
|
||||
}
|
||||
|
||||
static void showAuthFailureToast(BuildContext context, AuthFailure failure) =>
|
||||
showError(
|
||||
context,
|
||||
failure.map(
|
||||
serverError: (value) => value.failure.toStringFormatted(context),
|
||||
dynamicErrorMessage: (value) => value.erroMessage,
|
||||
unexpectedError: (value) => 'Error has eccoured',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user