Merge branch 'FinalDateBaseForLocation' into LinkDataPhpFlutter
continuous-integration/drone/push Build is passing Details

# Conflicts:
#	.idea/libraries/Dart_SDK.xml
#	Sources/dafl_project_flutter/ios/Runner/Info.plist
#	Sources/dafl_project_flutter/lib/main.dart
#	Sources/dafl_project_flutter/lib/persistence/database_connexion.dart
#	Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart
#	Sources/dafl_project_flutter/pubspec.lock
#	Sources/dafl_project_flutter/pubspec.yaml
messagerie_lucas_test
Dorian HODIN 2 years ago
commit 936ebba5bd

@ -11,6 +11,30 @@
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/build" /> <excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/.pub" /> <excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/.dart_tool" /> <excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/flutter_native_splash/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/flutter_native_splash/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/flutter_native_splash/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/vibration/example/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/vibration/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/vibration/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/vibration/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/vibration/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/vibration/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/fluttertoast/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/fluttertoast/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/fluttertoast/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/flutter_native_splash/example/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/flutter_native_splash/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/flutter_native_splash/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/fluttertoast/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/fluttertoast/example/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/ios/.symlinks/plugins/fluttertoast/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/windows/flutter/ephemeral/.plugin_symlinks/path_provider_windows/example/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/windows/flutter/ephemeral/.plugin_symlinks/path_provider_windows/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/windows/flutter/ephemeral/.plugin_symlinks/path_provider_windows/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/windows/flutter/ephemeral/.plugin_symlinks/path_provider_windows/build" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/windows/flutter/ephemeral/.plugin_symlinks/path_provider_windows/.pub" />
<excludeFolder url="file://$MODULE_DIR$/Sources/dafl_project_flutter/windows/flutter/ephemeral/.plugin_symlinks/path_provider_windows/.dart_tool" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

@ -1,25 +1,25 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Dart SDK"> <library name="Dart SDK">
<CLASSES> <CLASSES>
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/async" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/async" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/cli" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/cli" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/collection" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/convert" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/core" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/core" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/developer" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/ffi" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/ffi" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/html" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/html" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/indexed_db" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/indexed_db" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/io" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/io" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/isolate" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/js" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/js" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/js_util" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/js_util" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/math" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/math" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/mirrors" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/svg" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/svg" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/typed_data" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/web_audio" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://Z:/flutter/bin/cache/dart-sdk/lib/web_gl" /> <root url="file://$PROJECT_DIR$/../../../../flutter_windows_3.3.3-stable/flutter/bin/cache/dart-sdk/lib/web_gl" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

@ -1,19 +1,24 @@
import 'package:dafl_project_flutter/persistence/database_loader.dart'; import '../persistence/database_loader.dart';
import 'package:dafl_project_flutter/persistence/database_saver.dart'; import '../persistence/database_saver.dart';
import 'package:dafl_project_flutter/persistence/loader.dart'; import '../persistence/database_searcher.dart';
import '../persistence/loader.dart';
import '../persistence/saver.dart'; import '../persistence/saver.dart';
import '../persistence/loader.dart'; import '../persistence/loader.dart';
import '../model/user.dart'; import '../model/user.dart';
import '../persistence/searcher.dart';
class Controller{ class Controller{
static Controller? _this; static Controller? _this;
static Saver? saver = DatabaseSaver(); static Saver saver = DatabaseSaver();
static Loader? loader = DatabaseLoader(); static Loader loader = DatabaseLoader();
static Searcher _searcher = DatabaseSearcher();
User currentUser = User("", "");
Future<User?>? currentUser;
factory Controller(){ factory Controller(){
if (_this == null) _this = Controller._(); if (_this == null) _this = Controller._();
@ -23,13 +28,33 @@ class Controller{
Controller._(); Controller._();
void save(User userToSave){ void save(User userToSave){
saver?.save(userToSave); saver.save(userToSave);
} }
void load(String username, String password) async{ Future<void> load(String username, String password) async{
currentUser = loader?.load(username, password); changeCurrentUser(await loader.load(username, password));
} }
User createUser(String username, String password){
return User(username, password);
} }
void changeCurrentUser(User user){
this.currentUser = user;
}
void changeUsernameCourant(String newName){
if(newName !=null){
this.currentUser.usernameDafl = newName;
}
}
void changePasswordCourant(String newPass){
if(newPass !=null){
this.currentUser.passwDafl = newPass;
}
}
Future<bool> searchByUsername(String username) async{
return await _searcher.searchByUsername(username);
}
}

@ -1,30 +1,30 @@
import 'dart:async'; import 'dart:async';
import 'package:dafl_project_flutter/persistence/database_saver.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:path_provider/path_provider.dart'; import 'package:vibration/vibration.dart';
import 'dart:math'; import 'dart:math';
import './views/pages/home/p_home.dart'; import './views/pages/home/p_home.dart';
import './views/pages/main/p_main.dart'; import './views/pages/main/p_main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rive/rive.dart'; import 'package:rive/rive.dart' as riv;
import 'package:dafl_project_flutter/controller/controller.dart'; import '../controller/controller.dart';
import '../model/music.dart';
import 'model/music.dart';
void main() { void main() {
MyApp mainApp = MyApp(); MyApp mainApp = MyApp();
runApp(MyApp());
runApp(mainApp);
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
Controller controller = Controller();
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context){ Widget build(BuildContext context){
Paint.enableDithering = true;
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
return ChangeNotifierProvider( return ChangeNotifierProvider(
create: (context) => CardProvider(), create: (context) => CardProvider(),
@ -37,38 +37,22 @@ class MyApp extends StatelessWidget {
} }
} }
enum CardStatus { like, disLike, discovery} enum CardStatus { like, disLike, discovery, message}
class CardProvider extends ChangeNotifier{ class CardProvider extends ChangeNotifier{
List<String> _urlImages = []; List<Music> _spotsList = MyApp().controller.currentUser.Spots;
bool _isDragging = false; bool _isDragging = false;
double _angle = 0; double _angle = 0;
Offset _position = Offset.zero; Offset _position = Offset.zero;
Size _screenSize = Size.zero; Size _screenSize = Size.zero;
List<String> get urlImages => _urlImages; List<Music> get spotsList => _spotsList;
bool get isDragging => _isDragging; bool get isDragging => _isDragging;
Offset get position => _position; Offset get position => _position;
double get angle => _angle; double get angle => _angle;
CardProvider() {
resetUsers();
}
void resetUsers() {
_urlImages = <String>[
'https://khaligidilit.com/assets/images/cover-LAI%CC%88LA-Khali.jpeg',
'https://m.media-amazon.com/images/I/61aUOMzwS8L._SL1440_.jpg',
'https://pbs.twimg.com/media/ExJ-My-XMAE3Ko2.jpg',
'https://cdns-images.dzcdn.net/images/cover/2818a661c6d533155ce6dffc256b1f51/500x500.jpg',
'https://cdns-images.dzcdn.net/images/cover/b351f0e935c9c3901f8d893b92ab952a/500x500.jpg',
'https://cdns-images.dzcdn.net/images/cover/65147b581f2ace9e0f0723ee76e70fda/500x500.jpg',
'https://cdns-images.dzcdn.net/images/cover/173b96be8ac025fb9578b0139010bc80/500x500.jpg',
'https://cdns-images.dzcdn.net/images/cover/17a9747927ac3e5ea56f92f635d9180c/500x500.jpg',
].reversed.toList();
notifyListeners();
}
void setScreenSize(Size screenSize) => _screenSize = screenSize; void setScreenSize(Size screenSize) => _screenSize = screenSize;
@ -87,7 +71,7 @@ class CardProvider extends ChangeNotifier{
notifyListeners(); notifyListeners();
} }
void endPosition() { void endPosition(context) {
_isDragging = false; _isDragging = false;
notifyListeners(); notifyListeners();
@ -96,7 +80,7 @@ class CardProvider extends ChangeNotifier{
switch (status) { switch (status) {
case CardStatus.like: case CardStatus.like:
like(); like(context);
break; break;
case CardStatus.disLike: case CardStatus.disLike:
dislike(); dislike();
@ -104,6 +88,9 @@ class CardProvider extends ChangeNotifier{
case CardStatus.discovery: case CardStatus.discovery:
discovery(); discovery();
break; break;
case CardStatus.message:
message(context);
break;
default: default:
resetPosition(); resetPosition();
} }
@ -127,7 +114,8 @@ class CardProvider extends ChangeNotifier{
CardStatus? getStatus({bool force = false}) { CardStatus? getStatus({bool force = false}) {
final x = _position.dx; final x = _position.dx;
final y = _position.dy; final y = _position.dy;
final forceDiscovery = x.abs() < 20; final forceDiscovery = x.abs() < 80;
final forceMessage = x.abs() < 100;
if(force) { if(force) {
final delta = 100; final delta = 100;
@ -137,12 +125,16 @@ class CardProvider extends ChangeNotifier{
} else if ( x <= -delta){ } else if ( x <= -delta){
return CardStatus.disLike; return CardStatus.disLike;
} else if ( y <= -delta/2 && forceDiscovery){ } else if ( y <= -delta/2 && forceDiscovery){
return CardStatus.message;
} else if (y >= delta * 2 && x.abs() < 100) {
return CardStatus.discovery; return CardStatus.discovery;
} }
} else{ } else{
final delta = 20; final delta = 20;
if(y <= -delta * 2 && forceDiscovery) { if(y <= -delta * 2 && forceDiscovery) {
return CardStatus.message;
} else if (y >= delta *2 && x.abs() < 80) {
return CardStatus.discovery; return CardStatus.discovery;
}else if ( x >= delta) { }else if ( x >= delta) {
return CardStatus.like; return CardStatus.like;
@ -161,10 +153,24 @@ class CardProvider extends ChangeNotifier{
} }
void discovery() { void discovery() {
print("discovery");
_angle = 0; _angle = 0;
_position -= Offset(0, _screenSize.height); _position -= Offset(0, -_screenSize.height);
_discovery_card(); _discovery_card();
print("discovery");
if(MyApp().controller.currentUser.Discovery.contains(MyApp().controller.currentUser.Spots?.last)){
MyApp().controller.currentUser.Discovery.remove(MyApp().controller.currentUser.Spots?.last);
Fluttertoast.showToast(
msg: 'Supprimer',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.TOP,
timeInSecForIosWeb: 2,
backgroundColor: Colors.red,
textColor: Colors.white
);
}
else{
if(MyApp().controller.currentUser.Spots?.last != null){
MyApp().controller.currentUser.addDiscovery(MyApp().controller.currentUser.Spots.last);
Fluttertoast.showToast( Fluttertoast.showToast(
msg: 'Ajouté', msg: 'Ajouté',
toastLength: Toast.LENGTH_SHORT, toastLength: Toast.LENGTH_SHORT,
@ -173,31 +179,162 @@ class CardProvider extends ChangeNotifier{
backgroundColor: Colors.deepPurple, backgroundColor: Colors.deepPurple,
textColor: Colors.white textColor: Colors.white
); );
notifyListeners();
}
}
}
void message(context) {
print("message");
_angle = 0;
_position -= Offset(0, _screenSize.height);
_message_card();
showModalBottomSheet(
isDismissible: false,
useRootNavigator: true,
isScrollControlled: true,
backgroundColor: Colors.transparent,
context: context,
constraints: BoxConstraints(
maxWidth: 600,
maxHeight: double.infinity,
),
builder: (context) => buildSheet(),);
notifyListeners(); notifyListeners();
} }
Widget buildSheet() => Container(
height: 550,
width: 350,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.4),
offset: const Offset(
0,
0,
),
blurRadius: 10.0,
spreadRadius: 2.0,
),
BoxShadow(
color: Colors.white.withOpacity(0.3),
offset: const Offset(0.0, 0.0),
blurRadius: 0.0,
spreadRadius: 0.0,
),//BoxShadow//BoxShadow
],
color: Color(0xFF232123),
borderRadius: BorderRadius.only(
topRight: Radius.circular(30),
topLeft: Radius.circular(30),
),
),
child: Padding(
padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
child: Column(
children: [
void like() { Container(
height: 5,
width: 130,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xFF8A8A8A),
),
),
SizedBox(height: 30,),
Container(
width: double.infinity,
height: 300,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xFF302C30),
),
child: Padding(
padding: EdgeInsets.all(20),
child: TextField(
maxLength: 300,
style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200),
expands: true,
maxLines: null,
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
hintStyle: TextStyle(
color: Colors.white,
),
border: InputBorder.none,
hintText: "Mon message",
),
),
),
),
SizedBox(height: 20,),
SizedBox(
width: double.infinity,
height: 70,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: Color(0xFF3F1DC3),
textStyle: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(17)
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text("Envoyer"),
Opacity(opacity: 0.2,
child: Image.asset("assets/images/send_logo.png",),)
],
),
),
)
],
),
),
);
void like(context) {
print("like"); print("like");
_angle = 20; _angle = 20;
_position += Offset(2 * _screenSize.width, 0); _position += Offset(2 * _screenSize.width, 0);
_nextCard(); _nextCard();
notifyListeners(); notifyListeners();
} }
Future _nextCard() async { Future _nextCard() async {
if ( _urlImages.isEmpty) return; print(_spotsList.length);
if (_spotsList.isEmpty) {
print('dernier');
return;
}
else {
await Future.delayed(Duration(milliseconds: 200)); await Future.delayed(Duration(milliseconds: 200));
_urlImages.removeLast(); print(_spotsList.last.name);
_spotsList.removeLast();
resetPosition(); resetPosition();
} }
}
Future _discovery_card() async { Future _discovery_card() async {
await Future.delayed(Duration(milliseconds: 200)); await Future.delayed(Duration(milliseconds: 200));
resetPosition(); resetPosition();
} }
Future _message_card() async {
await Future.delayed(Duration(milliseconds: 200));
resetPosition();
}
} }
@ -238,7 +375,7 @@ class _SplashState extends State<Splash> {
Container( Container(
height: 300, height: 300,
width: 300, width: 300,
child: RiveAnimation.asset('assets/images/new_file (2).riv'), child: riv.RiveAnimation.asset('assets/images/new_file (2).riv'),
), ),
SizedBox(height: 50), SizedBox(height: 50),
], ],
@ -247,3 +384,166 @@ class _SplashState extends State<Splash> {
); );
} }
} }
Object Notify(int index, context, {bool isError = true}){
String message;
if(isError == true){
switch(index){
case 0: {
message = "Ce nom d'utilisateur existe déjà ! Veuillez réessayer.";
break;
}
case 1: {
message = "Mots de passe différents ! Veuillez réessayer.";
break;
}
case 2: {
message = "Identifiant incorrect ! Veuillez réessayer.";
break;
}
case 3: {
message = "Mot de passe incorrect ! Votre mot de passe doit contenir 8 caractères minimum.";
break;
}
case 4: {
message = "Mot de passe incorrect ! Veuillez réessayer.";
break;
}
default:
message = "Une erreur est survenue pendant l'inscription. Veuillez réessayer.";
break;
}
return ScaffoldMessenger.of(context).showSnackBar( SnackBar(
dismissDirection: DismissDirection.down,
behavior: SnackBarBehavior.floating,
backgroundColor: Colors.transparent,
elevation: 0,
content: Stack(
clipBehavior: Clip.none,
children: [
Container(
padding: EdgeInsets.all(16),
height: 90,
child: Row(
children: [
Container(
height: 48,
width: 48,
),
Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Oh oh !", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),),
Text(message,style: TextStyle(
),
overflow: TextOverflow.ellipsis,
maxLines: 2,),
],
),),
],
),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/backgroundNotify.png"),
fit: BoxFit.cover),
gradient: LinearGradient(colors: [Color(0xFF81052a),Color(0xFF810548)],begin: Alignment.topLeft, end: Alignment.bottomRight),
borderRadius: BorderRadius.all(Radius.circular(20)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 10,
offset: Offset(4, 8), // Shadow position
),
],
),
),
Positioned(
top: -50,
left: -20,
child: Container(
color: Colors.transparent,
height: 110,
width: 110,
child: riv.RiveAnimation.asset("assets/images/error_icon.riv"),)),
],
)
));
}
else{
switch(index){
case 0: {
message = "Vous avez changer votre identifiant avec succès";
break;
}
case 1: {
message = "Vous avez changer votre mot de passe avec succès";
break;
}
default:
message = "L'opération a bien été éxécutée";
break;
}
return ScaffoldMessenger.of(context).showSnackBar( SnackBar(
dismissDirection: DismissDirection.down,
behavior: SnackBarBehavior.floating,
backgroundColor: Colors.transparent,
elevation: 0,
content: Stack(
clipBehavior: Clip.none,
children: [
Container(
padding: EdgeInsets.all(16),
height: 90,
child: Row(
children: [
Container(
height: 48,
width: 48,
),
Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Super !", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),),
Text(message,style: TextStyle(
),
overflow: TextOverflow.ellipsis,
maxLines: 2,),
],
),),
],
),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/valid_background.png"),
fit: BoxFit.cover),
gradient: LinearGradient(colors: [Color(0xFF81052a),Color(0xFF810548)],begin: Alignment.topLeft, end: Alignment.bottomRight),
borderRadius: BorderRadius.all(Radius.circular(20)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 10,
offset: Offset(4, 8), // Shadow position
),
],
),
),
Positioned(
top: -50,
left: -20,
child: Container(
color: Colors.transparent,
height: 110,
width: 110,
child: riv.RiveAnimation.asset("assets/images/valid_icon.riv"),)),
],
)
));
}
}

@ -0,0 +1,19 @@
class Music{
String name;
String artist;
String linkCover;
Music(this.name, this.artist, this.linkCover);
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is Music &&
runtimeType == other.runtimeType &&
name == other.name &&
artist == other.artist;
@override
int get hashCode => name.hashCode ^ artist.hashCode;
}

@ -1,27 +1,77 @@
import 'package:dafl_project_flutter/main.dart';
import 'package:dafl_project_flutter/model/message.dart';
import 'conversation.dart'; import 'conversation.dart';
import 'music.dart';
class User{ class User{
//attributes from DAFL //attributes from DAFL
int? idDafl; late int _idDafl;
String? usernameDafl; late String _usernameDafl;
String? passwDafl; late String _passwDafl;
//attributes to link with API //attributes to link with API
String? usernameAPI; late String _usernameAPI;
String? passwAPI; late String _passwAPI;
// Getters for attributes
int get idDafl => _idDafl;
String get passwAPI => _passwAPI;
String get usernameDafl => _usernameDafl;
String get passwDafl => _passwDafl;
String get usernameAPI => _usernameAPI;
// Setters for attributes
set idDafl(int value) { _idDafl = value; }
set usernameDafl(String value) { _usernameDafl = value; }
set passwDafl(String value) { _passwDafl = value; }
set usernameAPI(String value) { _usernameAPI = value; }
set passwAPI(String value) { _passwAPI = value; }
//constructors //constructors
User(this.usernameDafl, this.passwDafl); User(this._usernameDafl, this._passwDafl);
User.name(this.usernameDafl); User.name(this._usernameDafl);
User.fromDatabase(this._idDafl, this._usernameDafl);
User.fromDatabase(this.idDafl, this.usernameDafl);
//lists //lists
Set<User> likedUsers={}; Set<User> likedUsers={};
List<Music> Discovery=[];
List<Conversation> waitingConv=[];
List<Conversation> confirmConv=[];
Music currentSong = Music('Couleurs','Khali','https://khaligidilit.com/assets/images/cover-LAI%CC%88LA-Khali.jpeg');
List<Music> Spots=[
Music('Couleurs','Khali','https://khaligidilit.com/assets/images/cover-LAI%CC%88LA-Khali.jpeg'),
Music("J'suis PNL",'PNL','https://m.media-amazon.com/images/I/61aUOMzwS8L._SL1440_.jpg'),
Music('Sundance','Nepal','https://pbs.twimg.com/media/ExJ-My-XMAE3Ko2.jpg'),
Music('Eternelle 2','So La Lune','https://cdns-images.dzcdn.net/images/cover/2818a661c6d533155ce6dffc256b1f51/500x500.jpg'),
Music('M.I.L.S 3','Ninho','https://cdns-images.dzcdn.net/images/cover/b351f0e935c9c3901f8d893b92ab952a/500x500.jpg'),
Music('Deux frères','PNL','https://cdns-images.dzcdn.net/images/cover/65147b581f2ace9e0f0723ee76e70fda/500x500.jpg'),
Music('Paradis','Sopico','https://cdns-images.dzcdn.net/images/cover/17a9747927ac3e5ea56f92f635d9180c/500x500.jpg')].reversed.toList();
Map<User,Conversation> conversations={}; Map<User,Conversation> conversations={};
void addDiscovery(Music newmusic){
if(MyApp().controller.currentUser.Discovery == null){
}
else{
MyApp().controller.currentUser.Discovery.add(newmusic);
}
}
void like(User liked){ void like(User liked){
likedUsers.add(liked); likedUsers.add(liked);
Conversation? conv = liked.conversations[this]; Conversation? conv = liked.conversations[this];
@ -42,5 +92,5 @@ class User{
} }
@override @override
String toString() => "$usernameDafl ($idDafl)"; String toString() => "$usernameDafl ($passwDafl)";
} }

@ -1,8 +0,0 @@
import 'user.dart';
class UserCreator{
User? createUser(int id, String username){
}
}

@ -1,5 +0,0 @@
postgres
mdpDaflBd
89.83.54.48
BD-DaflMusic

@ -1,6 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
@ -9,16 +8,23 @@ import 'package:postgresql2/constants.dart';
import 'package:postgresql2/pool.dart'; import 'package:postgresql2/pool.dart';
import 'package:postgresql2/postgresql.dart'; import 'package:postgresql2/postgresql.dart';
class DatabaseConnexion{ class DatabaseConnexion{
final String filePath = 'assets/logs.txt'; // Path to the file containing the database identifiers
static final String filePath = 'assets/logs.txt';
String? _psqlUser; // Database identifiers
String? _psqlPswd; static String? _psqlUser;
String? _psqlHost; static String? _psqlPswd;
String? _psqlDataBase; static String? _psqlHost;
static String? _psqlDataBase;
Future<void> _loadLogs() async{
// Read the database connection identifiers in a file
static Future<void> _loadLogs() async{
try{ try{
final _loadedData = await rootBundle.loadString(filePath); final _loadedData = await rootBundle.loadString(filePath);
@ -35,12 +41,20 @@ class DatabaseConnexion{
} }
//Initialise connection to the database
Future<Connection> initConnexion() async{ //Initialise and open a connection to the database
static Future<Connection> initConnexion() async{
if(_psqlHost == null || _psqlPswd == null || _psqlUser == null || _psqlDataBase == null){
await _loadLogs(); await _loadLogs();
}
try{
var uri = 'postgres://$_psqlUser:$_psqlPswd@$_psqlHost:5442/$_psqlDataBase'; var uri = 'postgres://$_psqlUser:$_psqlPswd@$_psqlHost:5442/$_psqlDataBase';
return connect(uri); return connect(uri);
} }
catch(e){
throw Exception('Connection to database : IMPOSSIBLE');
}
}
} }

@ -1,20 +1,27 @@
import '../persistence/loader.dart'; import 'dart:async';
import 'loader.dart';
import '../model/user.dart'; import '../model/user.dart';
import 'database_connexion.dart'; import 'database_connexion.dart';
class DatabaseLoader extends Loader{ class DatabaseLoader extends Loader{
DatabaseConnexion dbConnexion = DatabaseConnexion();
// Load an user from database
@override @override
Future<User?> load(String? username, String? password) async { Future<User> load(String username, String password) async {
final connection = await dbConnexion.initConnexion(); final connection = await DatabaseConnexion.initConnexion();
connection.query('select * from utilisateur where username = @username AND password = @password', var queryResult = await connection.query('select * from utilisateur where username = @username AND password = @password',
{'username': username, {'username': username,
'password': password}).toList() 'password': password}).toList()
.then((result) { .then((result) {
print(result); }); print(result);
if(result.isNotEmpty) return User(username, password);
else return User("", "");
}).whenComplete(() {
connection.close();});
return queryResult;
} }
} }

@ -5,15 +5,21 @@ import '../model/user.dart';
class DatabaseSaver extends Saver{ class DatabaseSaver extends Saver{
DatabaseConnexion dbConnexion = DatabaseConnexion();
// Save user in the database
@override @override
void save(User userToSave) async{ void save(User userToSave) async{
final connection = await dbConnexion.initConnexion(); final connection = await DatabaseConnexion.initConnexion();
connection.execute('insert into utilisateur (username, password) values (@username, @password)', connection.execute('insert into utilisateur (username, password) values (@username, @password)',
{ 'id' : '', { 'id' : '',
'username': userToSave.usernameDafl, 'username': userToSave.usernameDafl,
'password' : userToSave.passwDafl}).then((_) {}); 'password' : userToSave.passwDafl})
.whenComplete(() {
connection.close();
});
} }
} }

@ -0,0 +1,26 @@
import 'package:dafl_project_flutter/persistence/database_connexion.dart';
import 'searcher.dart';
class DatabaseSearcher extends Searcher{
Future<bool> searchUser(String? username, String? password) async { return true; }
// Search an user in the database by username
@override
Future<bool> searchByUsername(String? usernameToSearch) async{
final connection = await DatabaseConnexion.initConnexion();
bool queryResult = await connection.query('select * from utilisateur where username = @username',{ 'username' : usernameToSearch})
.toList()
.then((rows) { return rows.isEmpty; }).whenComplete(() {
connection.close();});
return queryResult;
}
}

@ -1,5 +1,7 @@
import 'dart:async';
import '../model/user.dart'; import '../model/user.dart';
abstract class Loader{ abstract class Loader{
Future<User?> load(String? username, String? password); Future<User> load(String username, String password);
} }

@ -1,6 +1,6 @@
import '../model/user.dart'; import '../model/user.dart';
abstract class Search{ abstract class Searcher{
bool searchUser(String? username, String? password); Future<bool> searchUser(String? username, String? password);
bool searchUsername(String? username); Future<bool> searchByUsername(String? username);
} }

@ -28,30 +28,12 @@ class _HomePageState extends State<HomePage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Spacer(),
Image.asset( Image.asset(
'assets/images/Logo.png', 'assets/images/Logo.png',
width: 200, width: 230,
), ),
SizedBox(height: height*0.04,), SizedBox(height: height*0.08,),
SizedBox(
height: 55,
width: width*0.75,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF24CF5F),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),// background// foreground
),
onPressed: () {
},
child: Text("CONTINUER AVEC SPOTIFY",
style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
),),
SizedBox(height: height*0.015,),
SizedBox( SizedBox(
height: 55, height: 55,
width: width*0.75, width: width*0.75,
@ -76,7 +58,7 @@ class _HomePageState extends State<HomePage> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
),), ),),
SizedBox(height: 220,), Spacer(),
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
Navigator.of(context).push( Navigator.of(context).push(
@ -112,15 +94,6 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
Align(
alignment: Alignment.topRight,
child: Container(
padding: EdgeInsets.fromLTRB(0, 20, 20, 0),
child: Text("v1.0",
style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.5) ,fontSize: 17, fontWeight: FontWeight.w700),
),
)
),
], ],
), ),

@ -0,0 +1,161 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
class ConversationPage extends StatefulWidget {
const ConversationPage({Key? key}) : super(key: key);
@override
State<ConversationPage> createState() => _ConversationPageState();
}
class _ConversationPageState extends State<ConversationPage> {
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return Scaffold(
extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: true,
appBar: AppBar(
backgroundColor: Color(0xFF141414),
toolbarHeight: 70,
title: Container(
child: Row(
children: [
Container(
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
height: 40,
width: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: Colors.blue,
),
),
SizedBox(width: 20,),
Text("Max"),
],
),
),
elevation: 0,
),
body: SingleChildScrollView(
child:
Container(
color: Color(0xFF141414),
height: height*0.92,
width: double.infinity,
child: ListView(
reverse: true,
scrollDirection: Axis.vertical,
children: [
Message('Adolescebat autem obstinatum propositum erga haec et similia multa scrutanda, stimulos admovente regina, quae abrupte mariti fortunas trudebat in exitium praeceps, cum eum potius lenitate feminea ad veritatis humanitatisque viam reducere utilia suadendo deberet, ut in Gordianorum actibus factitasse Maximini truculenti illius imperatoris rettulimus coniugem.', 0),
Message('Claudiopolis olim Seleucia Caesar potens quidem olim interneciva enim et.', 1),
Message('Quae quae praeceps feminea quae truculenti humanitatisque cum humanitatisque in truculenti abrupte imperatoris mariti regina regina ad lenitate veritatis veritatis.', 1),
Message('Quae quae praeceps feminea quae truculenti humanitatisque cum humanitatisque in truculenti abrupte imperatoris mariti regina regina ad lenitate veritatis veritatis.', 0),
Message('Quae quae praeceps feminea quae truculenti humanitatisque cum humanitatisque in truculenti abrupte imperatoris mariti regina regina ad lenitate veritatis veritatis.', 0),
Message('Quae quae praeceps feminea quae truculenti humanitatisque cum humanitatisque in truculenti abrupte imperatoris mariti regina regina ad lenitate veritatis veritatis.', 1),
],
),
),
),
bottomSheet: BottomAppBar(
color: Color(0xFF141414),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: height*0.08,
color: Colors.transparent,
width: width*0.8,
child: Container(
margin: EdgeInsets.fromLTRB(20, 10, 0, 10),
decoration: BoxDecoration(
border: Border.all(
width: 1,
color: Color(0xFF2F2F2F),
),
borderRadius: BorderRadius.circular(100),
color: Color(0xFF141414),
),
child: Padding(
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
child: TextField(
style: TextStyle(color: Colors.white),
decoration: InputDecoration(
hintStyle: TextStyle(color: Colors.white),
border: InputBorder.none,
hintText: "Envoyer un message...",
),
cursorColor: Colors.purple,
textAlign: TextAlign.left,
),
),
),
),
Container(
width: 40,
height: 40,
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Colors.blue,
),
child: Icon(Icons.send, size: 20, color: Colors.white,),
)
],
),
),
);
}
Widget Message(String message, int user) {
if(user == 0){
return Container(
margin: EdgeInsets.fromLTRB(40, 7, 80, 7),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(20),
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
),
border: Border.all(width: 1.5,
color: Color(0xFF9C9C9C).withOpacity(0.3)),
color: Color(0xFF191919),
),
child: Padding(
padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
child: Text(message,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),
)),
);
}
else{
return Container(
margin: EdgeInsets.fromLTRB(80, 7, 40, 7),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
color: Color(0xFF2F2F2F),
),
child: Padding(
padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
child: Text(message,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),
)),
);
}
}
}

@ -4,8 +4,7 @@ import './w_settings.dart';
import './w_spot.dart'; import './w_spot.dart';
import './w_discovery.dart'; import './w_discovery.dart';
import './w_profile.dart'; import './w_profile.dart';
import '../../../position/location.dart'; import './w_messages.dart';
class MainPage extends StatefulWidget { class MainPage extends StatefulWidget {
const MainPage({Key? key}) : super(key: key); const MainPage({Key? key}) : super(key: key);
@ -20,18 +19,17 @@ class _MainPageState extends State<MainPage> {
int get index => _index; int get index => _index;
final screens = [ final screens = [
ProfilWidget(), ProfilWidget(),
DiscoveryWidget(), new DiscoveryWidget(),
SpotsWidget(), SpotsWidget(),
Center(child: Text('Tops'),), Center(child: Text('Tops'),),
Center(child: Text('Messages'),), MessagesWidget(),
SettingsWidget(), SettingsWidget(),
]; ];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Location.sendCurrentLocation();
Location.getData();
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false,
body: screens[_index], body: screens[_index],
bottomNavigationBar: NavigationBarTheme( bottomNavigationBar: NavigationBarTheme(
data: NavigationBarThemeData( data: NavigationBarThemeData(

@ -3,17 +3,6 @@ import 'package:flutter/material.dart';
import '../../../main.dart'; import '../../../main.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class User{
final String chanteur;
final String titre;
final String urlImage;
const User({
required this.chanteur,
required this.titre,
required this.urlImage,
});
}
@ -51,14 +40,14 @@ class _CardWidgetState extends State<CardWidget>{
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(widget.urlImage),
fit: BoxFit.cover,
alignment: Alignment(0,0),
),
borderRadius: BorderRadius.all(Radius.circular(20)) borderRadius: BorderRadius.all(Radius.circular(20))
), ),
child: FadeInImage.assetNetwork(
height: double.infinity,
width: double.infinity,
fit: BoxFit.cover,
placeholder: "assets/images/loadingPlaceholder.gif", image: widget.urlImage ),
), ),
); );
@ -77,6 +66,9 @@ class _CardWidgetState extends State<CardWidget>{
case CardStatus.discovery: case CardStatus.discovery:
final child = buildStamp(image: 'assets/images/icon_discovery.png', opacity: opacity); final child = buildStamp(image: 'assets/images/icon_discovery.png', opacity: opacity);
return child; return child;
case CardStatus.message:
final child = buildStamp(image: 'assets/images/icon_messages.png', opacity: opacity);
return child;
default: default:
return Container(); return Container();
@ -124,7 +116,7 @@ class _CardWidgetState extends State<CardWidget>{
..translate(-center.dx, -center.dy); ..translate(-center.dx, -center.dy);
return AnimatedContainer( return AnimatedContainer(
curve: Curves.easeInOut, curve: Curves.easeOut,
duration: Duration(milliseconds: milliseconds), duration: Duration(milliseconds: milliseconds),
transform: rotatedMatrix..translate(position.dx, position.dy), transform: rotatedMatrix..translate(position.dx, position.dy),
child: Stack( child: Stack(
@ -149,7 +141,7 @@ class _CardWidgetState extends State<CardWidget>{
onPanEnd: (details) { onPanEnd: (details) {
final provider = Provider.of<CardProvider>(context, listen: false); final provider = Provider.of<CardProvider>(context, listen: false);
provider.endPosition(); provider.endPosition(context);
}, },

@ -1,6 +1,11 @@
import 'dart:math';
import 'package:dafl_project_flutter/main.dart';
import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../model/music.dart';
class DiscoveryWidget extends StatefulWidget { class DiscoveryWidget extends StatefulWidget {
const DiscoveryWidget({Key? key}) : super(key: key); const DiscoveryWidget({Key? key}) : super(key: key);
@ -13,15 +18,15 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Container(
backgroundColor: Color(0xFF141414), color: Color(0xFF141414),
resizeToAvoidBottomInset: false,
body: Padding(padding: EdgeInsets.fromLTRB(30, 50, 30, 0), child: Padding(padding: EdgeInsets.fromLTRB(0, 50, 0, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -38,92 +43,52 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
), ),
), ),
Expanded( Expanded(
child: ListView( child: MyApp().controller.currentUser.Discovery.isEmpty?
Center(child: Image.asset('assets/images/EmptyDiscovery-Hint.png',scale: 1.8,)):
children: [ DiscoveryList(),
SizedBox(height: 40,),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Column(
children: [
Container(
margin: EdgeInsets.fromLTRB(0, 5, 0, 0),
width: double.infinity,
child: Row(
children: [
Container(
height: 60,
width: 60,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage('https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
fit: BoxFit.cover,
), ),
border: Border.all(width: 0, color: Colors.grey.withOpacity(0)),
borderRadius: BorderRadius.all(Radius.circular(10)),
),),
Container(
margin: EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('IVERSON',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text('Laylow',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),),
], ],
),), ),),
], );
), }
), }
], class DiscoveryList extends StatefulWidget {
) const DiscoveryList({Key? key}) : super(key: key);
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Column(
children: [
Container( @override
margin: EdgeInsets.fromLTRB(0, 5, 0, 0), State<DiscoveryList> createState() => _DiscoveryListState();
width: double.infinity, }
child: Row(
children: [
Container(
height: 60,
width: 60,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage('https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
fit: BoxFit.cover,
),
border: Border.all(width: 0, color: Colors.grey.withOpacity(0)),
borderRadius: BorderRadius.all(Radius.circular(10)),
),),
Container(
margin: EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('IVERSON',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text('Laylow',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),),
],
),),
],
),
),
class _DiscoveryListState extends State<DiscoveryList> {
late GlobalKey<RefreshIndicatorState> refreshKey;
@override
void initState() {
refreshKey = GlobalKey<RefreshIndicatorState>();
refreshList();
super.initState();
}
], Future<Null> refreshList() async {
) await Future.delayed(Duration(seconds: 1));
), setState(() {
Container( MyApp().controller.currentUser.Discovery;
});
return null;
}
Widget build(BuildContext context) {
return RefreshIndicator(child: ListView.builder(
itemCount: MyApp().controller.currentUser.Discovery.length ?? 0,
itemBuilder: (context, index){
int itemCount = MyApp().controller.currentUser.Discovery.length ?? 0;
int reversedIndex = itemCount - 1 - index;
return Dismissible(
key: Key(MyApp().controller.currentUser.Discovery[reversedIndex].name),
direction: DismissDirection.startToEnd,
child: Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0), margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
child: Column( child: Column(
children: [ children: [
@ -136,12 +101,11 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
height: 60, height: 60,
width: 60, width: 60,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage('https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
fit: BoxFit.cover,
),
border: Border.all(width: 0, color: Colors.grey.withOpacity(0)), border: Border.all(width: 0, color: Colors.grey.withOpacity(0)),
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Container(
child: FadeInImage.assetNetwork(placeholder: "assets/images/loadingPlaceholder.gif", image: MyApp().controller.currentUser.Discovery[reversedIndex].linkCover),
),), ),),
Container( Container(
margin: EdgeInsets.fromLTRB(20, 0, 0, 0), margin: EdgeInsets.fromLTRB(20, 0, 0, 0),
@ -149,8 +113,8 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('IVERSON',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),), Text(MyApp().controller.currentUser?.Discovery[reversedIndex].name ?? '',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text('Laylow',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),), Text(MyApp().controller.currentUser?.Discovery[reversedIndex].artist ?? '',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),),
], ],
),), ),),
@ -161,14 +125,17 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
], ],
) )
),
], ), onDismissed: (direction) {
), if(direction == DismissDirection.startToEnd)
), MyApp().controller.currentUser?.Discovery.removeAt(reversedIndex);
], },
),), background: Container(decoration: BoxDecoration(
); image: DecorationImage(image: AssetImage("assets/images/delete_background.png"), fit: BoxFit.cover),
)),);
}
), onRefresh: () async {
refreshList();
}, key: refreshKey,);
} }
} }

@ -0,0 +1,228 @@
import 'package:dafl_project_flutter/views/pages/main/p_conversation.dart';
import 'package:dafl_project_flutter/views/pages/main/p_main.dart';
import 'package:flutter/material.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:page_transition/page_transition.dart';
class MessagesWidget extends StatefulWidget {
const MessagesWidget({Key? key}) : super(key: key);
@override
State<MessagesWidget> createState() => _MessagesWidgetState();
}
class _MessagesWidgetState extends State<MessagesWidget> {
int indexSectedButton = 0;
Widget listeActuelle = ListConfirmedWidget();
var colorConfirm = Color(0xFFFFFFFF);
var colorWaiting = Color(0xFFA8A8A8);
void changeSelected(int num){
if(indexSectedButton == num){
return;
}
else{
if(num == 0){
setState((){
colorConfirm = Color(0xFFFFFFFF);
colorWaiting = Color(0xFFA8A8A8);
listeActuelle = ListConfirmedWidget();
indexSectedButton = num;
});
}
else{
setState((){
colorConfirm = Color(0xFFA8A8A8);
colorWaiting = Color(0xFFFFFFFF);
listeActuelle = ListWaitingWidget();
indexSectedButton = num;
});
}
}
}
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return Container(
color: Color(0xFF141414),
child: Padding(padding: EdgeInsets.fromLTRB(30, 50, 30, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Messages', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500, fontSize: 25)),
Padding(padding: EdgeInsets.fromLTRB(0, 5, 0, 0)),
Text('Retrouvez ici vos discussions.', style: TextStyle(color: Colors.grey.withOpacity(0.4), fontSize: 15),),
Padding(
padding: EdgeInsets.fromLTRB(0, height*0.01, 0, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(
height: 35,
width: width*0.35,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: colorConfirm,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),// background// foreground
),
onPressed: () {
changeSelected(0);
},
child: Text("Validées",
style: TextStyle(color: Colors.black ,fontSize: 17, fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
),),
SizedBox(
height: 35,
width: width*0.35,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: colorWaiting,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),// background// foreground
),
onPressed: () {
changeSelected(1);
},
child: Text("En attente",
style: TextStyle(color: Colors.black ,fontSize: 17, fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
),),
],
),),
],
),
),
Expanded(
child:
listeActuelle,
),
],
),),
);
}
}
class MessagesButtonWidget extends StatelessWidget{
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
child: Column(
children: [
Container(
color: Colors.transparent,
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Row(
children: [
Container(
height: 60,
width: 60,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage('https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
fit: BoxFit.cover,
),
border: Border.all(width: 0, color: Colors.grey.withOpacity(0)),
borderRadius: BorderRadius.all(Radius.circular(30)),
),),
Container(
width: width-160,
margin: EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Max',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text('1 jour(s)',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.8) ,fontSize: 15, fontWeight: FontWeight.w400),),
],
),
Text('A envoyé un musique.',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),),
],
),),
],
),
),
],
)
);
}
}
class ListConfirmedWidget extends StatelessWidget{
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return ListView(
children: [
SizedBox(height: 40,),
MessagesButtonWidget(),
MessagesButtonWidget(),
MessagesButtonWidget(),
MessagesButtonWidget(),
],
);
}
}
class ListWaitingWidget extends StatelessWidget{
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return ListView(
children: [
SizedBox(height: 40,),
GestureDetector(
onTap: () {
Navigator.of(context).push(PageTransition(
duration: Duration(milliseconds: 200),
reverseDuration: Duration(milliseconds: 200),
type: PageTransitionType.rightToLeftWithFade,
childCurrent: context.widget,
child: ConversationPage()));
},
child: MessagesButtonWidget(),
),
],
);
}
}

