Compare commits

..

11 Commits

Author SHA1 Message Date
Dorian HODIN 2d20012fc3 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
Marc CHEVALDONNE 5d51df9ca9 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
dorian.hodin dfb73d42ff Try to push to deploy containers
2 years ago
Dorian HODIN 41d1e8dbb3 Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN ab1c306f5b Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN da7fb93d90 Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build was killed Details
2 years ago
Dorian HODIN 56e5cd28a4 Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build was killed Details
2 years ago
Dorian HODIN 24771535f9 Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build was killed Details
2 years ago
Dorian HODIN 52ec509b3d Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build was killed Details
2 years ago
Audric SABATIER a063418d88 Mise à jour de 'Sources/db_script/sql/create.sql'
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER f3c678c23f Mise à jour de 'Sources/db_script/sql/create.sql'
continuous-integration/drone/push Build is passing Details
2 years ago

@ -52,8 +52,6 @@ steps:
CONTAINERNAME: apiredirect CONTAINERNAME: apiredirect
COMMAND: create COMMAND: create
OVERWRITE: true OVERWRITE: true
ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal
depends_on: [ web-server ] depends_on: [ web-server ]
# docker image build # docker image build
@ -69,8 +67,7 @@ steps:
password: password:
from_secret: SECRET_PASSWD from_secret: SECRET_PASSWD
# container deployment
# container deployment
- name: deploy-php - name: deploy-php
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment: environment:
@ -88,7 +85,6 @@ steps:
from_secret: db_password from_secret: db_password
CODEFIRST_CLIENTDRONE_ENV_ROOT_PASSWORD: CODEFIRST_CLIENTDRONE_ENV_ROOT_PASSWORD:
from_secret: db_root_password from_secret: db_root_password
ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal
depends_on: [ php_script ] depends_on: [ php_script ]
# database container deployment # database container deployment
@ -96,10 +92,10 @@ steps:
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment: environment:
IMAGENAME: mariadb:10.5 IMAGENAME: mariadb:10.5
CONTAINERNAME: db_location CONTAINERNAME: mysql_location
COMMAND: create COMMAND: create
OVERWRITE: true # OVERWRITE: true
# PRIVATE: true PRIVATE: true
CODEFIRST_CLIENTDRONE_ENV_MARIADB_ROOT_PASSWORD: CODEFIRST_CLIENTDRONE_ENV_MARIADB_ROOT_PASSWORD:
from_secret: db_root_password from_secret: db_root_password
CODEFIRST_CLIENTDRONE_ENV_MARIADB_DATABASE: CODEFIRST_CLIENTDRONE_ENV_MARIADB_DATABASE:
@ -108,5 +104,5 @@ steps:
from_secret: db_user from_secret: db_user
CODEFIRST_CLIENTDRONE_ENV_MARIADB_PASSWORD: CODEFIRST_CLIENTDRONE_ENV_MARIADB_PASSWORD:
from_secret: db_password from_secret: db_password
ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal
depends_on: [ deploy-php ] depends_on: [ deploy-php ]

@ -1,6 +1,5 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
<JetCodeStyleSettings> <JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings> </JetCodeStyleSettings>

@ -56,3 +56,6 @@ tous les utilisateurs.
révéler quelques informations personnelles (nom, âge, sexe). révéler quelques informations personnelles (nom, âge, sexe).
Le but est qu'une mise en contact entre 2 personnes se base uniquement Le but est qu'une mise en contact entre 2 personnes se base uniquement
sur des critères musicaux et non personnels. sur des critères musicaux et non personnels.
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Licence Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />Ce(tte) œuvre est mise à disposition selon les termes de la <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Licence Creative Commons Attribution - Pas d&#39;Utilisation Commerciale - Pas de Modification 4.0 International</a>.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

@ -1,4 +1,4 @@
avnadmin postgres
AVNS_MA4OWhqM3cOMSwKXlzw mdpDaflBd
pg-206a2fcd-the-3c42.aivencloud.com 89.83.54.48
Bd-DaflMusic BD-DaflMusic

