Skip to content

Commit 1f69bc4

Browse files
committed
first cummit
1 parent 833a9f5 commit 1f69bc4

File tree

7 files changed

+191
-25
lines changed

7 files changed

+191
-25
lines changed

android/app/build.gradle

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ if (flutterVersionName == null) {
2222
}
2323

2424
apply plugin: 'com.android.application'
25+
apply plugin: 'com.google.gms.google-services'
2526
apply plugin: 'kotlin-android'
2627
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2728

@@ -47,8 +48,8 @@ android {
4748
applicationId "com.example.login_page"
4849
// You can update the following values to match your application needs.
4950
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50-
minSdkVersion flutter.minSdkVersion
51-
targetSdkVersion flutter.targetSdkVersion
51+
minSdkVersion 21
52+
targetSdkVersion 30
5253
versionCode flutterVersionCode.toInteger()
5354
versionName flutterVersionName
5455
}
@@ -68,4 +69,6 @@ flutter {
6869

6970
dependencies {
7071
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72+
implementation platform('com.google.firebase:firebase-bom:30.1.0')
73+
implementation 'com.google.firebase:firebase-analytics'
7174
}

android/app/google-services.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"project_info": {
3+
"project_number": "67146073120",
4+
"project_id": "emailpasswordauth-38ee5",
5+
"storage_bucket": "emailpasswordauth-38ee5.appspot.com"
6+
},
7+
"client": [
8+
{
9+
"client_info": {
10+
"mobilesdk_app_id": "1:67146073120:android:f8af0d0f76b94112f5e845",
11+
"android_client_info": {
12+
"package_name": "com.example.login_page"
13+
}
14+
},
15+
"oauth_client": [
16+
{
17+
"client_id": "67146073120-lakptfhc11lpvigs3n7ncq67n48mm186.apps.googleusercontent.com",
18+
"client_type": 3
19+
}
20+
],
21+
"api_key": [
22+
{
23+
"current_key": "AIzaSyBYABrgm-B98rEGi8g2xL5MjKkQxN6aCGg"
24+
}
25+
],
26+
"services": {
27+
"appinvite_service": {
28+
"other_platform_oauth_client": [
29+
{
30+
"client_id": "67146073120-lakptfhc11lpvigs3n7ncq67n48mm186.apps.googleusercontent.com",
31+
"client_type": 3
32+
}
33+
]
34+
}
35+
}
36+
}
37+
],
38+
"configuration_version": "1"
39+
}

android/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ buildscript {
77

88
dependencies {
99
classpath 'com.android.tools.build:gradle:7.1.2'
10+
classpath 'com.google.gms:google-services:4.3.10'
1011
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1112
}
1213
}

lib/main.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import 'package:firebase_core/firebase_core.dart';
12
import 'package:flutter/material.dart';
23
import 'package:login_page/screens/login_screen.dart';
34