@ -1,3 +1,7 @@
import 'package:dafl_project_flutter/main.dart';
import '../../../main.dart';
import '../../../main.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';
@ -16,6 +20,17 @@ class _ProfilWidgetState extends State<ProfilWidget> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
return MainPageProfil();
}
}
class MainPageProfil extends StatelessWidget {
const MainPageProfil({super.key});
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return Container( return Container(
color: Color(0xFF141414), color: Color(0xFF141414),
child: Container( child: Container(
@ -32,14 +47,32 @@ class _ProfilWidgetState extends State<ProfilWidget> {
style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600, color: Colors.white),), style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600, color: Colors.white),),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 40), margin: EdgeInsets.fromLTRB(0, 10, 0, 10),
height: height*0.14, height: height*0.14,
width: height*0.14, width: height*0.14,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100.0), borderRadius: BorderRadius.circular(100.0),
color: Colors.blue,border: Border.all(width: 6.0, color: Colors.white), color: Colors.blue,border: Border.all(width: 6.0, color: Colors.white),
boxShadow: [
BoxShadow(
offset: Offset(0, 0),
spreadRadius: 5,
blurRadius:10,
color: Color.fromRGBO(0, 0, 0, 1),
),
],
), ),
child: Center(
child: Text(MyApp().controller.currentUser.usernameDafl![0] ?? '',
style: TextStyle(color: Colors.white ,fontSize: 60, fontWeight: FontWeight.w500),
textAlign: TextAlign.center,
),
),
),
Text(MyApp().controller.currentUser.usernameDafl ?? '',
style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
), ),
Container( Container(
height: 55, height: 55,
@ -48,7 +81,7 @@ class _ProfilWidgetState extends State<ProfilWidget> {
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent, color: Colors.transparent,
), ),
margin: EdgeInsets.fromLTRB(30, 0, 30, 0), margin: EdgeInsets.fromLTRB(30, 40, 30, 0),
child: SizedBox( child: SizedBox(
height: 55, height: 55,
width: double.infinity, width: double.infinity,
@ -144,11 +177,10 @@ class _ProfilWidgetState extends State<ProfilWidget> {
margin: EdgeInsets.fromLTRB(15, 0, 0, 0), margin: EdgeInsets.fromLTRB(15, 0, 0, 0),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
child: Image( child: FadeInImage.assetNetwork(
height: 90, height: 90,
width: 90, width: 90,
image: NetworkImage('https://images.genius.com/ef4849be3da5fdb22ea9e656679be3a3.600x600x1.jpg'), placeholder: "assets/images/loadingPlaceholder.gif", image: 'https://images.genius.com/ef4849be3da5fdb22ea9e656679be3a3.600x600x1.jpg'),
),
), ),
), ),
Container( Container(
@ -177,7 +209,7 @@ class _ProfilWidgetState extends State<ProfilWidget> {
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent, color: Colors.transparent,
), ),
margin: EdgeInsets.fromLTRB(30, 0, 30, height*0.04), margin: EdgeInsets.fromLTRB(30, 0, 30,0),
child: SizedBox( child: SizedBox(
height: 55, height: 55,
width: double.infinity, width: double.infinity,
@ -205,9 +237,11 @@ class _ProfilWidgetState extends State<ProfilWidget> {
) )
),), ),),
), ),
Spacer(),
], ],
), ),
), ),
); );
} }
} }

@ -1,4 +1,6 @@
import 'package:dafl_project_flutter/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class SettingsWidget extends StatefulWidget { class SettingsWidget extends StatefulWidget {
const SettingsWidget({Key? key}) : super(key: key); const SettingsWidget({Key? key}) : super(key: key);
@ -8,6 +10,8 @@ class SettingsWidget extends StatefulWidget {
} }
class _SettingsWidgetState extends State<SettingsWidget> { class _SettingsWidgetState extends State<SettingsWidget> {
final userNameTextField = TextEditingController(text: MyApp().controller.currentUser?.usernameDafl);
final passwordTextField = TextEditingController(text: MyApp().controller.currentUser?.passwDafl);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
@ -54,6 +58,7 @@ class _SettingsWidgetState extends State<SettingsWidget> {
SizedBox( SizedBox(
width: 230, width: 230,
child: TextField( child: TextField(
controller: userNameTextField,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: Theme.of(context).textTheme.caption?.copyWith( hintStyle: Theme.of(context).textTheme.caption?.copyWith(
@ -67,9 +72,15 @@ class _SettingsWidgetState extends State<SettingsWidget> {
), ),
), ),
Spacer(), Spacer(),
Padding(padding: EdgeInsets.fromLTRB(0, 0, 20, 0), GestureDetector(
onTap: () {
MyApp().controller.changeUsernameCourant(userNameTextField.text);
Notify(0,context,isError: false);
},
child: Padding(padding: EdgeInsets.fromLTRB(0, 0, 20, 0),
child: Text('modifier', child: Text('modifier',
style: TextStyle( color: Colors.blue, fontSize: 17),),), style: TextStyle( color: Colors.blue, fontSize: 17),),),)
], ],
), ),
@ -100,6 +111,7 @@ class _SettingsWidgetState extends State<SettingsWidget> {
SizedBox( SizedBox(
width: 230, width: 230,
child: TextField( child: TextField(
controller: passwordTextField,
obscureText: true, obscureText: true,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
@ -114,9 +126,15 @@ class _SettingsWidgetState extends State<SettingsWidget> {
), ),
), ),
Spacer(), Spacer(),
Padding(padding: EdgeInsets.fromLTRB(0, 0, 20, 0), GestureDetector(
onTap: () {
MyApp().controller.changePasswordCourant(passwordTextField.text);
Notify(1,context,isError: false);
},
child: Padding(padding: EdgeInsets.fromLTRB(0, 0, 20, 0),
child: Text('modifier', child: Text('modifier',
style: TextStyle( color: Colors.blue, fontSize: 17),),), style: TextStyle( color: Colors.blue, fontSize: 17),),),
),
], ],
), ),
@ -129,3 +147,4 @@ class _SettingsWidgetState extends State<SettingsWidget> {
); );
} }
} }

