Skip to content
Snippets Groups Projects
Commit da3203da authored by Erik Hinkelmanns's avatar Erik Hinkelmanns
Browse files

Merge remote-tracking branch 'origin/madlen' into music_player

# Conflicts:
#	lib/classification/classification.dart
#	lib/loginRegister/login.dart
#	macos/Flutter/GeneratedPluginRegistrant.swift
#	pubspec.lock
#	pubspec.yaml
parents e07ff29c bb5978eb
Branches
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import '../firebase.dart';
//Suchleiste mit den Vorschlägen aller Genres aus Spotify
class CustomSearchDelegate extends SearchDelegate<String>{
String colorText;
CustomSearchDelegate(this.colorText);
......
This diff is collapsed.
......@@ -36,40 +36,40 @@ class changeFirebase{
return true;
}
String getGenreByHex(String code){
Future<String> getGenreByHex(String code) async {
switch (code){
case 'FF0000':
return getGenreByColor('Red');
case 'FF8800':
return getGenreByColor('Orange');
return await getGenreByColor('Red');
case 'FFA500':
return await getGenreByColor('Orange');
case 'FFFF00':
return getGenreByColor('Yellow');
case 'FF8800':
case '00FF00':
return getGenreByColor('Green');
case 'FFFFFF':
return getGenreByColor('White');
case '0000FF':
return getGenreByColor('Blue');
case 'FFC0CB':
case 'FF46FD':
return getGenreByColor('Pink');
case 'A020F0':
case '7F45D8':
return getGenreByColor('Purple');
case '964B00':
case '67402D':
return getGenreByColor('Brown');
case '000000':
return getGenreByColor('Black');
}
return '';
return 'nothing';
}
String getGenreByColor(String color){
Future<String> getGenreByColor(String color) async {
String genre = '';
FutureBuilder<DocumentSnapshot>(
future: FirebaseFirestore.instance.collection('classification').doc(id).get(),
builder: (BuildContext context, AsyncSnapshot<DocumentSnapshot> snapshot){
genre = snapshot.data![color];
return const SizedBox();
await FirebaseFirestore.instance.collection('classification').doc(id).get().then((snapshot) async {
genre = await snapshot.data()![color];
return genre;
});
return genre;
}
}
\ No newline at end of file
......@@ -6,10 +6,16 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
import 'package:google_fonts/google_fonts.dart';
import '../homepage.dart';
import '../main.dart';
/*
Klasse zum Einloggen
Die Daten werden aus der Datenbank geholt
Entsprechende Fehlermeldungen werden abgefangen
*/
class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);
......@@ -48,10 +54,11 @@ class _LoginPageState extends State<LoginPage> {
child : Column(
children:[
SizedBox(height: 80,),
const Expanded(
Expanded(
child: Text(
'Ambient!',
style: TextStyle(fontSize: 50.0, color: Colors.white),
style: GoogleFonts.cabin(
fontSize: 50.0, color: Colors.white,),
),),
Expanded(
child: Column(
......@@ -63,9 +70,9 @@ class _LoginPageState extends State<LoginPage> {
keyboardType: TextInputType.name,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.person, color: Colors.white),
hintText: 'Username',
hintText: 'E-Mail',
hintStyle: TextStyle(color: Colors.white),
labelText: 'Username',
labelText: 'E-Mail',
labelStyle: TextStyle(color: Colors.white),
),
),),
......@@ -94,7 +101,7 @@ class _LoginPageState extends State<LoginPage> {
/*FirebaseAuth.instance.signInWithEmailAndPassword(
email: _emailTextController.text,
password: _passwordTextController.text).then((value) {
Navigator.push(context, MaterialPageRoute(builder: (context)=>const HUD()));
Navigator.push(context, MaterialPageRoute(builder: (context)=>const ClassificationPage()));
}).onError((error, stackTrace){
setState(() {
_wrongInput = true;
......
......@@ -4,10 +4,15 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import '../classification/classification.dart';
import 'package:ambient/loginRegister/login.dart';
import 'package:page_transition/page_transition.dart';
import 'package:google_fonts/google_fonts.dart';
/*
Klasse zum Registrieren
Die User Daten werden in die Firebase Datenbank gespeichert
Fehlermeldungen beim Registrieren werden abgefangen
*/
class RegistrationPage extends StatefulWidget {
const RegistrationPage({Key? key}) : super(key: key);
......@@ -41,19 +46,19 @@ class _RegistrationPage extends State<RegistrationPage> {
Scaffold(
backgroundColor: Colors.transparent,
body: Center(
child :Container(
decoration: const BoxDecoration(
decoration: BoxDecoration(
),
child: SizedBox(width: 250, height: 600,
child : Column(
children:[
SizedBox(height: 40,),
const Expanded(
Expanded(
child: Text(
'Ambient!',
style: TextStyle(fontSize: 60.0, color: Colors.white),
style: GoogleFonts.cabin(
fontSize: 50.0, color: Colors.white,)
),),
Expanded(
......@@ -111,25 +116,27 @@ class _RegistrationPage extends State<RegistrationPage> {
),
loginRegisterButton(context, false, () {
try{
FirebaseAuth.instance.createUserWithEmailAndPassword(
email: _emailTextController.text,
password: _passwordTextController.text).then((value){
createSetUp();
print ("Created new account");
Navigator.push(context, MaterialPageRoute(builder: (context)=>ClassificationPage()));
});}
on FirebaseAuthException catch(e){
if(e.code == 'ERROR_EMAIL_ALREADY_IN_USE'){
}).onError((error, stackTrace){
String e = error.toString();
print('Error 1 ' + error.toString());
if(error.toString().contains('email-already-in-use')){
print("Email already in use");
setState(() {
_infoText = 'Email already in use';
});
}
if(e.code == 'weak-password'){
else if(error.toString().contains('weak-password')){
setState(() {
_infoText = 'weak Password';
});}
if(e.code == 'invalid-email'){
else if(error.toString().contains('invalid-email')){
setState(() {
_infoText = 'invalid email';
});}
......@@ -139,7 +146,7 @@ class _RegistrationPage extends State<RegistrationPage> {
});
}
};
});
}),
SizedBox(height: 20),
loginPage(),
......@@ -177,13 +184,10 @@ class _RegistrationPage extends State<RegistrationPage> {
);
}
Future addDisplayName() async{
FirebaseAuth.instance.currentUser?.updateDisplayName(_usernameTextController.text);
}
//Beim Anlegen eines Accounts werden auch die Farben angelegt,
//damit der User später die Genres zuordnen kann
Future createSetUp() async{
//final String id = '${FirebaseAuth.instance.currentUser?.uid.toString()}_genres';
final String id = (FirebaseAuth.instance.currentUser?.uid.toString())!+'_genres';
final user = FirebaseFirestore.instance.collection('classification').doc(id);
......@@ -200,6 +204,7 @@ class _RegistrationPage extends State<RegistrationPage> {
'Brown' : null,
'Black' : null,
};
print('set up');
await user.set(json);
}
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'login.dart';
//Widgets für den Login/Registrations Screen
Container loginRegisterButton(
BuildContext context, bool isLogin, Function onTap) {
return Container(
......@@ -71,7 +73,6 @@ Container signOutButton(
//textWidth
height: 10,
child: Text(
text,
style: const TextStyle(
color: Colors.red),
......
......@@ -5,18 +5,14 @@
import FlutterMacOS
import Foundation
import audio_session
import cloud_firestore
import firebase_auth
import firebase_core
import just_audio
import path_provider_macos
import path_provider_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}
......@@ -15,13 +15,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
audio_session:
dependency: transitive
description:
name: audio_session
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.13"
boolean_selector:
dependency: transitive
description:
......@@ -49,7 +42,7 @@ packages:
name: cloud_firestore
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.1"
version: "4.3.0"
cloud_firestore_platform_interface:
dependency: transitive
description:
......@@ -63,7 +56,7 @@ packages:
name: cloud_firestore_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.1"
version: "3.2.0"
collection:
dependency: transitive
description:
......@@ -71,20 +64,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
color_models:
dependency: transitive
description:
name: color_models
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.3"
cross_file:
dependency: transitive
description:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3+2"
crypto:
dependency: transitive
description:
......@@ -99,20 +78,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
dio:
dependency: transitive
description:
name: dio
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.6"
drop_shadow_image:
dependency: "direct main"
description:
name: drop_shadow_image
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.1"
fake_async:
dependency: transitive
description:
......@@ -134,34 +99,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.4"
file_picker:
dependency: "direct main"
description:
name: file_picker
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.4"
firebase_auth:
dependency: "direct main"
description:
name: firebase_auth
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
version: "4.2.3"
firebase_auth_platform_interface:
dependency: transitive
description:
name: firebase_auth_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "6.11.7"
version: "6.11.6"
firebase_auth_web:
dependency: transitive
description:
name: firebase_auth_web
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.4"
version: "5.2.3"
firebase_core:
dependency: "direct main"
description:
......@@ -188,13 +146,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_color_models:
dependency: "direct main"
description:
name: flutter_color_models
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.3+2"
flutter_custom_clippers:
dependency: "direct main"
description:
......@@ -202,13 +153,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
flutter_dotenv:
dependency: "direct main"
description:
name: flutter_dotenv
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.2"
flutter_lints:
dependency: "direct dev"
description:
......@@ -216,13 +160,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
flutter_test:
dependency: "direct dev"
description: flutter
......@@ -233,6 +170,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.3"
google_nav_bar:
dependency: "direct main"
description:
......@@ -241,7 +185,7 @@ packages:
source: hosted
version: "5.0.6"
http:
dependency: "direct main"
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
......@@ -254,41 +198,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.2"
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.6"
image_picker_android:
dependency: transitive
description:
name: image_picker_android
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+4"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.10"
image_picker_ios:
dependency: transitive
description:
name: image_picker_ios
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.6+4"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.2"
intl:
dependency: transitive
description:
......@@ -303,34 +212,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.7.0"
just_audio:
dependency: "direct main"
description:
name: just_audio
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.31"
just_audio_platform_interface:
dependency: transitive
description:
name: just_audio_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.0"
just_audio_web:
dependency: transitive
description:
name: just_audio_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.7"
lints:
dependency: transitive
description:
......@@ -338,13 +219,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
logger:
dependency: transitive
description:
name: logger
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
matcher:
dependency: transitive
description:
......@@ -366,13 +240,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
num_utilities:
dependency: transitive
description:
name: num_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
page_transition:
dependency: "direct main"
description:
......@@ -380,13 +247,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
palette_generator:
dependency: "direct main"
description:
name: palette_generator
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3+2"
path:
dependency: transitive
description:
......@@ -400,7 +260,7 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.12"
path_provider_android:
dependency: transitive
description:
......@@ -408,13 +268,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.22"
path_provider_ios:
path_provider_foundation:
dependency: transitive
description:
name: path_provider_ios
name: path_provider_foundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.1.1"
path_provider_linux:
dependency: transitive
description:
......@@ -422,13 +282,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.7"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
path_provider_platform_interface:
dependency: transitive
description:
......@@ -457,13 +310,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
powers:
dependency: transitive
description:
name: powers
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0+2"
process:
dependency: transitive
description:
......@@ -471,13 +317,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
rxdart:
dependency: transitive
description:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.27.7"
sky_engine:
dependency: transitive
description: flutter
......@@ -490,13 +329,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
spotify_sdk:
dependency: "direct main"
description:
name: spotify_sdk
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
stack_trace:
dependency: transitive
description:
......@@ -518,13 +350,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+3"
term_glyph:
dependency: transitive
description:
......@@ -546,13 +371,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
uuid:
dependency: transitive
description:
name: uuid
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.7"
vector_math:
dependency: transitive
description:
......@@ -573,7 +391,7 @@ packages:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+2"
version: "0.2.0+3"
sdks:
dart: ">=2.18.5 <3.0.0"
flutter: ">=3.0.0"
......@@ -51,6 +51,7 @@ dependencies:
flutter_dotenv: ^5.0.2
drop_shadow_image: ^0.9.1
flutter_color_models: ^1.3.3+2
google_fonts: ^2.1.0
dev_dependencies:
flutter_test:
......@@ -81,6 +82,8 @@ flutter:
- assets/ambientR.jpeg
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
- ambientL.jpeg
- ambientR.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment