This commit is contained in:
Vandad Nahavandipoor 2022-01-14 15:13:13 +01:00
parent e99ffffa86
commit 0a663378f9
7 changed files with 176 additions and 215 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
lib/firebase_options.dart
# Miscellaneous
*.class
*.log
@ -8,7 +9,7 @@
.buildlog/
.history
.svn/
key.properties
# IntelliJ related
*.iml
*.ipr

View File

@ -25,6 +25,12 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion flutter.compileSdkVersion
@ -51,11 +57,17 @@ android {
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}

View File

@ -1,60 +0,0 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
// ignore: missing_enum_constant_in_switch
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyBbOlhxv5SV3YMjUDovhaT93YEJ2hfqixY',
appId: '1:877208178211:android:05e53b3ec20b460dd92b96',
messagingSenderId: '877208178211',
projectId: 'mynotes-flutter-project',
storageBucket: 'mynotes-flutter-project.appspot.com',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyA4nrF7NuKhjCumrV2DBV67pXUCMdOgEqw',
appId: '1:877208178211:ios:1c169a82130d69a9d92b96',
messagingSenderId: '877208178211',
projectId: 'mynotes-flutter-project',
storageBucket: 'mynotes-flutter-project.appspot.com',
iosClientId: '877208178211-pkk6a4dfdsmh1tfm4ffhdss9lmmjl0mc.apps.googleusercontent.com',
iosBundleId: 'se.pixolity.mynotes',
);
}

View File

@ -49,37 +49,39 @@ class _ForgotPasswordViewState extends State<ForgotPasswordView> {
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
const Text(
'If you forgot your password, simply enter your email and we will send you a password reset link.'),
TextField(
keyboardType: TextInputType.emailAddress,
autocorrect: false,
autofocus: true,
controller: _controller,
decoration: const InputDecoration(
hintText: 'Your email address....',
child: SingleChildScrollView(
child: Column(
children: [
const Text(
'If you forgot your password, simply enter your email and we will send you a password reset link.'),
TextField(
keyboardType: TextInputType.emailAddress,
autocorrect: false,
autofocus: true,
controller: _controller,
decoration: const InputDecoration(
hintText: 'Your email address....',
),
),
),
TextButton(
onPressed: () {
final email = _controller.text;
context
.read<AuthBloc>()
.add(AuthEventForgotPassword(email: email));
},
child: const Text('Send me password reset link'),
),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventLogOut(),
);
},
child: const Text('Back to login page'),
),
],
TextButton(
onPressed: () {
final email = _controller.text;
context
.read<AuthBloc>()
.add(AuthEventForgotPassword(email: email));
},
child: const Text('Send me password reset link'),
),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventLogOut(),
);
},
child: const Text('Back to login page'),
),
],
),
),
),
),

View File

@ -56,58 +56,60 @@ class _LoginViewState extends State<LoginView> {
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
const Text(
'Please log in to your account in order to interact with and create notes!'),
TextField(
controller: _email,
enableSuggestions: false,
autocorrect: false,
keyboardType: TextInputType.emailAddress,
decoration: const InputDecoration(
hintText: 'Enter your email here',
child: SingleChildScrollView(
child: Column(
children: [
const Text(
'Please log in to your account in order to interact with and create notes!'),
TextField(
controller: _email,
enableSuggestions: false,
autocorrect: false,
keyboardType: TextInputType.emailAddress,
decoration: const InputDecoration(
hintText: 'Enter your email here',
),
),
),
TextField(
controller: _password,
obscureText: true,
enableSuggestions: false,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Enter your password here',
TextField(
controller: _password,
obscureText: true,
enableSuggestions: false,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Enter your password here',
),
),
),
TextButton(
onPressed: () async {
final email = _email.text;
final password = _password.text;
context.read<AuthBloc>().add(
AuthEventLogIn(
email,
password,
),
);
},
child: const Text('Login'),
),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventForgotPassword(),
);
},
child: const Text('I forgot my password'),
),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventShouldRegister(),
);
},
child: const Text('Not registered yet? Register here!'),
)
],
TextButton(
onPressed: () async {
final email = _email.text;
final password = _password.text;
context.read<AuthBloc>().add(
AuthEventLogIn(
email,
password,
),
);
},
child: const Text('Login'),
),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventForgotPassword(),
);
},
child: const Text('I forgot my password'),
),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventShouldRegister(),
);
},
child: const Text('Not registered yet? Register here!'),
)
],
),
),
),
),

View File

@ -55,57 +55,59 @@ class _RegisterViewState extends State<RegisterView> {
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('Enter your email and password to see your notes!'),
TextField(
controller: _email,
enableSuggestions: false,
autocorrect: false,
autofocus: true,
keyboardType: TextInputType.emailAddress,
decoration: const InputDecoration(
hintText: 'Enter your email here',
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('Enter your email and password to see your notes!'),
TextField(
controller: _email,
enableSuggestions: false,
autocorrect: false,
autofocus: true,
keyboardType: TextInputType.emailAddress,
decoration: const InputDecoration(
hintText: 'Enter your email here',
),
),
),
TextField(
controller: _password,
obscureText: true,
enableSuggestions: false,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Enter your password here',
TextField(
controller: _password,
obscureText: true,
enableSuggestions: false,
autocorrect: false,
decoration: const InputDecoration(
hintText: 'Enter your password here',
),
),
),
Center(
child: Column(
children: [
TextButton(
onPressed: () async {
final email = _email.text;
final password = _password.text;
context.read<AuthBloc>().add(
AuthEventRegister(
email,
password,
),
);
},
child: const Text('Register'),
),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventLogOut(),
);
},
child: const Text('Already registered? Login here!'),
),
],
Center(
child: Column(
children: [
TextButton(
onPressed: () async {
final email = _email.text;
final password = _password.text;
context.read<AuthBloc>().add(
AuthEventRegister(
email,
password,
),
);
},
child: const Text('Register'),
),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventLogOut(),
);
},
child: const Text('Already registered? Login here!'),
),
],
),
),
),
],
],
),
),
),
),

View File

@ -19,29 +19,31 @@ class _VerifyEmailViewState extends State<VerifyEmailView> {
appBar: AppBar(
title: const Text('Verify email'),
),
body: Column(
children: [
const Text(
"We've sent you an email verification. Please open it to verify your account."),
const Text(
"If you haven't received a verification email yet, press the button below"),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventSendEmailVerification(),
);
},
child: const Text('Send email verification'),
),
TextButton(
onPressed: () async {
context.read<AuthBloc>().add(
const AuthEventLogOut(),
);
},
child: const Text('Restart'),
)
],
body: SingleChildScrollView(
child: Column(
children: [
const Text(
"We've sent you an email verification. Please open it to verify your account."),
const Text(
"If you haven't received a verification email yet, press the button below"),
TextButton(
onPressed: () {
context.read<AuthBloc>().add(
const AuthEventSendEmailVerification(),
);
},
child: const Text('Send email verification'),
),
TextButton(
onPressed: () async {
context.read<AuthBloc>().add(
const AuthEventLogOut(),
);
},
child: const Text('Restart'),
)
],
),
),
);
}