@ -1,4 +1,7 @@
import 'dart:ui'; import 'dart:ui';
import 'package:dafl_project_flutter/views/pages/main/w_discovery.dart';
import '../../../model/music.dart';
import './w_card.dart'; import './w_card.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/painting/gradient.dart' as gradiant; import 'package:flutter/src/painting/gradient.dart' as gradiant;
@ -6,6 +9,7 @@ import 'package:provider/provider.dart';
import '../../../main.dart'; import '../../../main.dart';
import 'package:rive/rive.dart'; import 'package:rive/rive.dart';
import 'package:animations/animations.dart'; import 'package:animations/animations.dart';
import 'package:vibration/vibration.dart';
class SpotsWidget extends StatefulWidget { class SpotsWidget extends StatefulWidget {
const SpotsWidget({Key? key}) : super(key: key); const SpotsWidget({Key? key}) : super(key: key);
@ -16,21 +20,15 @@ class SpotsWidget extends StatefulWidget {
class _SpotsWidgetState extends State<SpotsWidget> { class _SpotsWidgetState extends State<SpotsWidget> {
final user = User(
chanteur: 'Khali',
titre: 'COULEURS',
urlImage: 'https://khaligidilit.com/assets/images/cover-LAI%CC%88LA-Khali.jpeg',
);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width; double width = MediaQuery.of(context).size.width;
final provider = Provider.of<CardProvider>(context); final provider = Provider.of<CardProvider>(context);
return Scaffold( return Container(
resizeToAvoidBottomInset: false, color: Color(0xFF141414),
backgroundColor: Color(0xFF141414), child: Container(
body: Container(
height: double.maxFinite, height: double.maxFinite,
child: Stack( child: Stack(
children: [ children: [
@ -38,9 +36,7 @@ class _SpotsWidgetState extends State<SpotsWidget> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: NetworkImage(provider.urlImages.isEmpty != true image: NetworkImage(MyApp().controller.currentUser.Spots.isEmpty? "https://i.imgur.com/Uovh293.png":MyApp().controller.currentUser.Spots.last.linkCover),
?provider.urlImages.last
:"https://i.imgur.com/Uovh293.png"),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
@ -50,11 +46,9 @@ class _SpotsWidgetState extends State<SpotsWidget> {
decoration: BoxDecoration(color: Colors.black.withOpacity(0.4)), decoration: BoxDecoration(color: Colors.black.withOpacity(0.4)),
),), ),),
),), ),),
Padding( Align(
padding: EdgeInsets.fromLTRB(0, 0, 0,height*0.03),
child: Align(
alignment: FractionalOffset.bottomCenter, alignment: FractionalOffset.bottomCenter,
child: OpenContainer( child: MyApp().controller.currentUser.Spots.isEmpty? Container():OpenContainer(
closedColor: Colors.transparent, closedColor: Colors.transparent,
closedElevation: 0, closedElevation: 0,
@ -67,7 +61,6 @@ class _SpotsWidgetState extends State<SpotsWidget> {
}, },
), ),
), ),
),
Center( Center(
child: Container( child: Container(
width: 300, width: 300,
@ -78,14 +71,15 @@ class _SpotsWidgetState extends State<SpotsWidget> {
Positioned( Positioned(
top: height*0.68, top: height*0.68,
width: width, width: width,
child: Row( child: MyApp().controller.currentUser.Spots.isEmpty? Container():Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
final provider = Provider.of<CardProvider>(context, listen: false); final provider = Provider.of<CardProvider>(context, listen: false);
provider.dislike(); provider.dislike();
}, },
child: Image.asset( child: Image.asset(
'assets/images/bouton_dislike.png', 'assets/images/bouton_dislike.png',
@ -94,9 +88,6 @@ class _SpotsWidgetState extends State<SpotsWidget> {
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
SizedBox(
width: width*0.1,
),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
final provider = Provider.of<CardProvider>(context, listen: false); final provider = Provider.of<CardProvider>(context, listen: false);
@ -109,13 +100,22 @@ class _SpotsWidgetState extends State<SpotsWidget> {
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
SizedBox( GestureDetector(
width: width*0.1, onTap: () {
final provider = Provider.of<CardProvider>(context, listen: false);
provider.message(this.context);
},
child: Image.asset(
'assets/images/bouton_messages.png',
height: 70,
width: 70,
fit: BoxFit.cover,
),
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
final provider = Provider.of<CardProvider>(context, listen: false); final provider = Provider.of<CardProvider>(context, listen: false);
provider.like(); provider.like(this.context);
}, },
child: Image.asset( child: Image.asset(
'assets/images/bouton_like.png', 'assets/images/bouton_like.png',
@ -141,7 +141,7 @@ class _SpotsWidgetState extends State<SpotsWidget> {
IgnorePointer(child: Container(height: 200, IgnorePointer(child: Container(height: 200,
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: gradiant.LinearGradient( gradient: gradiant.LinearGradient(
colors: [Colors.black, Colors.transparent], colors: [Colors.black.withOpacity(0.95),Colors.black.withOpacity(0.84),Colors.black.withOpacity(0.66),Colors.black.withOpacity(0.41),Colors.black.withOpacity(0)],
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
) )
@ -151,8 +151,9 @@ class _SpotsWidgetState extends State<SpotsWidget> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text('COULEURS',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),), Text(MyApp().controller.currentUser.Spots.isEmpty? '':
Text('Khali',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200),), MyApp().controller.currentUser.Spots.last.name,style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text(MyApp().controller.currentUser.Spots.isEmpty? '': MyApp().controller.currentUser.Spots.last.artist,style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200),),
], ],
),), ),),
], ],
@ -163,18 +164,20 @@ class _SpotsWidgetState extends State<SpotsWidget> {
Widget buildCards() { Widget buildCards() {
final provider = Provider.of<CardProvider>(context); final provider = Provider.of<CardProvider>(context);
final urlImages = provider.urlImages; final urlImages = provider.spotsList;
return Stack( return Stack(
children: urlImages children: urlImages
.map((urlImage) => CardWidget( .map((urlImage) => CardWidget(
urlImage: urlImage, urlImage: urlImage.linkCover,
isFront: urlImages.last == urlImage, isFront: urlImages.last == urlImage,
)) ))
.toList(), .toList(),
); );
} }
} }
@ -666,7 +669,10 @@ class PreviewInfoWidget extends StatelessWidget{
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF24243A).withOpacity(0.40), color: Color(0xFF24243A).withOpacity(0.40),
border: Border.all(width: 0, color: Colors.grey.withOpacity(0)), border: Border.all(width: 0, color: Colors.grey.withOpacity(0)),
borderRadius: BorderRadius.all(Radius.circular(15)), borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

@ -1,9 +1,7 @@
import 'dart:ui'; import 'dart:ui';
import 'package:dafl_project_flutter/persistence/database_saver.dart'; import 'package:dafl_project_flutter/model/user.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';
import '../../../controller/controller.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../sign_up/p_sign_up.dart'; import '../sign_up/p_sign_up.dart';
@ -16,13 +14,11 @@ class SignInPage extends StatefulWidget {
class _SignInPageState extends State<SignInPage> { class _SignInPageState extends State<SignInPage> {
var boxColor = Colors.white; var boxColor = Colors.white;
Controller ctrl = Controller();
TextEditingController password = new TextEditingController();
TextEditingController username = new TextEditingController();
@override @override
bool isChecked = false; bool isChecked = false;
final userNameTextField = TextEditingController();
final passwordTextField = TextEditingController();
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
@ -75,7 +71,7 @@ class _SignInPageState extends State<SignInPage> {
), ),
Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: username, controller: userNameTextField,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
), ),
@ -119,7 +115,8 @@ class _SignInPageState extends State<SignInPage> {
),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: password, controller: passwordTextField,
obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
), ),
@ -173,23 +170,15 @@ class _SignInPageState extends State<SignInPage> {
highlightColor: Colors.grey.shade100, highlightColor: Colors.grey.shade100,
splashColor: Color(0xFF406DE1), splashColor: Color(0xFF406DE1),
onTap: (){ onTap: (){
checkInformations(userNameTextField.text, passwordTextField.text);
ctrl.load(username.text, password.text);
Navigator.of(context).push(
PageTransition(
type: PageTransitionType.fade,
childCurrent: widget,
child: Splash()),
);
}, },
child:Ink( child:Ink(
child: Align( child: Align(
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Icon(
'assets/images/valid_logo.png', Icons.check,
width: 40, color: Color(0xFF406DE1),
size: 60.0,
), ),
), ),
padding: EdgeInsets.fromLTRB(0, 10, 0, 0), padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
@ -233,18 +222,37 @@ class _SignInPageState extends State<SignInPage> {
SizedBox(height: 60,), SizedBox(height: 60,),
], ],
), ),
Align(
alignment: Alignment.topRight,
child: Container(
padding: EdgeInsets.fromLTRB(0, 20, 20, 0),
child: Text("v1.0",
style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.5) ,fontSize: 17, fontWeight: FontWeight.w700),
),
)
),
], ],
), ),
); );
} }
void checkInformations(String username,String password) async{
if(username ==""){
Notify(2, context);
}
else if(password ==""){
Notify(4, context);
}
else{
await MyApp().controller.load(userNameTextField.text, passwordTextField.text);
if(MyApp().controller.currentUser.usernameDafl != ""){
Navigator.of(context).push(
PageTransition(
type: PageTransitionType.fade,
childCurrent: widget,
child: Splash()),
);
}
else{
Notify(2, context);
}
}
}
} }