4-
void main() {
5+
Future<void> main() async {
6+
WidgetsFlutterBinding.ensureInitialized();
7+
await Firebase.initializeApp();
58
runApp(const MyApp());
69
}
710

lib/screens/login_screen.dart

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:firebase_auth/firebase_auth.dart';
12
import 'package:flutter/material.dart';
23
import 'package:login_page/screens/home_screen.dart';
34
import 'package:login_page/screens/registration_screen.dart';
@@ -15,6 +16,8 @@ class _LoginScreenState extends State<LoginScreen> {
1516
final TextEditingController emailController = new TextEditingController();
1617
final TextEditingController passwordController = new TextEditingController();
1718

19+
final _auth = FirebaseAuth.instance;
20+
1821
@override
1922
Widget build(BuildContext context) {
2023
// emailfield
@@ -23,6 +26,15 @@ class _LoginScreenState extends State<LoginScreen> {
2326
autofocus: false,
2427
controller: emailController,
2528
keyboardType: TextInputType.emailAddress,
29+
validator: (value) {
30+
if (value!.isEmpty) {
31+
return ('Please enter your email');
32+
}
33+
if (!RegExp("^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+.[a-z]").hasMatch(value)) {
34+
return ('Please enter a valid email');
35+
}
36+
return null;
37+
},
2638
onSaved: (value) {
2739
emailController.text = value!;
2840
},
@@ -44,6 +56,16 @@ class _LoginScreenState extends State<LoginScreen> {
4456
final passwordField = TextFormField(
4557
autofocus: false,
4658
controller: passwordController,
59+
validator: (value) {
60+
RegExp regex = new RegExp(r'^.{6,}$');
61+
if (value!.isEmpty) {
62+
return ("Password is required for login");
63+
}
64+
if (!regex.hasMatch(value)) {
65+
return ("Enter Valid Password(Min. 6 Character)");
66+
}
67+
return null;
68+
},
4769
onSaved: (value) {
4870
passwordController.text = value!;
4971
},
@@ -70,12 +92,7 @@ class _LoginScreenState extends State<LoginScreen> {
7092
padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
7193
minWidth: MediaQuery.of(context).size.width,
7294
onPressed: () {
73-
Navigator.pushReplacement(
74-
context,
75-
MaterialPageRoute(
76-
builder: (context) => HomeScreen(),
77-
),
78-
);
95+
signIn(emailController.text, passwordController.text);
7996
},
8097
child: Text(
8198
'Login',
@@ -161,3 +178,5 @@ class _LoginScreenState extends State<LoginScreen> {
161178
);
162179
}
163180
}
181+
182+
// login function

pubspec.lock

+111
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@ packages:
3636
url: "https://pub.dartlang.org"
3737
source: hosted
3838
version: "1.1.0"
39+
cloud_firestore:
40+
dependency: "direct main"
41+
description:
42+
name: cloud_firestore
43+
url: "https://pub.dartlang.org"
44+
source: hosted
45+
version: "3.1.17"
46+
cloud_firestore_platform_interface:
47+
dependency: transitive
48+
description:
49+
name: cloud_firestore_platform_interface
50+
url: "https://pub.dartlang.org"
51+
source: hosted
52+
version: "5.5.7"
53+
cloud_firestore_web:
54+
dependency: transitive
55+
description:
56+
name: cloud_firestore_web
57+
url: "https://pub.dartlang.org"
58+
source: hosted
59+
version: "2.6.16"
3960
collection:
4061
dependency: transitive
4162
description:
@@ -57,6 +78,48 @@ packages:
5778
url: "https://pub.dartlang.org"
5879
source: hosted
5980
version: "1.3.0"
81+
firebase_auth:
82+
dependency: "direct main"
83+
description:
84+
name: firebase_auth
85+
url: "https://pub.dartlang.org"
86+
source: hosted
87+
version: "3.3.19"
88+
firebase_auth_platform_interface:
89+
dependency: transitive
90+
description:
91+
name: firebase_auth_platform_interface
92+
url: "https://pub.dartlang.org"
93+
source: hosted
94+
version: "6.2.7"
95+
firebase_auth_web:
96+
dependency: transitive
97+
description:
98+
name: firebase_auth_web
99+
url: "https://pub.dartlang.org"
100+
source: hosted
101+
version: "3.3.16"
102+
firebase_core:
103+
dependency: "direct main"
104+
description:
105+
name: firebase_core
106+
url: "https://pub.dartlang.org"
107+
source: hosted
108+
version: "1.17.1"
109+
firebase_core_platform_interface:
110+
dependency: transitive
111+
description:
112+
name: firebase_core_platform_interface
113+
url: "https://pub.dartlang.org"
114+
source: hosted
115+
version: "4.4.0"
116+
firebase_core_web:
117+
dependency: transitive
118+
description:
119+
name: firebase_core_web
120+
url: "https://pub.dartlang.org"
121+
source: hosted
122+
version: "1.6.4"
60123
flutter:
61124
dependency: "direct main"
62125
description: flutter
@@ -74,6 +137,39 @@ packages:
74137
description: flutter
75138
source: sdk
76139
version: "0.0.0"
140+
flutter_web_plugins:
141+
dependency: transitive
142+
description: flutter
143+
source: sdk
144+
version: "0.0.0"
145+
fluttertoast:
146+
dependency: "direct main"
147+
description:
148+
name: fluttertoast
149+
url: "https://pub.dartlang.org"
150+
source: hosted
151+
version: "8.0.9"
152+
http_parser:
153+
dependency: transitive
154+
description:
155+
name: http_parser
156+
url: "https://pub.dartlang.org"
157+
source: hosted
158+
version: "4.0.1"
159+
intl:
160+
dependency: transitive
161+
description:
162+
name: intl
163+
url: "https://pub.dartlang.org"
164+
source: hosted
165+
version: "0.17.0"
166+
js:
167+
dependency: transitive
168+
description:
169+
name: js
170+
url: "https://pub.dartlang.org"
171+
source: hosted
172+
version: "0.6.4"
77173
lints:
78174
dependency: transitive
79175
description:
@@ -109,6 +205,13 @@ packages:
109205
url: "https://pub.dartlang.org"
110206
source: hosted
111207
version: "1.8.1"
208+
plugin_platform_interface:
209+
dependency: transitive
210+
description:
211+
name: plugin_platform_interface
212+
url: "https://pub.dartlang.org"
213+
source: hosted
214+
version: "2.1.2"
112215
sky_engine:
113216
dependency: transitive
114217
description: flutter
@@ -156,6 +259,13 @@ packages:
156259
url: "https://pub.dartlang.org"
157260
source: hosted
158261
version: "0.4.9"
262+
typed_data:
263+
dependency: transitive
264+
description:
265+
name: typed_data
266+
url: "https://pub.dartlang.org"
267+
source: hosted
268+
version: "1.3.1"
159269
vector_math:
160270
dependency: transitive
161271
description:
@@ -165,3 +275,4 @@ packages:
165275
version: "2.1.2"
166276
sdks:
167277
dart: ">=2.17.1 <3.0.0"
278+
flutter: ">=1.12.13+hotfix.5"

pubspec.yaml

+6-16
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,21 @@ environment:
2727
# the latest version available on pub.dev. To see which dependencies have newer
2828
# versions available, run `flutter pub outdated`.
2929
dependencies:
30+
cloud_firestore: ^3.1.17
31+
cupertino_icons: ^1.0.2
32+
firebase_auth: ^3.3.19
33+
firebase_core: ^1.17.1
3034
flutter:
3135
sdk: flutter
32-
33-
34-
# The following adds the Cupertino Icons font to your application.
35-
# Use with the CupertinoIcons class for iOS style icons.
36-
cupertino_icons: ^1.0.2
36+
fluttertoast: ^8.0.9
3737

3838
dev_dependencies:
39+
flutter_lints: ^2.0.0
3940
flutter_test:
4041
sdk: flutter
4142

42-
# The "flutter_lints" package below contains a set of recommended lints to
43-
# encourage good coding practices. The lint set provided by the package is
44-
# activated in the `analysis_options.yaml` file located at the root of your
45-
# package. See that file for information about deactivating specific lint
46-
# rules and activating additional ones.
47-
flutter_lints: ^2.0.0
48-
4943
# For information on the generic Dart part of this file, see the
5044
# following page: https://dart.dev/tools/pub/pubspec
51-
5245
# The following section is specific to Flutter packages.
5346
flutter:
5447

@@ -61,13 +54,10 @@ flutter:
6154
assets:
6255
- assets/images/
6356
# - images/a_dot_ham.jpeg
64-
6557
# An image asset can refer to one or more resolution-specific "variants", see
6658
# https://flutter.dev/assets-and-images/#resolution-aware
67-
6859
# For details regarding adding assets from package dependencies, see
6960
# https://flutter.dev/assets-and-images/#from-packages
70-
7161
# To add custom fonts to your application, add a fonts section here,
7262
# in this "flutter" section. Each entry in this list should have a
7363
# "family" key with the font family name, and a "fonts" key with a

0 commit comments

Comments
 (0)