@ -10,46 +10,23 @@ import '../services/api/api_spotify.dart';
import '../services/database/database_service.dart'; import '../services/database/database_service.dart';
import '../services/position/location.dart'; import '../services/position/location.dart';
import 'live_datas.dart'; import 'live_datas.dart';
import 'package:dafl_project_flutter/model/message.dart';
import 'package:dafl_project_flutter/services/messaging/message_database_service.dart';
import 'dart:developer' as dev;
class Controller { class Controller {
final ApiSpotify _api = ApiSpotify(); final ApiSpotify _api = ApiSpotify();
late User _currentUser; late User _currentUser;
final DataBaseService _dataBaseService = DataBaseService(); final DataBaseService _dataBaseService = DataBaseService();
final LiveData _data = LiveData(); final LiveData _data = LiveData();
final MessageDatabaseService _messageAccess = MessageDatabaseService();
late BuildContext navigatorKey; late BuildContext navigatorKey;
/// FIREBASE Messaging
void sendMessage(Message message, String idSender, String idReceiver) {
_messageAccess.sendMessage(message, idSender, idReceiver);
}
Stream<List<Message>> getMessage(String idSender, String idReceiver) {
return _messageAccess.getMessage(idSender, idReceiver);
}
void addUserConversation(String idSender, String idReceiver){
_messageAccess.addMessagingUser(idSender, idReceiver);
}
initUser() async { initUser() async {
await setCurrentMusic(); await setCurrentMusic();
await setDiscoveries(); await setDiscoveries();
} }
beginRoutine() { beginRoutine() async {
Timer.periodic(const Duration(seconds: 20), (Timer t) => setSpots()); await setSpots();
Timer.periodic(const Duration(seconds: 10), (Timer t) => setSpots());
} }
// //
@ -71,23 +48,14 @@ class Controller {
await getCompleteMusic(await _api.requests.getCurrentlyPlayingTrack()); await getCompleteMusic(await _api.requests.getCurrentlyPlayingTrack());
} }
List<Spot> getSpots() { List<Spot> getSpots() => _data.spots;
return _data.spots;
}
setSpots() async { setSpots() async {
print('setspot');
_data.spots = await Location.sendCurrentLocation(); _data.spots = await Location.sendCurrentLocation();
} }
LinkedHashMap<Music, DateTime> getDiscoveries() => _data.discoveries; LinkedHashMap<Music, DateTime> getDiscoveries() => _data.discoveries;
void deleteDiscoveries(Music key) {
_data.discoveries.remove(key);
removeFromPlaylist(key.id);
}
setDiscoveries() async { setDiscoveries() async {
LinkedHashMap<String, DateTime> tmpData = LinkedHashMap<String, DateTime> tmpData =
await _api.requests.getPlaylistTracks(); await _api.requests.getPlaylistTracks();
@ -125,10 +93,8 @@ class Controller {
_api.requests.removeFromPlaylist(id); _api.requests.removeFromPlaylist(id);
} }
addToPlaylist(String id) async { addToPlaylist(String id) {
_api.requests.addToPlaylist(id); _api.requests.addToPlaylist(id);
Music music = await getCompleteMusic(id);
_data.discoveries.addAll({music: DateTime.now()});
} }
playTrack(String id) { playTrack(String id) {
@ -147,7 +113,6 @@ class Controller {
return false; return false;
} }
_currentUser = newUser; _currentUser = newUser;
_currentUser.idSpotify = await _api.requests.getIdUser();
return true; return true;
} }

@ -6,6 +6,6 @@ import '../model/spot.dart';
class LiveData { class LiveData {
bool discoveriesSortChoice = true; bool discoveriesSortChoice = true;
late LinkedHashMap<Music, DateTime> discoveries; late LinkedHashMap<Music, DateTime> discoveries;
List<Spot> spots = <Spot>[]; late List<Spot> spots;
late Music userCurrentMusic; late Music userCurrentMusic;
} }

@ -1,69 +0,0 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
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) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
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 android = FirebaseOptions(
apiKey: 'AIzaSyBODcBh2wlcYBc0QCQKLKXA46uE64veSvA',
appId: '1:743783838712:android:34e4356470b8125ee51c0d',
messagingSenderId: '743783838712',
projectId: 'daflmusic-b36d2',
storageBucket: 'daflmusic-b36d2.appspot.com',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyD2E7KNx6BNyn6U7FqDq65m-i66WXVyjYA',
appId: '1:743783838712:ios:d69f49090eb60fb9e51c0d',
messagingSenderId: '743783838712',
projectId: 'daflmusic-b36d2',
storageBucket: 'daflmusic-b36d2.appspot.com',
iosClientId: '743783838712-eqfakrghgk4grboprkebadoqe09k0002.apps.googleusercontent.com',
iosBundleId: 'com.example.daflProjectFlutter',
);
}

@ -8,19 +8,12 @@ import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rive/rive.dart' as riv; import 'package:rive/rive.dart' as riv;
import '../controller/controller.dart'; import '../controller/controller.dart';
import 'model/message.dart';
import 'model/spot.dart'; import 'model/spot.dart';
import 'dart:developer' as dev; import 'dart:developer' as dev;
import 'package:flutter_styled_toast/flutter_styled_toast.dart'; import 'package:flutter_styled_toast/flutter_styled_toast.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
void main() async{ void main() {
runApp(const MyApp()); runApp(const MyApp());
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
@ -228,7 +221,7 @@ class CardProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
} }
final messageTextField = TextEditingController();
void message(context) { void message(context) {
dev.log("message"); dev.log("message");
_angle = 0; _angle = 0;
@ -250,6 +243,7 @@ class CardProvider extends ChangeNotifier {
} }
Widget buildSheet(context) { Widget buildSheet(context) {
final messageTextField = TextEditingController();
return SingleChildScrollView( return SingleChildScrollView(
padding: padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
@ -302,28 +296,26 @@ class CardProvider extends ChangeNotifier {
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Form( child: TextField(
child: TextField( keyboardAppearance: Brightness.dark,
keyboardAppearance: Brightness.dark, controller: messageTextField,
controller: messageTextField, maxLength: 300,
maxLength: 300, style: TextStyle(
style: TextStyle( fontFamily: 'DMSans',
fontFamily: 'DMSans', color: Colors.white.withOpacity(1),
color: Colors.white.withOpacity(1), fontSize: 17,
fontSize: 17, fontWeight: FontWeight.w200),
fontWeight: FontWeight.w200), expands: true,
expands: true, maxLines: null,
maxLines: null, textInputAction: TextInputAction.send,
decoration: const InputDecoration( decoration: const InputDecoration(
hintStyle: TextStyle( hintStyle: TextStyle(
color: Colors.white, color: Colors.white,
),
border: InputBorder.none,
hintText: "Mon message",
), ),
border: InputBorder.none,
hintText: "Mon message",
), ),
) ),
), ),
), ),
const SizedBox( const SizedBox(
@ -365,14 +357,8 @@ class CardProvider extends ChangeNotifier {
); );
} }
void sendMessage(String content, String idReceiver) { void sendMessage(String message, String userId) {
Message message = Message(idSender: MyApp.controller.getIdDafl(), idReceiver: idReceiver, dev.log(MyApp.controller.getSpots().last.userId);
content: content, timestamp: DateTime.now().toString());
MyApp.controller.sendMessage(message, MyApp.controller.getIdDafl(),
idReceiver);
MyApp.controller.addUserConversation(MyApp.controller.getIdDafl(), idReceiver);
} }
void like(context) { void like(context) {
@ -637,5 +623,3 @@ Object notify(int index, context, {bool isError = true}) {
))); )));
} }
} }

@ -1,35 +1,8 @@
import 'user.dart'; import 'user.dart';
class Message { class Message {
String idSender; String senderId;
String idReceiver;
String content; String content;
String timestamp;
Message(this.senderId, this.content);
Message({required this.idSender,
required this.idReceiver,
required this.content,
required this.timestamp
});
Map<String, dynamic> toHashMap() {
return {
'idSender': idSender,
'idReceiver': idReceiver,
'content': content,
'timestamp' : timestamp
};
}
factory Message.fromMap(Map<String, dynamic> data){
return Message(
idSender: data['idSender'],
idReceiver: data['idReceiver'],
content: data['content'],
timestamp: data['timestamp']
);
}
} }

@ -39,7 +39,7 @@ class DatabaseConnexion {
try { try {
var uri = var uri =
'postgres://$_psqlUser:$_psqlPswd@$_psqlHost:15739/$_psqlDataBase?sslmode=require'; 'postgres://$_psqlUser:$_psqlPswd@$_psqlHost:5442/$_psqlDataBase';
return connect(uri); return connect(uri);
} catch (e) { } catch (e) {

@ -11,7 +11,7 @@ class DatabaseLoader implements Loader {
final connection = await DatabaseConnexion.initConnexion(); final connection = await DatabaseConnexion.initConnexion();
var queryResult = await connection var queryResult = await connection
.query( .query(
'select idDafl from users where idDafl = @username AND password = @password', 'select username from utilisateur where username = @username AND password = @password',
{'username': username, 'password': password}) {'username': username, 'password': password})
.toList() .toList()
.then((result) { .then((result) {
@ -25,6 +25,7 @@ class DatabaseLoader implements Loader {
.whenComplete(() { .whenComplete(() {
connection.close(); connection.close();
}); });
return queryResult; return queryResult;
} }
} }

@ -8,10 +8,9 @@ class DatabaseSaver implements Saver {
final connection = await DatabaseConnexion.initConnexion(); final connection = await DatabaseConnexion.initConnexion();
connection.execute( connection.execute(
'insert into users (idDafl, idSpotify, password) values (@username, 0, @password)', 'insert into utilisateur (username, password) values (@username, @password)',
{'id': '', 'username': idDafl, 'password': passw}).whenComplete(() { {'id': '', 'username': idDafl, 'password': passw}).whenComplete(() {
connection.close(); connection.close();
}); });
print('save');
} }
} }

@ -10,7 +10,7 @@ class DatabaseSearcher implements Searcher {
final connection = await DatabaseConnexion.initConnexion(); final connection = await DatabaseConnexion.initConnexion();
bool queryResult = await connection bool queryResult = await connection
.query('select * from users where idDafl = @username', .query('select * from utilisateur where username = @username',
{'username': username}) {'username': username})
.toList() .toList()
.then((rows) { .then((rows) {

@ -1,80 +0,0 @@
import 'package:dafl_project_flutter/model/message.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class MessageDatabaseService{
// Make an unique chat ID between 2 client. Look like 'User1-User2'
String _getChatId(String idSender, String idReceiver) {
// Test to always have the same id
if (idSender.hashCode <= idReceiver.hashCode)
return '$idSender-${idReceiver}';
else
return '${idReceiver}-$idSender';
}
// Send a message from an user to an other
void sendMessage(Message message, String idSender, String idReceiver) {
String chatId = _getChatId(idSender, idReceiver);
// Get a message from a snapshot Firestore
var documentReference = FirebaseFirestore.instance
.collection('messages')
.doc(chatId)
.collection(chatId)
.doc(DateTime
.now()
.millisecondsSinceEpoch
.toString());
FirebaseFirestore.instance.runTransaction((transaction) async {
transaction.set(documentReference, message.toHashMap());
});
}
Message _getMessage(DocumentSnapshot<Map<String, dynamic>> snapshot) {
var data = snapshot.data();
if (data == null)
throw Exception("no data in database");
return Message.fromMap(data);
}
// Get a list of messages from Firestore
List<Message> _getAllMessages(QuerySnapshot<Map<String, dynamic>> snapshot) {
return snapshot.docs.map((doc) {
return _getMessage(doc);
}).toList();
}
// Get the massages from Firestore
Stream<List<Message>> getMessage(String idSender, String idReceiver) {
String chatId = _getChatId(idSender, idReceiver);
return FirebaseFirestore.instance
.collection('messages')
.doc(chatId)
.collection(chatId)
.orderBy('timestamp', descending: true)
.snapshots().map(_getAllMessages);
}
void addMessagingUser(String idSender, String idReceiver) {
// Get a message from a snapshot Firestore
var documentReference = FirebaseFirestore.instance
.collection('users')
.doc(idSender)
.collection(idSender)
.doc(DateTime
.now()
.millisecondsSinceEpoch
.toString());
Map<String, dynamic> receiver = { 'user' : idReceiver };
FirebaseFirestore.instance.runTransaction((transaction) async {
transaction.set(documentReference, receiver);
});
}
}

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:dafl_project_flutter/model/spot.dart'; import 'package:dafl_project_flutter/model/spot.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -10,7 +8,7 @@ import '../../main.dart';
class Location { class Location {
static Future<List<Spot>> sendCurrentLocation() async { static Future<List<Spot>> sendCurrentLocation() async {
Uri uri = Uri.parse( Uri uri = Uri.parse(
"https://codefirst.iut.uca.fr/containers/DAFLDev-php_script/insertAndMakeListUser.php"); "https://codefirst.iut.uca.fr/containers/php_script-dorianhodin/insertAndMakeListUser.php");
LocationPermission permission = await Geolocator.checkPermission(); LocationPermission permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) { if (permission == LocationPermission.denied) {
@ -31,7 +29,7 @@ class Location {
"longitude": current.longitude.toString(), "longitude": current.longitude.toString(),
"idMusic": actualSong, "idMusic": actualSong,
}); });
log("echo");
var data = jsonDecode(response.body); var data = jsonDecode(response.body);
Map<String, String> spotsData = {}; Map<String, String> spotsData = {};
List<Spot> spots = []; List<Spot> spots = [];

@ -5,36 +5,28 @@ import 'package:dafl_project_flutter/model/message.dart';
import 'dart:developer' as dev; import 'dart:developer' as dev;
class ConversationPage extends StatefulWidget { class ConversationPage extends StatefulWidget {
String sender; const ConversationPage({Key? key}) : super(key: key);
ConversationPage({Key? key, required String this.sender}) : super(key: key);
@override @override
State<ConversationPage> createState() => _ConversationPageState(sender); State<ConversationPage> createState() => _ConversationPageState();
} }
class _ConversationPageState extends State<ConversationPage> { class _ConversationPageState extends State<ConversationPage> {
String destinataire = 'test';
List<Widget> messages = []; List<Widget> messages = [];
bool isNull = true; bool isNull = true;
final String receiver;
_ConversationPageState(this.receiver);
final messageTextField = TextEditingController(); final messageTextField = TextEditingController();
void sendMessage(String content, String idSender, String idReceiver) { void sendMessage(String content) {
Message messageToSend = Message(idSender: idSender, idReceiver: idReceiver, content: content, timestamp: DateTime.now().toString());
MyApp.controller.sendMessage(messageToSend, idSender, idReceiver);
setState(() { setState(() {
messages.add(messageWidget(messageToSend)); messages.add(messageWidget(
Message(MyApp.controller.getIdDafl().toString(), content)));
}); });
} }
Widget messageWidget(Message message) { Widget messageWidget(Message message) {
if (message.idSender != MyApp.controller.getIdDafl()) { if (message.senderId != MyApp.controller.getIdDafl().toString()) {
return Align( return Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Container( child: Container(
@ -124,8 +116,7 @@ class _ConversationPageState extends State<ConversationPage> {
ScrollController listScrollController = ScrollController(); ScrollController listScrollController = ScrollController();
return Scaffold( return Scaffold(
extendBodyBehindAppBar: false, extendBodyBehindAppBar: true,
extendBody: false,
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: AppBar( appBar: AppBar(
elevation: 20, elevation: 20,
@ -139,14 +130,13 @@ class _ConversationPageState extends State<ConversationPage> {
width: 40, width: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
color: Colors.blue,
), ),
child: Image.asset('assets/images/DaflUser_profil.png'),
), ),
const SizedBox( const SizedBox(
width: 20, width: 20,
), ),
Text(receiver), const Text("Max"),
const Spacer(), const Spacer(),
IconButton( IconButton(
splashColor: Colors.grey.withOpacity(0.2), splashColor: Colors.grey.withOpacity(0.2),
@ -175,34 +165,18 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
physics: const ScrollPhysics(), child: Container(
child: Container( color: const Color(0xFF141414),
color: const Color(0xFF141414), height: height * 0.92,
height: height * 0.85, width: double.infinity,
width: double.infinity, child: ListView.builder(
child: Flexible( controller: listScrollController,
child: StreamBuilder<List<Message>>( physics: const BouncingScrollPhysics(),
stream: MyApp.controller.getMessage(MyApp.controller.getIdDafl(), receiver), itemCount: messages.length,
builder: (BuildContext context, itemBuilder: (context, index) {
AsyncSnapshot<List<Message>> snapshot) { return messages[index];
if (snapshot.hasData) { })),
List<Message> listMessage = ),
snapshot.data ?? List.from([]);
return ListView.builder(
padding: EdgeInsets.all(10.0),
itemCount: listMessage.length,
itemBuilder: (context, index) =>
messageWidget(listMessage[index]),
reverse: true,
controller: listScrollController,
);
} else {
return Center(child: Container());
}
},
),
))),
bottomSheet: BottomAppBar( bottomSheet: BottomAppBar(
color: const Color(0xFF141414), color: const Color(0xFF141414),
child: Row( child: Row(
@ -212,7 +186,7 @@ class _ConversationPageState extends State<ConversationPage> {
Container( Container(
height: height * 0.08, height: height * 0.08,
color: Colors.transparent, color: Colors.transparent,
width: width * 0.8, width: width * 0.9,
child: Container( child: Container(
margin: const EdgeInsets.fromLTRB(10, 10, 10, 10), margin: const EdgeInsets.fromLTRB(10, 10, 10, 10),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -230,7 +204,7 @@ class _ConversationPageState extends State<ConversationPage> {
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: hintStyle:
TextStyle(color: Colors.white.withOpacity(0.7)), TextStyle(color: Colors.white.withOpacity(0.7)),
border: InputBorder.none, border: InputBorder.none,
hintText: "Votre message...", hintText: "Votre message...",
), ),
@ -244,53 +218,50 @@ class _ConversationPageState extends State<ConversationPage> {
onTap: isNull onTap: isNull
? null ? null
: () { : () {
sendMessage( sendMessage(messageTextField.text);
messageTextField.text, if (listScrollController.hasClients) {
MyApp.controller.getIdDafl(), final position =
receiver); listScrollController.position.maxScrollExtent;
if (listScrollController.hasClients) { listScrollController.jumpTo(position);
final position = }
listScrollController.position.minScrollExtent; messageTextField.clear();
listScrollController.jumpTo(position); },
}
messageTextField.clear();
},
child: isNull == true child: isNull == true
? const SizedBox( ? const SizedBox(
height: 1, height: 1,
width: 1, width: 1,
) )
: Container( : Container(
width: 40, width: 40,
height: 40, height: 40,
margin: const EdgeInsets.fromLTRB(0, 0, 0, 0), margin: const EdgeInsets.fromLTRB(0, 0, 0, 0),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
gradient: const LinearGradient( gradient: const LinearGradient(
colors: [Color(0xff8e24a1), Color(0xff8163ff)], colors: [Color(0xff8e24a1), Color(0xff8163ff)],
begin: Alignment.topLeft, begin: Alignment.topLeft,
end: Alignment.bottomRight, end: Alignment.bottomRight,
)),
child: Transform.rotate(
angle: -300,
child: const Icon(
Icons.arrow_back,
size: 26,
color: Colors.white,
),
)), )),
child: Transform.rotate(
angle: -300,
child: const Icon(
Icons.arrow_back,
size: 26,
color: Colors.white,
),
)),
) )
], ],
), ),
), ),
); );
} }
final messageReportTextField = TextEditingController();
Widget buildSheet() {
Widget buildSheet() {
final messageTextField = TextEditingController();
return SingleChildScrollView( return SingleChildScrollView(
padding: padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container( child: Container(
height: 500, height: 500,
width: double.infinity, width: double.infinity,
@ -374,7 +345,7 @@ class _ConversationPageState extends State<ConversationPage> {
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
child: TextField( child: TextField(
controller: messageReportTextField, controller: messageTextField,
keyboardAppearance: Brightness.dark, keyboardAppearance: Brightness.dark,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
@ -405,9 +376,9 @@ class _ConversationPageState extends State<ConversationPage> {
onPressed: () { onPressed: () {
MyApp.controller.sendEmail( MyApp.controller.sendEmail(
MyApp.controller.getIdDafl().toString(), MyApp.controller.getIdDafl().toString(),
receiver, destinataire,
currentValue, currentValue,
messageReportTextField.text); messageTextField.text);
Navigator.pop(context); Navigator.pop(context);
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../presentation/custom_icons_icons.dart'; import '../../presentation/custom_icons_icons.dart';
import './w_settings.dart'; import './w_settings.dart';
@ -37,7 +36,6 @@ class _MainPageState extends State<MainPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIMode (SystemUiMode.immersive);
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
@ -50,8 +48,8 @@ class _MainPageState extends State<MainPage> {
), ),
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints( constraints: const BoxConstraints(
minHeight: 80, minHeight: 100,
maxHeight: 80, maxHeight: 100,
), ),
child: NavigationBar( child: NavigationBar(
animationDuration: const Duration(microseconds: 800), animationDuration: const Duration(microseconds: 800),

@ -1,7 +1,7 @@
import 'dart:collection'; import 'dart:collection';
import 'package:dafl_project_flutter/main.dart'; import 'package:dafl_project_flutter/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart';
import 'dart:developer' as dev; import 'dart:developer' as dev;
import '../../../model/music.dart'; import '../../../model/music.dart';
@ -14,13 +14,6 @@ class DiscoveryWidget extends StatefulWidget {
} }
class _DiscoveryWidgetState extends State<DiscoveryWidget> { class _DiscoveryWidgetState extends State<DiscoveryWidget> {
@override
initState() {
MyApp.controller.getDiscoveries();
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -120,13 +113,12 @@ class _DiscoveryListState extends State<DiscoveryList> {
} }
refreshList() async { refreshList() async {
await Future.delayed(const Duration(seconds: 3)); await Future.delayed(const Duration(seconds: 1));
setState(() {}); setState(() {});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
late LinkedHashMap<Music, DateTime> listDiscoveries; late LinkedHashMap<Music, DateTime> listDiscoveries;
if (MyApp.controller.getChoice()) { if (MyApp.controller.getChoice()) {
//TODO : implement sort by date //TODO : implement sort by date
@ -163,8 +155,9 @@ class _DiscoveryListState extends State<DiscoveryList> {
dev.log(listDiscoveries.keys.toList()[reversedIndex].id); dev.log(listDiscoveries.keys.toList()[reversedIndex].id);
dev.log( dev.log(
listDiscoveries.keys.toList()[reversedIndex].name); listDiscoveries.keys.toList()[reversedIndex].name);
MyApp.controller.deleteDiscoveries( MyApp.controller.removeFromPlaylist(
listDiscoveries.keys.toList()[reversedIndex]); listDiscoveries.keys.toList()[reversedIndex].id);
listDiscoveries = MyApp.controller.getDiscoveries();
return true; return true;
} }
if (direction == DismissDirection.startToEnd) { if (direction == DismissDirection.startToEnd) {
@ -225,51 +218,19 @@ class _DiscoveryListState extends State<DiscoveryList> {
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
children: [ children: [
MyApp.controller Text(
.getDiscoveries() MyApp.controller
.keys .getDiscoveries()
.toList()[reversedIndex] .keys
.name .toList()[reversedIndex]
.length > .name,
22 style: TextStyle(
? SizedBox( fontFamily: 'DMSans',
width: width * 0.60, color:
child: ScrollLoopAutoScroll( Colors.white.withOpacity(1),
delayAfterScrollInput: fontSize: 20,
Duration(seconds: 1), fontWeight: FontWeight.w800),
delay: Duration(seconds: 1), ),
child: Text(
MyApp.controller
.getDiscoveries()
.keys
.toList()[reversedIndex]
.name,
style: TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight:
FontWeight.bold),
),
duration:
Duration(seconds: 100),
scrollDirection:
Axis.horizontal,
),
)
: Text(
MyApp.controller
.getDiscoveries()
.keys
.toList()[reversedIndex]
.name,
style: TextStyle(
fontFamily: 'DMSans',
color: Colors.white
.withOpacity(1),
fontSize: 20,
fontWeight:
FontWeight.w800),
),
Text( Text(
MyApp.controller MyApp.controller
.getDiscoveries() .getDiscoveries()

@ -1,5 +1,3 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:dafl_project_flutter/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart'; import 'package:page_transition/page_transition.dart';
@ -67,7 +65,7 @@ class _MessagesWidgetState extends State<MessagesWidget> {
color: Colors.grey.withOpacity(0.4), fontSize: 15), color: Colors.grey.withOpacity(0.4), fontSize: 15),
), ),
Padding( Padding(
padding: EdgeInsets.fromLTRB(0, height * 0.01, 0, height * 0.01), padding: EdgeInsets.fromLTRB(0, height * 0.01, 0, 0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
@ -133,10 +131,7 @@ class _MessagesWidgetState extends State<MessagesWidget> {
} }
class MessagesButtonWidget extends StatelessWidget { class MessagesButtonWidget extends StatelessWidget {
final String sender; const MessagesButtonWidget({super.key});
const MessagesButtonWidget({super.key, required this.sender});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -155,7 +150,8 @@ class MessagesButtonWidget extends StatelessWidget {
width: 60, width: 60,
decoration: BoxDecoration( decoration: BoxDecoration(
image: const DecorationImage( image: const DecorationImage(
image: AssetImage('assets/images/DaflUser_profil.png'), image: NetworkImage(
'https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
border: Border.all( border: Border.all(
@ -175,7 +171,7 @@ class MessagesButtonWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
sender, 'Max',
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
color: Colors.white.withOpacity(1), color: Colors.white.withOpacity(1),
@ -211,48 +207,17 @@ class MessagesButtonWidget extends StatelessWidget {
} }
} }
class ListConfirmedWidget extends StatelessWidget { class ListConfirmedWidget extends StatelessWidget {
const ListConfirmedWidget({super.key}); const ListConfirmedWidget({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView(children: const [
return StreamBuilder<QuerySnapshot<Map<String, dynamic>>>( MessagesButtonWidget(),
stream: FirebaseFirestore.instance MessagesButtonWidget(),
.collection('users') MessagesButtonWidget(),
.doc(MyApp.controller.getIdDafl()) MessagesButtonWidget(),
.collection(MyApp.controller.getIdDafl()) ]);
.snapshots(),
builder: (_, snapshot) {
if (snapshot.hasError) return Text('Error = ${snapshot.error}');
if (snapshot.hasData) {
final docs = snapshot.data!.docs;
return ListView.builder(
itemCount: docs.length,
itemBuilder: (context, i) {
final data = docs[i].data();
return GestureDetector(
onTap: () {
Navigator.of(context).push(PageTransition(
duration: const Duration(milliseconds: 200),
reverseDuration: const Duration(milliseconds: 200),
type: PageTransitionType.rightToLeftWithFade,
childCurrent: context.widget,
child: ConversationPage(sender : data['user'])));
},
child: MessagesButtonWidget(sender : data['user'])
);
},
);
}
return Center(child: CircularProgressIndicator());
},
);
} }
} }
@ -261,7 +226,6 @@ class ListWaitingWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return ListView(
children: [ children: [
GestureDetector( GestureDetector(
@ -271,13 +235,11 @@ class ListWaitingWidget extends StatelessWidget {
reverseDuration: const Duration(milliseconds: 200), reverseDuration: const Duration(milliseconds: 200),
type: PageTransitionType.rightToLeftWithFade, type: PageTransitionType.rightToLeftWithFade,
childCurrent: context.widget, childCurrent: context.widget,
child: ConversationPage(sender :'test'))); child: const ConversationPage()));
}, },
child: const MessagesButtonWidget(sender : "test6"), child: const MessagesButtonWidget(),
), ),
], ],
); );
} }
} }

@ -1,7 +1,4 @@
import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../../model/music.dart';
import './w_settings.dart'; import './w_settings.dart';
import './w_spot.dart'; import './w_spot.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -33,14 +30,12 @@ class _MainPageProfilState extends State<MainPageProfil> {
@override @override
initState() { initState() {
MyApp.controller.setCurrentMusic();
username = MyApp.controller.getIdDafl(); username = MyApp.controller.getIdDafl();
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
return Container( return Container(
color: const Color(0xFF141414), color: const Color(0xFF141414),
@ -223,231 +218,125 @@ class _MainPageProfilState extends State<MainPageProfil> {
child: riv.RiveAnimation.asset( child: riv.RiveAnimation.asset(
'assets/images/playing_animation.riv'))) 'assets/images/playing_animation.riv')))
]), ]),
FutureBuilder( Container(
future: MyApp.controller.getCompleteMusic( margin: const EdgeInsets.fromLTRB(0, 10, 0, 0),
MyApp.controller.getCurrentMusic().id), height: height * 0.14,
builder: (BuildContext context, decoration: BoxDecoration(
AsyncSnapshot<Music> snapshot) { borderRadius: BorderRadius.circular(15.0),
print(snapshot.connectionState); color: const Color(0xFFD9D9D9).withOpacity(0.08),
if (snapshot.connectionState == ),
ConnectionState.waiting) { child: Row(
return Container( mainAxisAlignment: MainAxisAlignment.start,
margin: crossAxisAlignment: CrossAxisAlignment.center,
const EdgeInsets.fromLTRB(0, 10, 0, 0), children: [
height: height * 0.14, Container(
decoration: BoxDecoration( margin: const EdgeInsets.fromLTRB(
borderRadius: BorderRadius.circular(15.0), 15, 0, 0, 0),
color: const Color(0xFFD9D9D9) child: ClipRRect(
.withOpacity(0.08), borderRadius:
), BorderRadius.circular(15),
child: Row( child: FadeInImage.assetNetwork(
mainAxisAlignment: MainAxisAlignment.start, height: 90,
crossAxisAlignment: width: 90,
CrossAxisAlignment.center, placeholder:
children: [
Container(
margin: const EdgeInsets.fromLTRB(
15, 0, 0, 0),
child: ClipRRect(
borderRadius:
BorderRadius.circular(10),
child: Image.asset(
"assets/images/loadingPlaceholder.gif", "assets/images/loadingPlaceholder.gif",
height: 90, image: MyApp.controller
width: 90))), .getCurrentMusic()
Container( .linkCover))),
margin: const EdgeInsets.fromLTRB( Container(
12, 20, 0, 0), margin: const EdgeInsets.fromLTRB(
child: Column( 12, 20, 0, 0),
child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Container( Text(
width: 150, MyApp.controller
height: 20, .getCurrentMusic()
decoration: BoxDecoration( .name,
borderRadius: style: const TextStyle(
BorderRadius.circular(5.0), fontSize: 18,
color: Colors.grey fontWeight: FontWeight.w500,
.withOpacity(0.7), color: Colors.white),
),
),
SizedBox(
height: 10,
), ),
Container( Text(
width: 100, MyApp.controller
height: 20, .getCurrentMusic()
decoration: BoxDecoration( .artist,
borderRadius: style: const TextStyle(
BorderRadius.circular(5.0), fontSize: 16,
color: Colors.grey fontWeight: FontWeight.w400,
.withOpacity(0.4), color: Colors.grey))
), ])),
), const Spacer(),
], Container(
), height: 55,
) width: double.infinity,
],
),
);
} else if (snapshot.connectionState ==
ConnectionState.done) {
if (snapshot.hasError) {
return const Text('Error');
} else if (snapshot.hasData) {
return Container(
margin: const EdgeInsets.fromLTRB(
0, 10, 0, 0),
height: height * 0.14,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.circular(15.0), BorderRadius.circular(10.0),
color: const Color(0xFFD9D9D9) color: Colors.transparent,
.withOpacity(0.08),
), ),
child: Row( margin: const EdgeInsets.fromLTRB(
mainAxisAlignment: 30, 0, 30, 0),
MainAxisAlignment.start, child: SizedBox(
crossAxisAlignment: height: 55,
CrossAxisAlignment.center, width: double.infinity,
children: [ child: ElevatedButton(
Container( style: ElevatedButton.styleFrom(
margin: backgroundColor:
const EdgeInsets.fromLTRB( const Color(0xFFD9D9D9)
15, 0, 0, 0), .withOpacity(0.08),
child: ClipRRect( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular( BorderRadius.circular(
15), 10.0),
child: FadeInImage.assetNetwork( ), // background// foreground
height: 90,
width: 90,
placeholder:
"assets/images/loadingPlaceholder.gif",
image: snapshot
.data!.linkCover))),
Container(
margin: const EdgeInsets.fromLTRB(
12, 20, 0, 0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
snapshot.data!.name.length >
22
? SizedBox(
width: width*0.5,
child:
ScrollLoopAutoScroll(
delayAfterScrollInput:
Duration(
seconds: 1),
delay: Duration(
seconds: 1),
child: Text(
snapshot
.data!.name,
style: TextStyle(
fontSize: 20,
color: Colors
.white,
fontWeight:
FontWeight
.bold),
),
duration: Duration(
seconds: 100),
scrollDirection:
Axis.horizontal,
),
)
: Text(
snapshot.data!.name,
style: TextStyle(
fontSize: 20,
color:
Colors.white,
fontWeight:
FontWeight
.bold),
),
Text(
snapshot.data!.artist,
style: const TextStyle(
fontSize: 16,
fontWeight:
FontWeight.w400,
color: Colors.grey),
),
],
), ),
) onPressed: () {
])); Navigator.push(
} else { context,
return const Text('Empty data'); MaterialPageRoute(
} builder: (context) =>
} else { const SettingsWidget()))
return Text( .then(
'State: ${snapshot.connectionState}'); (value) => setState(() {
} username = MyApp
}), .controller
])), .getIdDafl()
const Spacer(), .toString();
Container( }));
height: 55, },
width: double.infinity, child: Row(children: [
decoration: BoxDecoration( const Icon(
borderRadius: BorderRadius.circular(10.0), Icons.settings,
color: Colors.transparent, color: Colors.white,
), size: 30,
margin: const EdgeInsets.fromLTRB(30, 0, 30, 0), ),
child: SizedBox( const SizedBox(
height: 55, width: 12,
width: double.infinity, ),
child: ElevatedButton( const Text(
style: ElevatedButton.styleFrom( "Paramètres",
backgroundColor: style: TextStyle(
const Color(0xFFD9D9D9).withOpacity(0.08), color: Colors.white,
shape: RoundedRectangleBorder( fontSize: 17,
borderRadius: BorderRadius.circular(10.0), fontWeight:
), // background// foreground FontWeight.w400),
), textAlign: TextAlign.center,
onPressed: () { ),
Navigator.push( const Spacer(),
context, Icon(
MaterialPageRoute( Icons.arrow_forward_ios,
builder: (context) => color: Colors.white
const SettingsWidget())); .withOpacity(0.3),
}, )
child: Row(children: [ ])))),
const Icon( const Spacer()
Icons.settings, ]))
color: Colors.white, ]))
size: 30,
),
const SizedBox(
width: 12,
),
const Text(
"Paramètres",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
),
const Spacer(),
Icon(
Icons.arrow_forward_ios,
color: Colors.white.withOpacity(0.3),
)
])))),
const Spacer()
]))); ])));
} }
} }

@ -16,8 +16,6 @@ class SpotsWidget extends StatefulWidget {
} }
class _SpotsWidgetState extends State<SpotsWidget> { class _SpotsWidgetState extends State<SpotsWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
@ -235,8 +233,8 @@ class _SpotsWidgetState extends State<SpotsWidget> {
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: MyApp.controller.getSpots().isEmpty child: MyApp.controller.getSpots().isEmpty
? Container() ? Image.asset("assets/images/play_spotify_button.png")
: Image.asset("assets/images/play_spotify_button.png"), : Container(),
), ),
)) ))
], ],

@ -196,8 +196,26 @@ class _SignUpPageState extends State<SignUpPage> {
padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), padding: const EdgeInsets.fromLTRB(45, 10, 45, 0),
child: Stack( child: Stack(
children: [ children: [
Container(
height: 43,
decoration: BoxDecoration(
color: const Color(0xFF24CF5F),
borderRadius:
const BorderRadius.all(Radius.circular(50)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
spreadRadius: 5,
blurRadius: 7,
offset: const Offset(
0, 3), // changes position of shadow
),
],
),
),
SizedBox( SizedBox(
height: 43, height: 43,
width: width * 0.75,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF24CF5F), backgroundColor: const Color(0xFF24CF5F),
@ -318,16 +336,15 @@ class _SignUpPageState extends State<SignUpPage> {
} else if (!await MyApp.controller.searchUser(username)) { } else if (!await MyApp.controller.searchUser(username)) {
notify(0, context); notify(0, context);
} }
else if (password == "" || confirmPassword == "") { if (password == "" || confirmPassword == "") {
notify(4, context); notify(4, context);
} else if (password.length < 8) { } else if (password.length < 8) {
notify(3, context); notify(3, context);
} else if (password != confirmPassword) { } else if (password != confirmPassword) {
notify(1, context); notify(1, context);
} else { } else {
MyApp.controller.save(username, password);
// create user in database // create user in database
print("success");
Navigator.of(context).push( Navigator.of(context).push(
PageTransition( PageTransition(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
@ -337,5 +354,5 @@ class _SignUpPageState extends State<SignUpPage> {
child: const HomePage()), child: const HomePage()),
); );
} }
}
} }
}

@ -1,13 +1,6 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_flutterfire_internals:
dependency: transitive
description:
name: _flutterfire_internals
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.12"
animations: animations:
dependency: "direct main" dependency: "direct main"
description: description:
@ -78,27 +71,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
cloud_firestore:
dependency: "direct main"
description:
name: cloud_firestore
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.1"
cloud_firestore_platform_interface:
dependency: transitive
description:
name: cloud_firestore_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.10.1"
cloud_firestore_web:
dependency: transitive
description:
name: cloud_firestore_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -162,48 +134,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.4" version: "6.1.4"
firebase_core:
dependency: "direct main"
description:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.2"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
firebase_messaging:
dependency: "direct main"
description:
name: firebase_messaging
url: "https://pub.dartlang.org"
source: hosted
version: "14.2.1"
firebase_messaging_platform_interface:
dependency: transitive
description:
name: firebase_messaging_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.10"
firebase_messaging_web:
dependency: transitive
description:
name: firebase_messaging_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.11"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter

@ -32,9 +32,6 @@ dependencies:
marquee: ^2.2.3 marquee: ^2.2.3
text_scroll: ^0.1.1 text_scroll: ^0.1.1
scroll_loop_auto_scroll: ^0.0.2 scroll_loop_auto_scroll: ^0.0.2
firebase_core: ^2.4.1
firebase_messaging: ^14.1.1
cloud_firestore: ^4.1.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

