changes
@ -1,9 +1,9 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.exampleproj.plannerly">
|
||||
<application
|
||||
android:label="plannerly"
|
||||
android:label="Plannerly"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
android:icon="@mipmap/plannerly_logo">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
Before Width: | Height: | Size: 544 B |
After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 442 B |
After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 721 B |
After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
@ -41,10 +41,10 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
|
||||
'userName', response['first_name'] + " " + response['last_name']);
|
||||
emit(LoginSuccessState());
|
||||
} else {
|
||||
emit(LoginShowSnackbar(message: response['error']));
|
||||
emit(LoginLoadingErrorState(message: response['error']));
|
||||
}
|
||||
} catch (e) {
|
||||
emit(LoginShowSnackbar(message: e.toString()));
|
||||
emit(LoginLoadingErrorState(message: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,12 @@ final class LoginInitial extends LoginState {}
|
||||
|
||||
class LoginLoadingState extends LoginState {}
|
||||
|
||||
class LoginLoadingErrorState extends LoginState {
|
||||
final String message;
|
||||
|
||||
LoginLoadingErrorState({required this.message});
|
||||
}
|
||||
|
||||
class LoginShowSnackbar extends LoginActionState {
|
||||
final String message;
|
||||
LoginShowSnackbar({required this.message});
|
||||
|
@ -63,6 +63,177 @@ class _LoginPageState extends State<LoginPage> {
|
||||
switch (state.runtimeType) {
|
||||
case LoginLoadingState:
|
||||
return const HomeLoading();
|
||||
case LoginLoadingErrorState:
|
||||
var s = state as LoginLoadingErrorState;
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.backgroundDark,
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: size.height * 0.08),
|
||||
const Center(
|
||||
child: Text(
|
||||
"Welcome to Plannerly !!",
|
||||
style: TextStyle(
|
||||
color: AppColors.white,
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Center(
|
||||
child: Text(
|
||||
// "Let's get your things planned.",
|
||||
"Planning Your Way to Productivity.",
|
||||
style: TextStyle(
|
||||
color: AppColors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Image.asset(
|
||||
'assets/images/logo_transparent.png',
|
||||
scale: 1.8,
|
||||
),
|
||||
SizedBox(
|
||||
width: size.width * 0.8,
|
||||
child: Column(
|
||||
children: [
|
||||
TaskFormField(
|
||||
title: '',
|
||||
hint: 'Email',
|
||||
controller: userName,
|
||||
),
|
||||
TaskFormField(
|
||||
title: '',
|
||||
hint: 'Password',
|
||||
controller: pass,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(
|
||||
width: size.width * 0.8,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info_outline,
|
||||
size: 25,
|
||||
color: Colors.red[400],
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Center(
|
||||
child: SizedBox(
|
||||
width: size.width * 0.7,
|
||||
child: Text(
|
||||
s.message,
|
||||
style: const TextStyle(
|
||||
color: AppColors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
maxLines: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: size.height * 0.04),
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (userName.text.isNotEmpty &&
|
||||
pass.text.isNotEmpty) {
|
||||
loginBloc.add(
|
||||
LoginButtonClickedEvent(
|
||||
userName: userName.text.trim().toString(),
|
||||
pass: pass.text.trim().toString(),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
var snackBar = SnackBar(
|
||||
backgroundColor: Colors.red[500],
|
||||
content: const Text(
|
||||
"Please fill all the fields.",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: AppColors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(snackBar);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: size.width * 0.7,
|
||||
height: size.height * 0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.buttonBlue,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
"Login",
|
||||
style: TextStyle(
|
||||
color: AppColors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"Don't have an account?",
|
||||
style: TextStyle(
|
||||
color: AppColors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
loginBloc
|
||||
.add(LoginPageSignupButtonClickedEvent());
|
||||
},
|
||||
child: const Center(
|
||||
child: Text(
|
||||
"Sign-up",
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: AppColors.buttonBlue,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
default:
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.backgroundDark,
|
||||
|