@ -1,16 +1,11 @@
import 'package:dafl_project_flutter/controller/controller.dart'; import 'package:dafl_project_flutter/main.dart';
import 'package:dafl_project_flutter/persistence/loader.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';
import '../../../persistence/saver.dart'; import 'package:rive/rive.dart' as riv;
import '../../../model/user.dart';
import '../home/p_home.dart'; import '../home/p_home.dart';
import '../sign_in/p_sign_in.dart'; import '../sign_in/p_sign_in.dart';
import '../../../persistence/database_saver.dart';
import '../../../persistence/database_loader.dart';
import '../../../controller/controller.dart'; import '../../../controller/controller.dart';
import '../../../model/user.dart';
class SignUpPage extends StatefulWidget { class SignUpPage extends StatefulWidget {
const SignUpPage({Key? key}) : super(key: key); const SignUpPage({Key? key}) : super(key: key);
@ -20,18 +15,14 @@ class SignUpPage extends StatefulWidget {
} }
class _SignUpPageState extends State<SignUpPage> { class _SignUpPageState extends State<SignUpPage> {
final Controller ctrl = Controller();
Color boxColor = Colors.white; Color boxColor = Colors.white;
bool isHovering = false; bool isHovering = false;
@override @override
TextEditingController passwordconfirm = new TextEditingController();
//Text field that entered the username of the user
TextEditingController username = new TextEditingController();
bool isChecked = false; bool isChecked = false;
final userNameTextField = TextEditingController();
final passwordTextField = TextEditingController();
final passwordConfirmTextField = TextEditingController();
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
@ -84,7 +75,7 @@ class _SignUpPageState extends State<SignUpPage> {
), ),
Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: username, controller: userNameTextField,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
), ),
@ -128,6 +119,8 @@ class _SignUpPageState extends State<SignUpPage> {
),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: passwordTextField,
obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
), ),
@ -171,7 +164,8 @@ class _SignUpPageState extends State<SignUpPage> {
),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: passwordconfirm, obscureText: true,
controller: passwordConfirmTextField,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
), ),
@ -245,26 +239,16 @@ class _SignUpPageState extends State<SignUpPage> {
highlightColor: Colors.grey.shade100, highlightColor: Colors.grey.shade100,
splashColor: Color(0xFF406DE1), splashColor: Color(0xFF406DE1),
onTap: (){ onTap: (){
ctrl.save(User(username.text, passwordconfirm.text)); checkInformations(userNameTextField.text, passwordTextField.text, passwordConfirmTextField.text);
setState(() {
boxColor = Colors.blue;
});
Navigator.of(context).push(
PageTransition(
duration: Duration(milliseconds: 300),
reverseDuration: Duration(milliseconds: 300),
type: PageTransitionType.leftToRightJoined,
childCurrent: widget,
child: HomePage()),
);
}, },
child:Ink( child:Ink(
child: Align( child: Align(
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Icon(
'assets/images/valid_logo.png', Icons.check,
width: 47, color: Color(0xFF406DE1),
size: 60.0,
), ),
), ),
padding: EdgeInsets.fromLTRB(0, 10, 0, 0), padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
@ -290,7 +274,7 @@ class _SignUpPageState extends State<SignUpPage> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('Tu nas déjà un compte?', style: TextStyle(color: Colors.white, fontWeight: FontWeight.normal, fontSize: 17)), Text('Tu as déjà un compte ?', style: TextStyle(color: Colors.white, fontWeight: FontWeight.normal, fontSize: 17)),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).push( Navigator.of(context).push(
@ -308,18 +292,42 @@ class _SignUpPageState extends State<SignUpPage> {
SizedBox(height: 60,), SizedBox(height: 60,),
], ],
), ),
Align(
alignment: Alignment.topRight,
child: Container(
padding: EdgeInsets.fromLTRB(0, 20, 20, 0),
child: Text("v1.0",
style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.5) ,fontSize: 17, fontWeight: FontWeight.w700),
),
)
),
], ],
), ),
); );
} }
Future<void> checkInformations(String username, String password, String confirmPassword) async {
if(username == ""){
Notify(2, context);
}
else if(! await MyApp().controller.searchByUsername(username)){
Notify(0, context);
}
if(password == "" || confirmPassword == ""){
Notify(4, context);
}
else if(password.length <8){
Notify(3, context);
}
else if(password != confirmPassword){
Notify(1, context);
}
else{
MyApp().controller.save(User(username, password));
Navigator.of(context).push(
PageTransition(
duration: Duration(milliseconds: 300),
reverseDuration: Duration(milliseconds: 300),
type: PageTransitionType.leftToRightJoined,
childCurrent: widget,
child: HomePage()),);
}
}
} }

@ -0,0 +1,11 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=C:\src\flutter
FLUTTER_APPLICATION_PATH=C:\Users\delan\AndroidStudioProjects\dafl_musicv3\Sources\dafl_project_flutter
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=.dart_tool/package_config.json

@ -0,0 +1,12 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\src\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\delan\AndroidStudioProjects\dafl_musicv3\Sources\dafl_project_flutter"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"

@ -14,7 +14,7 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.3.4" version: "3.3.2"
args: args:
dependency: transitive dependency: transitive
description: description:
@ -152,7 +152,7 @@ packages:
name: flutter_native_splash name: flutter_native_splash
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.14" version: "2.2.11"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -177,62 +177,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.1.1" version: "8.1.1"
font_awesome_flutter:
dependency: "direct main"
description:
name: font_awesome_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "10.2.1"
geolocator:
dependency: "direct main"
description:
name: geolocator
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.2"
geolocator_android:
dependency: transitive
description:
name: geolocator_android
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.4"
geolocator_apple:
dependency: transitive
description:
name: geolocator_apple
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
geolocator_platform_interface:
dependency: transitive
description:
name: geolocator_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.7"
geolocator_web:
dependency: transitive
description:
name: geolocator_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.6"
geolocator_windows:
dependency: transitive
description:
name: geolocator_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
name: graphs name: graphs
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.0" version: "2.1.0"
html: html:
dependency: transitive dependency: transitive
description: description:
@ -241,7 +192,7 @@ packages:
source: hosted source: hosted
version: "0.15.1" version: "0.15.1"
http: http:
dependency: "direct main" dependency: transitive
description: description:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
@ -281,7 +232,7 @@ packages:
name: lints name: lints
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.0"
logging: logging:
dependency: transitive dependency: transitive
description: description:
@ -393,7 +344,7 @@ packages:
name: petitparser name: petitparser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.1.0" version: "5.0.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -408,13 +359,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
pointycastle:
dependency: transitive
description:
name: pointycastle
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.2"
postgresql2: postgresql2:
dependency: "direct main" dependency: "direct main"
description: description:
@ -531,7 +475,7 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.1" version: "3.0.1"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:

@ -45,9 +45,6 @@ dependencies:
vibration: ^1.7.6 vibration: ^1.7.6
postgresql2: ^1.0.3 postgresql2: ^1.0.3
path_provider: ^2.0.11 path_provider: ^2.0.11
font_awesome_flutter: ^10.2.1
geolocator: ^9.0.2
http: ^0.13.5
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -69,7 +66,7 @@ flutter_native_splash:
color: "#141414" color: "#141414"
#background_image: "assets/images/background_blur.png" #background_image: "assets/images/background_blur.png"
image: "assets/images/icon_App.png" image: "assets/images/Logo_launcher_2.png"
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
@ -77,10 +74,9 @@ flutter_native_splash:
# The following section is specific to Flutter packages. # The following section is specific to Flutter packages.
flutter_icons: flutter_icons:
image_path_android: "assets/images/icon_App.png"
image_path_ios: "assets/images/icon_App.png"
android: true android: true
ios: true ios: true
image_path: "assets/images/Logo_launcher_2.png"
flutter: flutter:
@ -93,6 +89,7 @@ flutter:
assets: assets:
- assets/images/ - assets/images/
- assets/fonts/ - assets/fonts/
- assets/
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware # https://flutter.dev/assets-and-images/#resolution-aware

@ -10,6 +10,6 @@ Future<void> main() async {
DatabaseConnexion d = DatabaseConnexion(); DatabaseConnexion d = DatabaseConnexion();
d.initConnexion(); DatabaseConnexion.initConnexion();
} }
Loading…
Cancel
Save