diff --git a/lib/classification/classification.dart b/lib/classification/classification.dart index 45931993822e29c164c9cb13dbf89fa277c98fe0..dd2a8091a247cc5b510b8bb82553b2268869106c 100644 --- a/lib/classification/classification.dart +++ b/lib/classification/classification.dart @@ -11,7 +11,7 @@ import 'package:google_fonts/google_fonts.dart'; Klasse & Screen zur Klassifizierung der Farben zu den Genres. Es gibt eine graue Default Seite wenn keine Farbe ausgewählt ist. Wenn eine Farbe ausgewählt wird, kann man das Genre dazu auswählen. -Die Klassifiezierung wird dann in der Datenbank aktualisiert +Die Klassifizierung wird dann in der Datenbank aktualisiert */ class ClassificationPage extends StatefulWidget { @@ -86,7 +86,10 @@ class _ClassificationPageState extends State<ClassificationPage> { child: ListView( children: <Widget>[ GestureDetector( - onTap: (){ + onTap: () async { + String genre = await changeFirebase().getGenreByHex('FF0000'); + print('Get genre by hex ' + genre); + if(!_redSelected){closeAll(); setState(() => _redSelected = true); } else{closeAll();} _ambientBackgroundColor = Colors.red; @@ -460,4 +463,5 @@ class _ClassificationPageState extends State<ClassificationPage> { }); _ambientBackgroundColor = Colors.grey.withOpacity(0.5); } + } diff --git a/lib/firebase.dart b/lib/firebase.dart index 972040d1186848d1b0dd14511897afbddffdad17..68cabf5593204abf42fbdacdf51dd3a9f63f121b 100644 --- a/lib/firebase.dart +++ b/lib/firebase.dart @@ -36,12 +36,12 @@ class changeFirebase{ return true; } - String getGenreByHex(String code){ + Future<String> getGenreByHex(String code) async { switch (code){ case 'FF0000': - return getGenreByColor('Red'); + return await getGenreByColor('Red'); case 'FFA500': - return getGenreByColor('Orange'); + return await getGenreByColor('Orange'); case 'FFFF00': return getGenreByColor('Yellow'); case '00FF00': @@ -59,17 +59,17 @@ class changeFirebase{ 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(); - }); - return genre; + 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 diff --git a/lib/loginRegister/login.dart b/lib/loginRegister/login.dart index 01e27dd772b94762616c1e94f788eaabab8f3874..0180d302699a1605a281142b61ca45138052e5fb 100644 --- a/lib/loginRegister/login.dart +++ b/lib/loginRegister/login.dart @@ -5,6 +5,7 @@ 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'; @@ -51,10 +52,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( diff --git a/lib/loginRegister/registration.dart b/lib/loginRegister/registration.dart index 13573abd0d9766b43f0d4a922a514ed0ab043c99..64c6da1ab6867b0dbbdae61d9193274203c2ba66 100644 --- a/lib/loginRegister/registration.dart +++ b/lib/loginRegister/registration.dart @@ -6,6 +6,7 @@ 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 @@ -47,16 +48,17 @@ class _RegistrationPage extends State<RegistrationPage> { 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: 50.0, color: Colors.white), + style: GoogleFonts.cabin( + fontSize: 50.0, color: Colors.white,) ),), Expanded(