@ -1,3 +1,9 @@
DROP TABLE IF EXISTS Musique;
DROP TABLE IF EXISTS Matchs;
DROP TABLE IF EXISTS LikeDafl;
DROP TABLE IF EXISTS UserDafl;
CREATE TABLE UserDafl( CREATE TABLE UserDafl(
idDafl INT PRIMARY KEY, idDafl INT PRIMARY KEY,
pseudo varchar(50) NOT NULL, pseudo varchar(50) NOT NULL,
@ -6,7 +12,7 @@ CREATE TABLE UserDafl(
); );
CREATE TABLE Musique( CREATE TABLE Musique(
idUser INT REFERENCES User(idDafl), idUser INT REFERENCES UserDafl(idDafl),
idMusic INT, idMusic INT,
title varchar(50) NOT NULL, title varchar(50) NOT NULL,
artist varchar(50) NOT NULL, artist varchar(50) NOT NULL,
@ -16,29 +22,29 @@ CREATE TABLE Musique(
); );
CREATE TABLE Matchs( CREATE TABLE Matchs(
idUserA INT REFERENCES User(idDafl), idUserA INT REFERENCES UserDafl(idDafl),
idUserB INT REFERENCES User(idDafl), idUserB INT REFERENCES UserDafl(idDafl),
dateMatch date NOT NULL, dateMatch date NOT NULL,
PRIMARY KEY(idUserA,idUserB) PRIMARY KEY(idUserA,idUserB)
); );
CREATE TABLE LikeDafl( CREATE TABLE LikeDafl(
idUserWhoLike INT REFERENCES User(idDafl), idUserWhoLike INT REFERENCES UserDafl(idDafl),
idUserWhoGetLike INT REFERENCES User(idDafl), idUserWhoGetLike INT REFERENCES UserDafl(idDafl),
dateLike date NOT NULL, dateLike date NOT NULL,
PRIMARY KEY(idUserWhoLike,idUserWhoGetLike) PRIMARY KEY(idUserWhoLike,idUserWhoGetLike)
); );
CREATE TABLE MessageDafl( CREATE TABLE MessageDafl(
senderID INT NOT NULL REFERENCES User(idDafl) , senderID INT NOT NULL REFERENCES UserDafl(idDafl) ,
idMessage INT PRIMARY KEY, idMessage INT PRIMARY KEY,
content varchar(500), content varchar(500),
dateMess date NOT NULL dateMess date NOT NULL
); );
CREATE TABLE ConversationDafl( CREATE TABLE ConversationDafl(
idUserA INT NOT NULL REFERENCES User(idDafl), idUserA INT NOT NULL REFERENCES UserDafl(idDafl),
idUserB INT NOT NULL REFERENCES User(idDafl), idUserB INT NOT NULL REFERENCES UserDafl(idDafl),
idConversation INT PRIMARY KEY, idConversation INT PRIMARY KEY,
waiting BOOLEAN NOT NULL CHECK (waiting=1 OR waiting=0) waiting BOOLEAN NOT NULL CHECK (waiting=1 OR waiting=0)
); );

@ -18,6 +18,3 @@ function connection(): bool|int|mysqli
} }
} }

@ -33,7 +33,7 @@ function insertUserAndReturnList(): array|int
latitude double NOT NULL, latitude double NOT NULL,
longitude double NOT NULL, longitude double NOT NULL,
idMusic varchar(100) NOT NULL, idMusic varchar(100) NOT NULL,
dateLog datetime NOT NULL dateLog date NOT NULL
);"; );";
mysqli_query($res, $query); mysqli_query($res, $query);

Loading…
Cancel
Save