diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29a3a50 --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..32dc8a5 --- /dev/null +++ b/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "300451adae589accbece3490f4396f10bdf15e6e" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: android + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: ios + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: linux + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: macos + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: web + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: windows + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md new file mode 100644 index 0000000..de2bc35 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# cofounderella + +App for Cofounder Matching + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..3803786 --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,70 @@ +plugins { + id "com.android.application" + // START: FlutterFire Configuration + id 'com.google.gms.google-services' + // END: FlutterFire Configuration + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +android { + namespace "com.example.cofounderella" + compileSdk flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.cofounderella" + // 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 + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + 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 + } + } +} + +flutter { + source '../..' +} + +dependencies {} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6404568 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/cofounderella/MainActivity.kt b/android/app/src/main/kotlin/com/example/cofounderella/MainActivity.kt new file mode 100644 index 0000000..a42b018 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/cofounderella/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.cofounderella + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..bc157bd --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,18 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..598d13f --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e1ca574 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..816dbe0 --- /dev/null +++ b/android/settings.gradle @@ -0,0 +1,29 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() + + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false + // START: FlutterFire Configuration + id "com.google.gms.google-services" version "4.3.15" apply false + // END: FlutterFire Configuration + id "org.jetbrains.kotlin.android" version "1.7.10" apply false +} + +include ":app" diff --git a/lib/auth/auth_gate.dart b/lib/auth/auth_gate.dart new file mode 100644 index 0000000..bd2590b --- /dev/null +++ b/lib/auth/auth_gate.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:cofounderella/auth/login_or_register.dart'; +import 'package:cofounderella/pages/home_page.dart'; + +class AuthGate extends StatelessWidget{ + const AuthGate({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: StreamBuilder( + stream: FirebaseAuth.instance.authStateChanges(), + builder: (context, snapshot){ + + // check if user is logged in or not + if(snapshot.hasData){ + return const MyHomePage(title: "MyHomePage Test Title",); + } + else { + return const LoginOrRegister(); + } + + + }, + ), + ); + } +} \ No newline at end of file diff --git a/lib/auth/auth_service.dart b/lib/auth/auth_service.dart new file mode 100644 index 0000000..d13cdfe --- /dev/null +++ b/lib/auth/auth_service.dart @@ -0,0 +1,40 @@ +import 'package:firebase_auth/firebase_auth.dart'; + +class AuthService { + // instance of auth + final FirebaseAuth _auth = FirebaseAuth.instance; + + //sign in + Future signInWithEmailPassword(String email, password) async { + try { + UserCredential userCredential = await _auth.signInWithEmailAndPassword( + email: email, + password: password, + ); + return userCredential; + } on FirebaseAuthException catch (e) { + throw Exception(e.code); + } + } + + // sign up (register) + Future signUpWithEmailPassword(String email, password) async { + try { + UserCredential userCredential = + await _auth.createUserWithEmailAndPassword( + email: email, + password: password, + ); + return userCredential; + } on FirebaseAuthException catch (e) { + throw Exception(e.code); + } + } + +// sign out + Future signOut() async { + return await _auth.signOut(); + } + +// errors +} diff --git a/lib/auth/login_or_register.dart b/lib/auth/login_or_register.dart new file mode 100644 index 0000000..b3f7fb0 --- /dev/null +++ b/lib/auth/login_or_register.dart @@ -0,0 +1,36 @@ +import 'package:cofounderella/pages/login_page.dart'; +import 'package:cofounderella/pages/register_page.dart'; +import 'package:flutter/material.dart'; + +class LoginOrRegister extends StatefulWidget{ + const LoginOrRegister({super.key}); + + @override + State createState() => _LoginOrRegisterState(); +} + +class _LoginOrRegisterState extends State{ + // initially, show login page + bool showLoginPage = true; + + // toggle between login and register page + void togglePages(){ + setState(() { + showLoginPage = !showLoginPage; + }); + } + + @override + Widget build(BuildContext context) { + if (showLoginPage) { + return LoginPage( + onTap: togglePages, + ); + } else { + return RegisterPage( + onTap: togglePages, + ); + } + } + +} \ No newline at end of file diff --git a/lib/components/my_button.dart b/lib/components/my_button.dart new file mode 100644 index 0000000..06a4e21 --- /dev/null +++ b/lib/components/my_button.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; + +class MyButton extends StatelessWidget { + void Function()? onTap; + final String text; + + MyButton({ + super.key, + required this.text, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onTap, + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondary, + borderRadius: BorderRadius.circular(8), + ), + padding: const EdgeInsets.all(25), + margin: const EdgeInsets.symmetric(horizontal: 25), + child: Center( + child: Text(text), + ), + ), + ); + } +} diff --git a/lib/components/my_textfield.dart b/lib/components/my_textfield.dart new file mode 100644 index 0000000..b8c8cfb --- /dev/null +++ b/lib/components/my_textfield.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; + +class MyTextField extends StatelessWidget { + final String hintText; + final bool hideText; + final TextEditingController controller; + + const MyTextField({ + super.key, + required this.hintText, + required this.hideText, + required this.controller, + }); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(25.0), + child: TextField( + obscureText: hideText, + controller: controller, + decoration: InputDecoration( + enabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Theme.of(context).colorScheme.tertiary), + ), + focusedBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Theme.of(context).colorScheme.primary), + ), + fillColor: Theme.of(context).colorScheme.secondary, + filled: true, + hintText: hintText, + hintStyle: TextStyle( + color: Theme.of(context).colorScheme.primary, + )), + ), + ); + } +} diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 0000000..e14157a --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,86 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: type=lint +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) { + return web; + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + return macos; + case TargetPlatform.windows: + return windows; + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions web = FirebaseOptions( + apiKey: 'AIzaSyAcTMF5_e5pf-2K2bLrS5__RG49OD5-zxg', + appId: '1:630950433270:web:96992758355ef2ef5337d7', + messagingSenderId: '630950433270', + projectId: 'cofounderella', + authDomain: 'cofounderella.firebaseapp.com', + storageBucket: 'cofounderella.appspot.com', + ); + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyDeLVSu5UjJOOYUu2_zF7SNW0n6g8rCYBU', + appId: '1:630950433270:android:1b1c1c5d2f8951e05337d7', + messagingSenderId: '630950433270', + projectId: 'cofounderella', + storageBucket: 'cofounderella.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyCSjat4DIfcr8DGlAmUDvKiQNCT2n0Txzc', + appId: '1:630950433270:ios:d6beb39c4c5910795337d7', + messagingSenderId: '630950433270', + projectId: 'cofounderella', + storageBucket: 'cofounderella.appspot.com', + iosBundleId: 'com.example.cofounderella', + ); + + static const FirebaseOptions macos = FirebaseOptions( + apiKey: 'AIzaSyCSjat4DIfcr8DGlAmUDvKiQNCT2n0Txzc', + appId: '1:630950433270:ios:d6beb39c4c5910795337d7', + messagingSenderId: '630950433270', + projectId: 'cofounderella', + storageBucket: 'cofounderella.appspot.com', + iosBundleId: 'com.example.cofounderella', + ); + + static const FirebaseOptions windows = FirebaseOptions( + apiKey: 'AIzaSyAcTMF5_e5pf-2K2bLrS5__RG49OD5-zxg', + appId: '1:630950433270:web:056a9486d097d8a55337d7', + messagingSenderId: '630950433270', + projectId: 'cofounderella', + authDomain: 'cofounderella.firebaseapp.com', + storageBucket: 'cofounderella.appspot.com', + ); +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..4183f8b --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,34 @@ +import 'package:cofounderella/auth/auth_gate.dart'; +import 'package:cofounderella/auth/login_or_register.dart'; +import 'package:cofounderella/themes/light_mode.dart'; +import 'package:flutter/material.dart'; +import 'package:firebase_core/firebase_core.dart'; +import 'firebase_options.dart'; + + +void main() async { + // Firebase stuff + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + // Standard stuff + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Flutter Demo', + theme: lightMode, + home: const AuthGate(), + ); + } +} + + diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart new file mode 100644 index 0000000..dc393f7 --- /dev/null +++ b/lib/pages/login_page.dart @@ -0,0 +1,110 @@ +import 'package:cofounderella/auth/auth_service.dart'; +import 'package:flutter/material.dart'; +import 'package:cofounderella/components/my_button.dart'; +import 'package:cofounderella/components/my_textfield.dart'; + +class LoginPage extends StatelessWidget { + //text controllers + final TextEditingController _emailController = TextEditingController(); + final TextEditingController _passwordController = TextEditingController(); + + // tap to go to register page + final void Function()? onTap; + + LoginPage({super.key, required this.onTap}); + + // login method + void login(BuildContext context) async { + // auth service + final authService = AuthService(); + + // try login + try { + await authService.signInWithEmailPassword( + _emailController.text, + _passwordController.text, + ); + } catch (e) { + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(e.toString()), + ), + ); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Theme.of(context).colorScheme.background, + body: Center( + child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ + //logo + Icon( + Icons.people_alt, + size: 60, + color: Theme.of(context).colorScheme.primary, + ), + + const SizedBox(height: 50), + + //welcome back message + Text( + "Welcome back, you've been missed", + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + fontSize: 16, + ), + ), + + const SizedBox(height: 25), + + // email textfield + MyTextField( + hintText: "E-Mail", + hideText: false, + controller: _emailController, + ), + + //const SizedBox(height: 25), + + // password textfield + MyTextField( + hintText: "Password", + hideText: true, + controller: _passwordController, + ), + + //login button + MyButton( + text: "Login", + onTap: () => login(context), + ), + + const SizedBox(height: 25), + + // register now + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Not a member? ", + style: TextStyle(color: Theme.of(context).colorScheme.primary), + ), + GestureDetector( + onTap: onTap, + child: Text( + "Register now", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ) + ]), + ), + ); + } +} diff --git a/lib/pages/register_page.dart b/lib/pages/register_page.dart new file mode 100644 index 0000000..4bfc71a --- /dev/null +++ b/lib/pages/register_page.dart @@ -0,0 +1,141 @@ +import 'package:cofounderella/auth/auth_service.dart'; +import 'package:flutter/material.dart'; + +import '../components/my_button.dart'; +import '../components/my_textfield.dart'; + +class RegisterPage extends StatelessWidget { + //text controllers + final TextEditingController _nameController = TextEditingController(); + final TextEditingController _lastnameController = TextEditingController(); + final TextEditingController _emailController = TextEditingController(); + final TextEditingController _passwordController = TextEditingController(); + final TextEditingController _confirmPassController = TextEditingController(); + + // tap to go to login page + final void Function()? onTap; + + RegisterPage({super.key, required this.onTap}); + + // register method + void register(BuildContext context) { + // get auth service + final _auth = AuthService(); + + // check if passwords match + if (_passwordController.text == _confirmPassController.text) { + try { + _auth.signUpWithEmailPassword( + _emailController.text, + _passwordController.text, + ); + } catch (e) { + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(e.toString()), + ), + ); + } + } else { + showDialog( + context: context, + builder: (context) => const AlertDialog( + title: Text("Passwords do not match!"), + ), + ); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Theme.of(context).colorScheme.background, + body: Center( + child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ + //logo + Icon( + Icons.people_alt, + size: 60, + color: Theme.of(context).colorScheme.primary, + ), + + const SizedBox(height: 50), + + //welcome back message + Text( + "Let's create an account for you", + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + fontSize: 16, + ), + ), + + const SizedBox(height: 25), + + // name text field + MyTextField( + hintText: "First Name", + hideText: false, + controller: _nameController, + ), + MyTextField( + hintText: "Last Name", + hideText: false, + controller: _lastnameController, + ), + + // email text field + MyTextField( + hintText: "E-Mail", + hideText: false, + controller: _emailController, + ), + + const SizedBox(height: 10), + + // password text field + MyTextField( + hintText: "Password", + hideText: true, + controller: _passwordController, + ), + + MyTextField( + hintText: "Confirm Password", + hideText: true, + controller: _confirmPassController, + ), + + //login button + MyButton( + text: "Register", + onTap: () => register(context), + ), + + const SizedBox(height: 25), + + // register now + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Already have an account? ", + style: TextStyle(color: Theme.of(context).colorScheme.primary), + ), + GestureDetector( + onTap: onTap, + child: const Text( + "Login now", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ) + ]), + ), + ); + } +} diff --git a/lib/themes/light_mode.dart b/lib/themes/light_mode.dart new file mode 100644 index 0000000..71a20b8 --- /dev/null +++ b/lib/themes/light_mode.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; + +ThemeData lightMode = ThemeData( + colorScheme: ColorScheme.light( + background: Colors.grey.shade300, + primary: Colors.grey.shade500, + secondary: Colors.grey.shade200, + tertiary: Colors.white, + inversePrimary: Colors.grey.shade900, + ), +); \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..fc36639 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,92 @@ +name: cofounderella +description: "App for Cofounder Matching" +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=3.3.3 <4.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.6 + firebase_core: ^2.30.1 + firebase_auth: ^4.19.4 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^3.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/web/favicon.png b/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/web/favicon.png differ diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/web/icons/Icon-192.png differ diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/web/icons/Icon-512.png differ diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000..eb9b4d7 Binary files /dev/null and b/web/icons/Icon-maskable-192.png differ diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000..d69c566 Binary files /dev/null and b/web/icons/Icon-maskable-512.png differ diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..d02105a --- /dev/null +++ b/web/index.html @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + cofounderella + + + + + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..87c0b52 --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "cofounderella", + "short_name": "cofounderella", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "App for Cofounder Matching", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +}