summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--android/app/build.gradle2
-rw-r--r--android/app/google-services.json29
-rw-r--r--android/build.gradle3
-rw-r--r--ios/Runner/GoogleService-Info.plist30
-rw-r--r--ios/firebase_app_id_file.json7
-rw-r--r--lib/credit_card_payment.dart2
-rw-r--r--lib/main.dart6
-rw-r--r--lib/signup.dart243
-rw-r--r--macos/Flutter/GeneratedPluginRegistrant.swift4
-rw-r--r--macos/Runner/GoogleService-Info.plist30
-rw-r--r--macos/firebase_app_id_file.json7
-rw-r--r--pubspec.lock102
-rw-r--r--pubspec.yaml3
-rw-r--r--windows/flutter/generated_plugin_registrant.cc6
-rw-r--r--windows/flutter/generated_plugins.cmake2
16 files changed, 417 insertions, 62 deletions
diff --git a/.gitignore b/.gitignore
index 24476c5..186e0bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,3 +42,6 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
+
+# Firebase
+firebase_options.dart
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 68376f1..1b4a974 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -45,7 +45,7 @@ android {
applicationId "com.example.carpool"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
- minSdkVersion flutter.minSdkVersion
+ minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
diff --git a/android/app/google-services.json b/android/app/google-services.json
new file mode 100644
index 0000000..52c8581
--- /dev/null
+++ b/android/app/google-services.json
@@ -0,0 +1,29 @@
+{
+ "project_info": {
+ "project_number": "824587935735",
+ "project_id": "carpool-3cd5c",
+ "storage_bucket": "carpool-3cd5c.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:824587935735:android:4cd4c87a6a1246105298f2",
+ "android_client_info": {
+ "package_name": "com.example.carpool"
+ }
+ },
+ "oauth_client": [],
+ "api_key": [
+ {
+ "current_key": "AIzaSyBHYiITx2IFiHrDbwU65eKiy3bHhpDgPG0"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": []
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+} \ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index f7eb7f6..0391438 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -7,6 +7,9 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
+ // START: FlutterFire Configuration
+ classpath 'com.google.gms:google-services:4.3.10'
+ // END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist
new file mode 100644
index 0000000..671b01a
--- /dev/null
+++ b/ios/Runner/GoogleService-Info.plist
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>API_KEY</key>
+ <string>AIzaSyDPVVoV41YzjMvC08fsQ7Rfmx2TsIMVrQY</string>
+ <key>GCM_SENDER_ID</key>
+ <string>824587935735</string>
+ <key>PLIST_VERSION</key>
+ <string>1</string>
+ <key>BUNDLE_ID</key>
+ <string>com.example.carpool</string>
+ <key>PROJECT_ID</key>
+ <string>carpool-3cd5c</string>
+ <key>STORAGE_BUCKET</key>
+ <string>carpool-3cd5c.appspot.com</string>
+ <key>IS_ADS_ENABLED</key>
+ <false></false>
+ <key>IS_ANALYTICS_ENABLED</key>
+ <false></false>
+ <key>IS_APPINVITE_ENABLED</key>
+ <true></true>
+ <key>IS_GCM_ENABLED</key>
+ <true></true>
+ <key>IS_SIGNIN_ENABLED</key>
+ <true></true>
+ <key>GOOGLE_APP_ID</key>
+ <string>1:824587935735:ios:0dbe8ccf1d11351d5298f2</string>
+</dict>
+</plist> \ No newline at end of file
diff --git a/ios/firebase_app_id_file.json b/ios/firebase_app_id_file.json
new file mode 100644
index 0000000..add4765
--- /dev/null
+++ b/ios/firebase_app_id_file.json
@@ -0,0 +1,7 @@
+{
+ "file_generated_by": "FlutterFire CLI",
+ "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
+ "GOOGLE_APP_ID": "1:824587935735:ios:0dbe8ccf1d11351d5298f2",
+ "FIREBASE_PROJECT_ID": "carpool-3cd5c",
+ "GCM_SENDER_ID": "824587935735"
+} \ No newline at end of file
diff --git a/lib/credit_card_payment.dart b/lib/credit_card_payment.dart
index 0e73e6d..ef1d737 100644
--- a/lib/credit_card_payment.dart
+++ b/lib/credit_card_payment.dart
@@ -52,7 +52,7 @@ class CreditCardDetailsPage extends StatelessWidget {
const SizedBox(height: 24.0),
ElevatedButton(
onPressed: () {
- // TODO
+ // TODO:
// Implement payment processing logic here
print('Payment processed for Order ID: $orderID');
Navigator.pop(
diff --git a/lib/main.dart b/lib/main.dart
index 594be4d..63bbac7 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,4 +1,6 @@
+import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
+import 'firebase_options.dart';
import 'routes.dart';
import 'login.dart';
import 'cart.dart';
@@ -6,7 +8,9 @@ import 'payement_order.dart';
import 'signup.dart';
import 'order_history.dart';
-void main() {
+void main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+ await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
runApp(MyApp());
}
diff --git a/lib/signup.dart b/lib/signup.dart
index ecb8ec0..18a27ad 100644
--- a/lib/signup.dart
+++ b/lib/signup.dart
@@ -1,75 +1,200 @@
import 'package:flutter/material.dart';
+import 'package:firebase_auth/firebase_auth.dart';
+import 'package:fluttertoast/fluttertoast.dart';
+
+class SignUpPage extends StatefulWidget {
+ const SignUpPage({
+ Key? key,
+ }) : super(key: key);
+
+ @override
+ State<SignUpPage> createState() => _SignUpPageState();
+}
+
+class _SignUpPageState extends State<SignUpPage> {
+ final GlobalKey<FormState> _formKey = GlobalKey();
+
+ final FocusNode _focusNodePassword = FocusNode();
+ final FocusNode _focusNodeConfirmPassword = FocusNode();
+ final TextEditingController _controllerUsername = TextEditingController();
+ final TextEditingController _controllerPassword = TextEditingController();
+ final TextEditingController _corfirmPassword = TextEditingController();
+
+ bool _obscurePassword = true;
-class SignUpPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
- appBar: AppBar(
- title: const Text('Sign Up'),
- ),
- body: Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- TextFormField(
- decoration: const InputDecoration(
- labelText: 'First Name',
- hintText: 'Enter your first name',
+ backgroundColor: Colors.grey[300],
+ body: Form(
+ key: _formKey,
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.all(30.0),
+ child: Column(
+ children: [
+ const SizedBox(height: 20),
+ Image.asset(
+ "assets/logo.png",
+ height: 190,
),
- ),
- const SizedBox(height: 16.0),
- TextFormField(
- decoration: const InputDecoration(
- labelText: 'Last Name',
- hintText: 'Enter your last name',
+ Text(
+ "Welcome ",
+ style: Theme.of(context).textTheme.headlineMedium,
),
- ),
- const SizedBox(height: 16.0),
- TextFormField(
- decoration: const InputDecoration(
- labelText: 'Email',
- hintText: 'Enter your email',
+ Text(
+ "Create your account",
+ style: Theme.of(context).textTheme.bodySmall,
),
- keyboardType: TextInputType.emailAddress,
- ),
- const SizedBox(height: 16.0),
- TextFormField(
- decoration: const InputDecoration(
- labelText: 'Password',
- hintText: 'Enter your password',
+ const SizedBox(height: 40),
+ TextFormField(
+ controller: _controllerUsername,
+ keyboardType: TextInputType.name,
+ decoration: InputDecoration(
+ labelText: "Email",
+ prefixIcon: const Icon(Icons.email_outlined),
+ border: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ ),
+ onEditingComplete: () => _focusNodePassword.requestFocus(),
+ validator: (String? value) {
+ if (value == null || value.isEmpty) {
+ return "Please enter username.";
+ }
+
+ return null;
+ },
+ ),
+ const SizedBox(height: 10),
+ TextFormField(
+ controller: _controllerPassword,
+ focusNode: _focusNodePassword,
+ obscureText: _obscurePassword,
+ keyboardType: TextInputType.visiblePassword,
+ decoration: InputDecoration(
+ labelText: "Password",
+ prefixIcon: const Icon(Icons.password_outlined),
+ suffixIcon: IconButton(
+ onPressed: () {
+ setState(() {
+ _obscurePassword = !_obscurePassword;
+ });
+ },
+ icon: _obscurePassword
+ ? const Icon(Icons.visibility_outlined)
+ : const Icon(Icons.visibility_off_outlined)),
+ border: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ ),
+ validator: (String? value) {
+ if (value == null || value.isEmpty) {
+ return "Please enter password.";
+ }
+
+ return null;
+ },
),
- obscureText: true,
- ),
- const SizedBox(height: 16.0),
- TextFormField(
- decoration: const InputDecoration(
- labelText: 'Confirm password',
- hintText: 'Re enter your password',
+ const SizedBox(height: 10),
+ TextFormField(
+ controller: _corfirmPassword,
+ focusNode: _focusNodeConfirmPassword,
+ obscureText: _obscurePassword,
+ keyboardType: TextInputType.visiblePassword,
+ decoration: InputDecoration(
+ labelText: "Confirm Password",
+ prefixIcon: const Icon(Icons.password_outlined),
+ suffixIcon: IconButton(
+ onPressed: () {
+ setState(() {
+ _obscurePassword = !_obscurePassword;
+ });
+ },
+ icon: _obscurePassword
+ ? const Icon(Icons.visibility_outlined)
+ : const Icon(Icons.visibility_off_outlined)),
+ border: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ ),
+ validator: (String? value) {
+ if (value == null || value.isEmpty) {
+ return "Please enter password.";
+ } else if (_controllerPassword.text.trim() !=
+ _corfirmPassword.text.trim()) {
+ return "Password Must match";
+ }
+
+ return null;
+ },
),
- obscureText: true,
- ),
- const SizedBox(height: 16.0),
- TextFormField(
- decoration: const InputDecoration(
- labelText: 'Phone Number',
- hintText: 'Enter your phone number',
+ const SizedBox(height: 60),
+ Column(
+ children: [
+ ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ minimumSize: const Size.fromHeight(50),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(20),
+ ),
+ backgroundColor: Color(0xFF355291),
+ ),
+ onPressed: () async {
+ if (_formKey.currentState?.validate() ?? false) {
+ try {
+ await FirebaseAuth.instance
+ .createUserWithEmailAndPassword(
+ email: _controllerUsername.text.trim(),
+ password: _controllerPassword.text.trim())
+ .then((value) =>
+ Navigator.pushNamedAndRemoveUntil(
+ context, "/", (route) => false));
+ } on FirebaseAuthException catch (e) {
+ Fluttertoast.showToast(
+ msg: e.message.toString(),
+ gravity: ToastGravity.SNACKBAR);
+ }
+ }
+ },
+ child: const Text("Sign Up"),
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ const Text("Already have an account?"),
+ TextButton(
+ onPressed: () {
+ _formKey.currentState?.reset();
+ Navigator.pushReplacementNamed(context, "/login");
+ },
+ child: const Text("Login"),
+ ),
+ ],
+ ),
+ ],
),
- keyboardType: TextInputType.phone,
- ),
- const SizedBox(height: 24.0),
- ElevatedButton(
- onPressed: () {
- // TODO
- // Implement sign-up logic here
- Navigator.pushNamed(context, '/home');
- },
- child: const Text('Sign Up'),
- ),
- ],
+ ],
+ ),
),
),
);
}
+
+ @override
+ void dispose() {
+ _focusNodePassword.dispose();
+ _controllerUsername.dispose();
+ _controllerPassword.dispose();
+ _corfirmPassword.dispose();
+ super.dispose();
+ }
}
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index cccf817..7b9be20 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,6 +5,10 @@
import FlutterMacOS
import Foundation
+import firebase_auth
+import firebase_core
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
+ FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
+ FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
}
diff --git a/macos/Runner/GoogleService-Info.plist b/macos/Runner/GoogleService-Info.plist
new file mode 100644
index 0000000..4b9d32d
--- /dev/null
+++ b/macos/Runner/GoogleService-Info.plist
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>API_KEY</key>
+ <string>AIzaSyDPVVoV41YzjMvC08fsQ7Rfmx2TsIMVrQY</string>
+ <key>GCM_SENDER_ID</key>
+ <string>824587935735</string>
+ <key>PLIST_VERSION</key>
+ <string>1</string>
+ <key>BUNDLE_ID</key>
+ <string>com.example.carpool.RunnerTests</string>
+ <key>PROJECT_ID</key>
+ <string>carpool-3cd5c</string>
+ <key>STORAGE_BUCKET</key>
+ <string>carpool-3cd5c.appspot.com</string>
+ <key>IS_ADS_ENABLED</key>
+ <false></false>
+ <key>IS_ANALYTICS_ENABLED</key>
+ <false></false>
+ <key>IS_APPINVITE_ENABLED</key>
+ <true></true>
+ <key>IS_GCM_ENABLED</key>
+ <true></true>
+ <key>IS_SIGNIN_ENABLED</key>
+ <true></true>
+ <key>GOOGLE_APP_ID</key>
+ <string>1:824587935735:ios:6a28a4d39e625fb65298f2</string>
+</dict>
+</plist> \ No newline at end of file
diff --git a/macos/firebase_app_id_file.json b/macos/firebase_app_id_file.json
new file mode 100644
index 0000000..184f5c0
--- /dev/null
+++ b/macos/firebase_app_id_file.json
@@ -0,0 +1,7 @@
+{
+ "file_generated_by": "FlutterFire CLI",
+ "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
+ "GOOGLE_APP_ID": "1:824587935735:ios:6a28a4d39e625fb65298f2",
+ "FIREBASE_PROJECT_ID": "carpool-3cd5c",
+ "GCM_SENDER_ID": "824587935735"
+} \ No newline at end of file
diff --git a/pubspec.lock b/pubspec.lock
index 2e10497..9c208c9 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1,6 +1,14 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
+ _flutterfire_internals:
+ dependency: transitive
+ description:
+ name: _flutterfire_internals
+ sha256: eb0ac20f704799b986049fbb3c1c16421eca319a1b872378d669513e12452ba5
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.3.14"
async:
dependency: transitive
description:
@@ -57,6 +65,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
+ firebase_auth:
+ dependency: "direct main"
+ description:
+ name: firebase_auth
+ sha256: "869ff488c7b467e273d7be223f52d3d026576b6e1da92dcd136ff627ae0a8c67"
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.15.0"
+ firebase_auth_platform_interface:
+ dependency: transitive
+ description:
+ name: firebase_auth_platform_interface
+ sha256: ecf9f78ae1a7a1297de01ec975e9e2cfe5b543589b27cc5969849d9a8dc46999
+ url: "https://pub.dev"
+ source: hosted
+ version: "7.0.6"
+ firebase_auth_web:
+ dependency: transitive
+ description:
+ name: firebase_auth_web
+ sha256: "96f89e2340cdf373109cb29afec401c170aa2d98fb0833687793c8017e36f435"
+ url: "https://pub.dev"
+ source: hosted
+ version: "5.8.9"
+ firebase_core:
+ dependency: "direct main"
+ description:
+ name: firebase_core
+ sha256: d301561d614487688d797717bef013a264c517d1d09e4c5c1325c3a64c835efb
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.24.0"
+ firebase_core_platform_interface:
+ dependency: transitive
+ description:
+ name: firebase_core_platform_interface
+ sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63
+ url: "https://pub.dev"
+ source: hosted
+ version: "5.0.0"
+ firebase_core_web:
+ dependency: transitive
+ description:
+ name: firebase_core_web
+ sha256: "10159d9ee42c79f4548971d92f3f0fcd5791f6738cda3583a4e3b2c8b244c018"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.9.0"
flutter:
dependency: "direct main"
description: flutter
@@ -75,6 +131,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_web_plugins:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.0"
+ fluttertoast:
+ dependency: "direct main"
+ description:
+ name: fluttertoast
+ sha256: dfdde255317af381bfc1c486ed968d5a43a2ded9c931e87cbecd88767d6a71c1
+ url: "https://pub.dev"
+ source: hosted
+ version: "8.2.4"
+ http_parser:
+ dependency: transitive
+ description:
+ name: http_parser
+ sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.0.2"
intl:
dependency: "direct main"
description:
@@ -83,6 +160,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.18.1"
+ js:
+ dependency: transitive
+ description:
+ name: js
+ sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.6.7"
lints:
dependency: transitive
description:
@@ -123,6 +208,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.3"
+ plugin_platform_interface:
+ dependency: transitive
+ description:
+ name: plugin_platform_interface
+ sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.7"
sky_engine:
dependency: transitive
description: flutter
@@ -176,6 +269,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.0"
+ typed_data:
+ dependency: transitive
+ description:
+ name: typed_data
+ sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.3.2"
vector_math:
dependency: transitive
description:
@@ -194,3 +295,4 @@ packages:
version: "0.1.4-beta"
sdks:
dart: ">=3.1.5 <4.0.0"
+ flutter: ">=3.3.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 47fa101..dab24ec 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -36,6 +36,9 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
intl: ^0.18.1
+ firebase_core: ^2.24.0
+ firebase_auth: ^4.15.0
+ fluttertoast: ^8.2.4
dev_dependencies:
flutter_test:
diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc
index 8b6d468..d141b74 100644
--- a/windows/flutter/generated_plugin_registrant.cc
+++ b/windows/flutter/generated_plugin_registrant.cc
@@ -6,6 +6,12 @@
#include "generated_plugin_registrant.h"
+#include <firebase_auth/firebase_auth_plugin_c_api.h>
+#include <firebase_core/firebase_core_plugin_c_api.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
+ FirebaseAuthPluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi"));
+ FirebaseCorePluginCApiRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
}
diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake
index b93c4c3..29944d5 100644
--- a/windows/flutter/generated_plugins.cmake
+++ b/windows/flutter/generated_plugins.cmake
@@ -3,6 +3,8 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
+ firebase_auth
+ firebase_core
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST