diff --git a/Sources/dafl_project_flutter/lib/controller/controller.dart b/Sources/dafl_project_flutter/lib/controller/controller.dart index d327d1d..0d69754 100644 --- a/Sources/dafl_project_flutter/lib/controller/controller.dart +++ b/Sources/dafl_project_flutter/lib/controller/controller.dart @@ -8,12 +8,21 @@ import '../model/user.dart'; import '../persistence/searcher.dart'; class Controller { + static Controller? _this; + static Saver saver = DatabaseSaver(); static Loader loader = DatabaseLoader(); - static final Searcher _searcher = DatabaseSearcher(); + static Searcher _searcher = DatabaseSearcher(); User currentUser = User("", ""); + factory Controller() { + if (_this == null) _this = Controller._(); + return _this!; + } + + Controller._(); + void save(User userToSave) { saver.save(userToSave); } @@ -27,17 +36,22 @@ class Controller { } void changeCurrentUser(User user) { - currentUser = user; + this.currentUser = user; } - void changeUsernameCourant(String newName){ - if(newName !=null){ + void changeUsernameCourant(String newName) { + if (newName != null) { this.currentUser.usernameDafl = newName; } } - void changePasswordCourant(String newPass){ - if(newPass !=null){ + + void changePasswordCourant(String newPass) { + if (newPass != null) { this.currentUser.passwDafl = newPass; } } + + Future searchByUsername(String username) async { + return await _searcher.searchByUsername(username); + } } diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart index 0a99a88..5b2e195 100644 --- a/Sources/dafl_project_flutter/lib/main.dart +++ b/Sources/dafl_project_flutter/lib/main.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:io'; import 'package:fluttertoast/fluttertoast.dart'; -import 'package:vibration/vibration.dart'; import 'dart:math'; import './views/pages/home/p_home.dart'; import './views/pages/main/p_main.dart'; @@ -10,9 +9,6 @@ import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'package:rive/rive.dart' as riv; import '../controller/controller.dart'; -import 'package:home_indicator/home_indicator.dart'; -import '../model/music.dart'; -import 'model/music.dart'; import 'model/spot.dart'; import 'model/user.dart'; import 'api/api.dart'; @@ -163,33 +159,32 @@ class CardProvider extends ChangeNotifier { dev.log("discovery"); _angle = 0; _position -= Offset(0, -_screenSize.height); - _discovery_card(); + _discoveryCard(); dev.log("discovery"); - if(MyApp.controller.currentUser.Discovery.contains(MyApp().controller.currentUser.Spots2.last.music)){ - MyApp.controller.currentUser.Discovery.remove(MyApp().controller.currentUser.Spots2.last.music); + if (MyApp.controller.currentUser.discovery + .contains(MyApp.controller.currentUser.spots.last.music)) { + MyApp.controller.currentUser.discovery + .remove(MyApp.controller.currentUser.spots.last.music); Fluttertoast.showToast( - msg: 'Supprimer', - toastLength: Toast.LENGTH_SHORT, - gravity: ToastGravity.TOP, - timeInSecForIosWeb: 2, - backgroundColor: Colors.red, - textColor: Colors.white - ); - } - else{ - if(MyApp.controller.currentUser.Spots2.last != null){ - MyApp.controller.currentUser.addDiscovery(MyApp().controller.currentUser.Spots2.last.music); + 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.music); Fluttertoast.showToast( msg: 'Ajouté', toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.TOP, timeInSecForIosWeb: 2, backgroundColor: Colors.deepPurple, - textColor: Colors.white - ); + textColor: Colors.white); notifyListeners(); } - } } @@ -208,14 +203,16 @@ class CardProvider extends ChangeNotifier { maxWidth: 600, maxHeight: double.infinity, ), - builder: (context) => buildSheet(context),); + builder: (context) => buildSheet(context), + ); notifyListeners(); } - Widget buildSheet(context){ + + Widget buildSheet(context) { final messageTextField = TextEditingController(); return SingleChildScrollView( padding: - EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), child: Container( height: 500, width: 380, @@ -235,7 +232,7 @@ class CardProvider extends ChangeNotifier { offset: const Offset(0.0, 0.0), blurRadius: 0.0, spreadRadius: 0.0, - ),//BoxShadow//BoxShadow + ), //BoxShadow//BoxShadow ], color: Color(0xFF232123), borderRadius: BorderRadius.only( @@ -247,7 +244,6 @@ class CardProvider extends ChangeNotifier { padding: EdgeInsets.fromLTRB(20, 10, 20, 10), child: Column( children: [ - Container( height: 5, width: 130, @@ -256,7 +252,9 @@ class CardProvider extends ChangeNotifier { color: Color(0xFF8A8A8A), ), ), - SizedBox(height: 30,), + SizedBox( + height: 30, + ), Container( width: double.infinity, height: 300, @@ -270,7 +268,11 @@ class CardProvider extends ChangeNotifier { keyboardAppearance: Brightness.dark, controller: messageTextField, maxLength: 300, - style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white.withOpacity(1), + fontSize: 17, + fontWeight: FontWeight.w200), expands: true, maxLines: null, textInputAction: TextInputAction.send, @@ -284,29 +286,34 @@ class CardProvider extends ChangeNotifier { ), ), ), - SizedBox(height: 20,), + SizedBox( + height: 20, + ), SizedBox( width: double.infinity, height: 70, child: ElevatedButton( onPressed: () { - sendMessage(messageTextField.text, MyApp().controller.currentUser.Spots2.last.user); + sendMessage(messageTextField.text, + MyApp.controller.currentUser.spots.last.user); }, style: ElevatedButton.styleFrom( primary: Color(0xFF3F1DC3), - textStyle: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold), + textStyle: + TextStyle(fontSize: 20, fontWeight: FontWeight.bold), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(17) - ), + borderRadius: BorderRadius.circular(17)), ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Text("Envoyer"), - Opacity(opacity: 0.2, - child: Image.asset("assets/images/send_logo.png",),) + Opacity( + opacity: 0.2, + child: Image.asset( + "assets/images/send_logo.png", + ), + ) ], ), ), @@ -314,7 +321,6 @@ class CardProvider extends ChangeNotifier { ], ), ), - ), ); } @@ -394,7 +400,8 @@ class _SplashState extends State { ); } } -Object Notify(int index, context, {bool isError = true}){ + +Object notify(int index, context, {bool isError = true}) { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; String message; @@ -440,7 +447,7 @@ Object Notify(int index, context, {bool isError = true}){ clipBehavior: Clip.none, children: [ Container( - padding: EdgeInsets.fromLTRB(20,height/110,20,0), + padding: EdgeInsets.fromLTRB(20, height / 110, 20, 0), height: 90, child: Row( children: [ @@ -448,23 +455,33 @@ Object Notify(int index, context, {bool isError = true}){ height: 48, width: 48, ), - Expanded(child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("Ho ho !", style: TextStyle( fontWeight: FontWeight.bold),), - Text(message,style: TextStyle( - ), - overflow: TextOverflow.ellipsis, - maxLines: 2,), - ], - ),), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Ho ho !", + style: TextStyle(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), + gradient: LinearGradient( + colors: [Color(0xFF81052a), Color(0xFF810548)], + begin: Alignment.topLeft, + end: Alignment.bottomRight), borderRadius: BorderRadius.all(Radius.circular(20)), boxShadow: [ BoxShadow( @@ -512,7 +529,7 @@ Object Notify(int index, context, {bool isError = true}){ clipBehavior: Clip.none, children: [ Container( - padding: EdgeInsets.fromLTRB(20,height/110,20,0), + padding: EdgeInsets.fromLTRB(20, height / 110, 20, 0), height: 90, decoration: BoxDecoration( image: const DecorationImage( diff --git a/Sources/dafl_project_flutter/lib/views/pages/home/p_home.dart b/Sources/dafl_project_flutter/lib/views/pages/home/p_home.dart index bf51259..54cace6 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/home/p_home.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/home/p_home.dart @@ -39,71 +39,73 @@ class _HomePageState extends State { height: height * 0.04, ), SizedBox( - height: 55, - width: width * 0.75, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xFF24CF5F), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15.0), - ), // background// foreground - ), - onPressed: () {}, - child: const Text( - "CONTINUER AVEC SPOTIFY", - style: TextStyle( - color: Colors.white, - fontSize: 17, - fontWeight: FontWeight.bold), - textAlign: TextAlign.center, - ), - ), - onPressed: () { - Navigator.of(context).push(PageTransition( - duration: Duration(milliseconds: 300), - reverseDuration: Duration(milliseconds: 300), - type: PageTransitionType.rightToLeftJoined, - childCurrent: widget, - child: SignUpPage()), + height: 55, + width: width * 0.75, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF24CF5F), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ) // background// foreground + ), + onPressed: () { + Navigator.of(context).push( + PageTransition( + duration: const Duration(milliseconds: 300), + reverseDuration: + const Duration(milliseconds: 300), + type: PageTransitionType.rightToLeftJoined, + childCurrent: widget, + child: const SignUpPage()), + ); + }, + child: const Text( + "S’INSCRIRE MAINTENANT", + style: TextStyle( + color: Colors.white, + fontSize: 17, + fontWeight: FontWeight.bold, + fontFamily: "DMSans"), + textAlign: TextAlign.center, + ), + )), + const Spacer(), + GestureDetector( + onTap: () { + Navigator.of(context).push( + PageTransition( + duration: const Duration(milliseconds: 300), + reverseDuration: const Duration(milliseconds: 300), + type: PageTransitionType.rightToLeftJoined, + childCurrent: widget, + child: const SignInPage()), ); }, - child: Text("S’INSCRIRE MAINTENANT", - style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold,fontFamily: "DMSans"), - textAlign: TextAlign.center, - ), - ),), - Spacer(), - GestureDetector( - onTap: (){ - Navigator.of(context).push( - PageTransition( - duration: Duration(milliseconds: 300), - reverseDuration: Duration(milliseconds: 300), - type: PageTransitionType.rightToLeftJoined, - childCurrent: widget, - child: SignInPage()), - ); - }, - child: Container( - child: Align( - alignment: Alignment.center, - child: Text("SE CONNECTER", - style: TextStyle(color: Colors.white ,fontFamily: "DMSans",fontSize: 17, fontWeight: FontWeight.bold), - textAlign: TextAlign.center, + child: Container( + margin: const EdgeInsets.fromLTRB(0, 0, 0, 0), + width: double.infinity, + height: 80, + decoration: const BoxDecoration( + color: Color(0xFF232123), + border: Border( + top: BorderSide(width: 1.5, color: Color(0xFF3C3C3C)), + ), // Set rounded corner radius + ), + child: const Align( + alignment: Alignment.center, + child: Text( + "SE CONNECTER", + style: TextStyle( + color: Colors.white, + fontFamily: "DMSans", + fontSize: 17, + fontWeight: FontWeight.bold), + textAlign: TextAlign.center, + ), ), ), - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - width: double.infinity, - height: 80, - decoration: BoxDecoration( - color: Color(0xFF232123), - border: Border( - top: BorderSide(width: 1.5, color: Color(0xFF3C3C3C)), - ),// Set rounded corner radius - - ), - ), - )), + ) + ]), ], ), ); diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart b/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart index 4f8efc0..371ecaf 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart @@ -6,7 +6,6 @@ import 'package:flutter/cupertino.dart'; import 'package:dafl_project_flutter/model/message.dart'; - class ConversationPage extends StatefulWidget { const ConversationPage({Key? key}) : super(key: key); @@ -15,22 +14,21 @@ class ConversationPage extends StatefulWidget { } class _ConversationPageState extends State { - - User destinataire = new User("test1", '1234'); - List messages= []; + List messages = []; bool isNull = true; final messageTextField = TextEditingController(); - - void SendMessage(String content){ + void SendMessage(String content) { setState(() { - messages.add(MessageWidget(Message(MyApp().controller.currentUser,content))); + messages + .add(MessageWidget(Message(MyApp.controller.currentUser, content))); }); } + Widget MessageWidget(Message message) { - if(message.sender != MyApp().controller.currentUser){ + if (message.sender != MyApp.controller.currentUser) { return Align( alignment: Alignment.centerLeft, child: Container( @@ -42,18 +40,23 @@ class _ConversationPageState extends State { topRight: Radius.circular(20), bottomLeft: Radius.circular(20), ), - border: Border.all(width: 1.5, - color: Color(0xFF9C9C9C).withOpacity(0.3)), + 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.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400), + child: Text( + message.content, + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white, + fontSize: 15, + fontWeight: FontWeight.w400), )), ), ); - } - else{ + } else { return Align( alignment: Alignment.centerRight, child: Container( @@ -69,17 +72,22 @@ class _ConversationPageState extends State { ), child: Padding( padding: EdgeInsets.all(15), - child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),), - ),), + child: Text( + message.content, + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white, + fontSize: 15, + fontWeight: FontWeight.w400), + ), + ), + ), ); } - - } @override void initState() { - super.initState(); messageTextField.addListener(_checkIfNull); print("INITSATE"); @@ -91,13 +99,12 @@ class _ConversationPageState extends State { super.dispose(); } - void _checkIfNull(){ - if(messageTextField.text.length > 0){ + void _checkIfNull() { + if (messageTextField.text.length > 0) { setState(() { isNull = false; }); - } - else{ + } else { setState(() { isNull = true; }); @@ -110,7 +117,6 @@ class _ConversationPageState extends State { double width = MediaQuery.of(context).size.width; ScrollController listScrollController = ScrollController(); - return Scaffold( extendBodyBehindAppBar: true, resizeToAvoidBottomInset: true, @@ -130,12 +136,14 @@ class _ConversationPageState extends State { color: Colors.blue, ), ), - SizedBox(width: 20,), + SizedBox( + width: 20, + ), Text("Max"), Spacer(), - IconButton( - splashColor: Colors.grey.withOpacity(0.2), - splashRadius: 30, + IconButton( + splashColor: Colors.grey.withOpacity(0.2), + splashRadius: 30, onPressed: () { showModalBottomSheet( isDismissible: true, @@ -144,34 +152,34 @@ class _ConversationPageState extends State { backgroundColor: Colors.transparent, context: context, constraints: BoxConstraints( - maxWidth: 600, + maxWidth: 600, maxHeight: double.infinity, ), - builder: (context) => buildSheet(),); - + builder: (context) => buildSheet(), + ); }, - icon: Icon(Icons.report_problem, color: Colors.grey.withOpacity(0.3),size: 25,), + icon: Icon( + Icons.report_problem, + color: Colors.grey.withOpacity(0.3), + size: 25, + ), ), - ], ), ), ), body: SingleChildScrollView( - child: - Container( - color: Color(0xFF141414), - height: height*0.92, - width: double.infinity, - child: ListView.builder( + child: Container( + color: Color(0xFF141414), + height: height * 0.92, + width: double.infinity, + child: ListView.builder( controller: listScrollController, - physics: BouncingScrollPhysics(), - itemCount: messages.length, - itemBuilder: (context, index) { - return messages[index]; - }) - - ), + physics: BouncingScrollPhysics(), + itemCount: messages.length, + itemBuilder: (context, index) { + return messages[index]; + })), ), bottomSheet: BottomAppBar( color: Color(0xFF141414), @@ -180,9 +188,9 @@ class _ConversationPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - height: height*0.08, + height: height * 0.08, color: Colors.transparent, - width: width*0.9, + width: width * 0.9, child: Container( margin: EdgeInsets.fromLTRB(10, 10, 10, 10), decoration: BoxDecoration( @@ -192,7 +200,6 @@ class _ConversationPageState extends State { ), borderRadius: BorderRadius.circular(100), color: Color(0xFF141414), - ), child: Padding( padding: EdgeInsets.fromLTRB(15, 0, 15, 0), @@ -200,9 +207,10 @@ class _ConversationPageState extends State { controller: messageTextField, style: TextStyle(color: Colors.white), decoration: InputDecoration( - hintStyle: TextStyle(color: Colors.white.withOpacity(0.7)), - border: InputBorder.none, - hintText: "Votre message...", + hintStyle: + TextStyle(color: Colors.white.withOpacity(0.7)), + border: InputBorder.none, + hintText: "Votre message...", ), cursorColor: Colors.purple, textAlign: TextAlign.left, @@ -211,58 +219,55 @@ class _ConversationPageState extends State { ), ), GestureDetector( - onTap: isNull? - null: - () { - - SendMessage(messageTextField.text); - if (listScrollController.hasClients) { - final position = listScrollController.position.maxScrollExtent; - listScrollController.jumpTo(position); - } - messageTextField.clear(); - - }, - child: isNull == true? - Container( - height: 1, - width: 1, - ): - Container( - width: 40, - height: 40, - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - gradient: LinearGradient( - colors: [Color(0xff8e24a1), Color(0xff8163ff)], - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ) - - - ), - child: Transform.rotate(angle: -300, - child: Icon(Icons.arrow_back, size: 26, color: Colors.white,),) - ), + onTap: isNull + ? null + : () { + SendMessage(messageTextField.text); + if (listScrollController.hasClients) { + final position = + listScrollController.position.maxScrollExtent; + listScrollController.jumpTo(position); + } + messageTextField.clear(); + }, + child: isNull == true + ? Container( + height: 1, + width: 1, + ) + : Container( + width: 40, + height: 40, + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + gradient: LinearGradient( + colors: [Color(0xff8e24a1), Color(0xff8163ff)], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + )), + child: Transform.rotate( + angle: -300, + child: Icon( + Icons.arrow_back, + size: 26, + color: Colors.white, + ), + )), ) ], ), ), ); - - - - } - Widget buildSheet(){ + Widget buildSheet() { String dropdownValue = list.first; final messageTextField = TextEditingController(); return SingleChildScrollView( padding: - EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), - child:Container( + EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + child: Container( height: 500, width: double.infinity, decoration: BoxDecoration( @@ -281,7 +286,7 @@ class _ConversationPageState extends State { offset: const Offset(0.0, 0.0), blurRadius: 0.0, spreadRadius: 0.0, - ),//BoxShadow//BoxShadow + ), //BoxShadow//BoxShadow ], color: Color(0xFF232123), borderRadius: BorderRadius.only( @@ -294,7 +299,6 @@ class _ConversationPageState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container( height: 5, width: 130, @@ -303,8 +307,16 @@ class _ConversationPageState extends State { color: Color(0xFF8A8A8A), ), ), - Padding(padding: EdgeInsets.fromLTRB(0, 20, 0, 20), - child: Text('Signaler', style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.w500),),), + Padding( + padding: EdgeInsets.fromLTRB(0, 20, 0, 20), + child: Text( + 'Signaler', + style: TextStyle( + color: Colors.white, + fontSize: 20, + fontWeight: FontWeight.w500), + ), + ), Container( padding: EdgeInsets.fromLTRB(20, 10, 20, 10), width: double.infinity, @@ -314,12 +326,20 @@ class _ConversationPageState extends State { ), child: Column( children: [ - Text('Vous êtes sur le point de signaler cet utilisateur. Veuillez renseigner le motif du signalement.', style: TextStyle(color: Colors.grey), textAlign: TextAlign.center,), - Padding(padding: EdgeInsets.fromLTRB(0, 20, 0, 10), - child: DropdownButtonReason(),), + Text( + 'Vous êtes sur le point de signaler cet utilisateur. Veuillez renseigner le motif du signalement.', + style: TextStyle(color: Colors.grey), + textAlign: TextAlign.center, + ), + Padding( + padding: EdgeInsets.fromLTRB(0, 20, 0, 10), + child: DropdownButtonReason(), + ), ], - ),), - Padding(padding: EdgeInsets.fromLTRB(0, 20, 0, 20), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(0, 20, 0, 20), child: Column( children: [ Container( @@ -331,9 +351,12 @@ class _ConversationPageState extends State { ), child: TextField( keyboardAppearance: Brightness.dark, - onTap: (){ - }, - style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), + onTap: () {}, + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white.withOpacity(1), + fontSize: 17, + fontWeight: FontWeight.w200), maxLines: 3, textInputAction: TextInputAction.done, decoration: InputDecoration( @@ -344,44 +367,49 @@ class _ConversationPageState extends State { ), border: InputBorder.none, ), - ),), + ), + ), ], )), Spacer(), - Padding(padding: EdgeInsets.fromLTRB(0, 0, 0, 50), + Padding( + padding: EdgeInsets.fromLTRB(0, 0, 0, 50), child: SizedBox( width: double.infinity, height: 70, child: ElevatedButton( - onPressed: () { - }, + onPressed: () {}, style: ElevatedButton.styleFrom( primary: Colors.red, - textStyle: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold), + textStyle: + TextStyle(fontSize: 20, fontWeight: FontWeight.bold), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(17) - ), + borderRadius: BorderRadius.circular(17)), ), child: Stack( children: [ Positioned( top: -10, right: 0, - child: Icon(Icons.report,size: 100,color: Colors.white.withOpacity(0.2),)), - Center(child: Text("Envoyer le signalement"),), + child: Icon( + Icons.report, + size: 100, + color: Colors.white.withOpacity(0.2), + )), + Center( + child: Text("Envoyer le signalement"), + ), ], ), ), - ),), + ), + ), ], ), ), - - ) ,); - - } + ), + ); + } } class DropdownButtonReason extends StatefulWidget { @@ -391,7 +419,12 @@ class DropdownButtonReason extends StatefulWidget { State createState() => _DropdownButtonReasonState(); } -const List list = ['Insulte', 'Racisme', 'Messages inappropriés', "Usurpation d'identité"]; +const List list = [ + 'Insulte', + 'Racisme', + 'Messages inappropriés', + "Usurpation d'identité" +]; class _DropdownButtonReasonState extends State { String dropdownValue = list.first; @@ -401,7 +434,10 @@ class _DropdownButtonReasonState extends State { return DropdownButton( dropdownColor: Colors.grey.shade900.withOpacity(1), value: dropdownValue, - icon: const Icon(Icons.arrow_downward, color: Colors.grey,), + icon: const Icon( + Icons.arrow_downward, + color: Colors.grey, + ), elevation: 16, style: const TextStyle(color: Colors.white), underline: Container( diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart index 891f090..1267b24 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart @@ -90,64 +90,93 @@ class _DiscoveryListState extends State { @override Widget build(BuildContext context) { - return RefreshIndicator(child: ListView.builder( - itemCount: MyApp().controller.currentUser.Discovery.length, - itemBuilder: (context, index){ - int itemCount = MyApp().controller.currentUser.Discovery.length; - 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), - padding: EdgeInsets.fromLTRB(30, 0, 30, 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( - border: Border.all(width: 0, color: Colors.grey.withOpacity(0)), - borderRadius: BorderRadius.all(Radius.circular(10)), - ), - child: Container( - child: FadeInImage.assetNetwork(placeholder: "assets/images/loadingPlaceholder.gif", image: MyApp().controller.currentUser.Discovery[reversedIndex].linkCover), - ),), - Container( - margin: EdgeInsets.fromLTRB(20, 0, 0, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(MyApp().controller.currentUser.Discovery[reversedIndex].name,style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),), - Text(MyApp().controller.currentUser.Discovery[reversedIndex].artist,style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),), - - ], - ),), - ], - ), - ), - - - ], - ) - - ), 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,); + return RefreshIndicator( + child: ListView.builder( + itemCount: MyApp.controller.currentUser.discovery.length, + itemBuilder: (context, index) { + int itemCount = MyApp.controller.currentUser.discovery.length; + 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), + padding: EdgeInsets.fromLTRB(30, 0, 30, 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( + border: Border.all( + width: 0, + color: Colors.grey.withOpacity(0)), + borderRadius: + BorderRadius.all(Radius.circular(10)), + ), + child: Container( + child: FadeInImage.assetNetwork( + placeholder: + "assets/images/loadingPlaceholder.gif", + image: MyApp.controller.currentUser + .discovery[reversedIndex].linkCover), + ), + ), + Container( + margin: EdgeInsets.fromLTRB(20, 0, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + MyApp.controller.currentUser + .discovery[reversedIndex].name, + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white.withOpacity(1), + fontSize: 20, + fontWeight: FontWeight.w800), + ), + Text( + MyApp.controller.currentUser + .discovery[reversedIndex].artist, + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white.withOpacity(0.6), + fontSize: 16, + fontWeight: FontWeight.w400), + ), + ], + ), + ), + ], + ), + ), + ], + )), + 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, + ); } } diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_messages.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_messages.dart index 86975a4..8a4f617 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_messages.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_messages.dart @@ -12,31 +12,27 @@ class MessagesWidget extends StatefulWidget { class _MessagesWidgetState extends State { int indexSectedButton = 0; - Widget currentList = const ListConfirmedWidget(); - + Widget currentList = ListConfirmedWidget(); var colorConfirm = Color(0xFFFFFFFF); var colorWaiting = Color(0xFFA8A8A8); - void changeSelected(int num){ - if(indexSectedButton == num){ + + void changeSelected(int num) { + if (indexSectedButton == num) { return; - } - else{ - if(num == 0){ - setState((){ + } else { + if (num == 0) { + setState(() { colorConfirm = Color(0xFFFFFFFF); colorWaiting = Color(0xFFA8A8A8); - listeActuelle = ListConfirmedWidget(); + currentList = ListConfirmedWidget(); indexSectedButton = num; }); - - - } - else{ - setState((){ + } else { + setState(() { colorConfirm = Color(0xFFA8A8A8); colorWaiting = Color(0xFFFFFFFF); - listeActuelle = ListWaitingWidget(); + currentList = ListWaitingWidget(); indexSectedButton = num; }); } @@ -49,8 +45,8 @@ class _MessagesWidgetState extends State { double width = MediaQuery.of(context).size.width; return Container( color: Color(0xFF141414), - - child: Padding(padding: EdgeInsets.fromLTRB(30, 50, 30, 0), + child: Padding( + padding: EdgeInsets.fromLTRB(30, 50, 30, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -58,68 +54,85 @@ class _MessagesWidgetState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Messages', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500, fontSize: 25)), + 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),), + 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 + 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, + ), ), - onPressed: () { - changeSelected(1); - }, - child: Text("En attente", - 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, - - + child: currentList, ), ], - ),), + ), + ), ); } } -class MessagesButtonWidget extends StatelessWidget{ +class MessagesButtonWidget extends StatelessWidget { @override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; @@ -138,14 +151,17 @@ class MessagesButtonWidget extends StatelessWidget{ width: 60, decoration: BoxDecoration( image: DecorationImage( - image: NetworkImage('https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'), + 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(30)), - ),), + ), + ), Container( - width: width-160, + width: width - 160, margin: EdgeInsets.fromLTRB(20, 0, 20, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -155,33 +171,49 @@ class MessagesButtonWidget extends StatelessWidget{ 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( + '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é une musique.',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),), - + Text( + 'A envoyé une musique.', + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white.withOpacity(0.6), + fontSize: 16, + fontWeight: FontWeight.w400), + ), ], - ),), + ), + ), ], ), ), - - ], - ) - ); - + )); } } -class ListConfirmedWidget extends StatelessWidget{ +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: [ MessagesButtonWidget(), MessagesButtonWidget(), @@ -192,13 +224,12 @@ class ListConfirmedWidget extends StatelessWidget{ } } -class ListWaitingWidget extends StatelessWidget{ +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: [ GestureDetector( onTap: () { @@ -211,9 +242,7 @@ class ListWaitingWidget extends StatelessWidget{ }, child: MessagesButtonWidget(), ), - ], ); - } } diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart index 668622d..83f27f7 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart @@ -25,12 +25,12 @@ class MainPageProfil extends StatefulWidget { } class _MainPageProfilState extends State { + String? username = MyApp.controller.currentUser.usernameDafl; - String? username = MyApp().controller.currentUser.usernameDafl; @override void initState() { super.initState(); - String username = MyApp().controller.currentUser.usernameDafl ?? "default"; + String username = MyApp.controller.currentUser.usernameDafl ?? "default"; } @override @@ -48,13 +48,12 @@ class _MainPageProfilState extends State { Container( width: double.infinity, margin: const EdgeInsets.fromLTRB(30, 50, 0, 0), - child: const Text( - "Profil", - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.w600, - color: Colors.white), fontFamily: "DMSans") - ), + child: const Text("Profil", + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.w600, + color: Colors.white, + fontFamily: "DMSans")), ), Container( margin: const EdgeInsets.fromLTRB(0, 10, 0, 10), @@ -74,14 +73,22 @@ class _MainPageProfilState extends State { ], ), child: Center( - child: Text(username![0], - style: TextStyle(color: Colors.white ,fontSize: 60, fontWeight: FontWeight.w500), + child: Text( + username![0], + style: TextStyle( + color: Colors.white, + fontSize: 60, + fontWeight: FontWeight.w500), textAlign: TextAlign.center, ), ), ), - Text(username!, - style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.w400), + Text( + username!, + style: TextStyle( + color: Colors.white, + fontSize: 17, + fontWeight: FontWeight.w400), textAlign: TextAlign.center, ), Container( @@ -284,9 +291,14 @@ class _MainPageProfilState extends State { ), // background// foreground ), onPressed: () { - Navigator.push(context,MaterialPageRoute(builder: (context)=> SettingsWidget())).then((value) => setState(() { - username = MyApp.controller.currentUser.usernameDafl!; - })); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SettingsWidget())) + .then((value) => setState(() { + username = + MyApp.controller.currentUser.usernameDafl!; + })); }, child: Row( children: [ @@ -322,4 +334,3 @@ class _MainPageProfilState extends State { ); } } - diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_settings.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_settings.dart index 7f4d9d9..7c3cbc8 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_settings.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_settings.dart @@ -10,8 +10,11 @@ class SettingsWidget extends StatefulWidget { } class _SettingsWidgetState extends State { - final userNameTextField = TextEditingController(text: MyApp().controller.currentUser.usernameDafl); - final passwordTextField = TextEditingController(text: MyApp().controller.currentUser.passwDafl); + final userNameTextField = + TextEditingController(text: MyApp.controller.currentUser.usernameDafl); + final passwordTextField = + TextEditingController(text: MyApp.controller.currentUser.passwDafl); + @override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; diff --git a/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart b/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart index fff3d33..5264a36 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart @@ -1,9 +1,6 @@ import 'package:flutter/material.dart'; import 'package:page_transition/page_transition.dart'; import '../../../main.dart'; -import '../../../model/music.dart'; -import '../../../model/spot.dart'; -import '../../../model/user.dart'; import '../sign_up/p_sign_up.dart'; class SignInPage extends StatefulWidget { @@ -15,11 +12,12 @@ class SignInPage extends StatefulWidget { class _SignInPageState extends State { var boxColor = Colors.white; + + @override bool isChecked = false; final userNameTextField = TextEditingController(); final passwordTextField = TextEditingController(); - @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, @@ -57,49 +55,49 @@ class _SignInPageState extends State { height: 10, ), Container( - width: 500, - padding: EdgeInsets.fromLTRB(45, 0, 45, 0), - child: Stack( - children: [ - Container( - height: 43, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(50)), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.3), - spreadRadius: 5, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], + width: 500, + padding: const EdgeInsets.fromLTRB(45, 0, 45, 0), + child: Stack( + children: [ + Container( + height: 43, + decoration: BoxDecoration( + color: Colors.white, + 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 + ), + ], + ), ), - ), - Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), - child: TextField( - keyboardAppearance: Brightness.dark, - controller: userNameTextField, - decoration: InputDecoration( - border: InputBorder.none, + Padding( + padding: const EdgeInsets.fromLTRB(50, 0, 20, 0), + child: TextField( + controller: userNameTextField, + decoration: const InputDecoration( + border: InputBorder.none, + ), + cursorColor: Colors.purple, + textAlign: TextAlign.left, ), - cursorColor: Colors.purple, - textAlign: TextAlign.left, ), - ), - Container( - margin: EdgeInsets.fromLTRB(15, 12, 0, 0), - child: Image.asset( - 'assets/images/profil_logo.png', - height: 16, - width: 16, - fit: BoxFit.cover, + Container( + margin: const EdgeInsets.fromLTRB(15, 12, 0, 0), + child: Image.asset( + 'assets/images/profil_logo.png', + height: 16, + width: 16, + fit: BoxFit.cover, + ), ), - ), - ], - ) - ), + ], + )), Container( width: 500, padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), @@ -125,7 +123,6 @@ class _SignInPageState extends State { Padding( padding: const EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( - keyboardAppearance: Brightness.dark, controller: passwordTextField, obscureText: true, decoration: const InputDecoration( @@ -149,7 +146,7 @@ class _SignInPageState extends State { const SizedBox( height: 10, ), - SizedBox( + Container( width: double.infinity, child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -190,6 +187,14 @@ class _SignInPageState extends State { userNameTextField.text, passwordTextField.text); }, child: Ink( + child: const Align( + alignment: Alignment.center, + child: Icon( + Icons.check, + color: Color(0xFF406DE1), + size: 60.0, + ), + ), padding: const EdgeInsets.fromLTRB(0, 10, 0, 0), width: 83, height: 83, @@ -205,14 +210,6 @@ class _SignInPageState extends State { ), ], ), - child: const Align( - alignment: Alignment.center, - child: Icon( - Icons.check, - color: Color(0xFF406DE1), - size: 60.0, - ), - ), ), ), ), @@ -257,51 +254,25 @@ class _SignInPageState extends State { ); } - void checkInformations(String username, String password) { + void checkInformations(String username, String password) async { if (username == "") { notify(2, context); } else if (password == "") { notify(4, context); } else { - //MyApp().controller.load(userNameTextField.text, passwordTextField.text); - MyApp.controller.currentUser = - User(userNameTextField.text, passwordTextField.text); - MyApp.controller.currentUser.spots = [ - Spot( - User('Félix', '1234'), - Music('Couleurs', 'Khali', - 'https://khaligidilit.com/assets/images/cover-LAI%CC%88LA-Khali.jpeg')), - Spot( - User('Audric', '1234'), - Music("J'suis PNL", 'PNL', - 'https://m.media-amazon.com/images/I/61aUOMzwS8L._SL1440_.jpg')), - Spot( - User('Dorian', '1234'), - Music('Sundance', 'Nepal', - 'https://pbs.twimg.com/media/ExJ-My-XMAE3Ko2.jpg')), - Spot( - User('Lucas', '1234'), - Music('Eternelle 2', 'So La Lune', - 'https://cdns-images.dzcdn.net/images/cover/2818a661c6d533155ce6dffc256b1f51/500x500.jpg')), - Spot( - User('David', '1234'), - Music('M.I.L.S 3', 'Ninho', - 'https://cdns-images.dzcdn.net/images/cover/b351f0e935c9c3901f8d893b92ab952a/500x500.jpg')), - Spot( - User('Hugo', '1234'), - Music('Deux frères', 'PNL', - 'https://cdns-images.dzcdn.net/images/cover/65147b581f2ace9e0f0723ee76e70fda/500x500.jpg')), - Spot( - User('Alban', '1234'), - Music('Paradis', 'Sopico', - 'https://cdns-images.dzcdn.net/images/cover/17a9747927ac3e5ea56f92f635d9180c/500x500.jpg')), - ].reversed.toList(); - Navigator.of(context).push( - PageTransition( - type: PageTransitionType.fade, - childCurrent: widget, - child: const Splash()), - ); + await MyApp.controller + .load(userNameTextField.text, passwordTextField.text); + + if (MyApp.controller.currentUser.usernameDafl != "") { + Navigator.of(context).push( + PageTransition( + type: PageTransitionType.fade, + childCurrent: widget, + child: const Splash()), + ); + } else { + notify(2, context); + } } } } diff --git a/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart b/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart index 59dfa48..4a362c7 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart @@ -36,132 +36,137 @@ class _SignUpPageState extends State { fit: BoxFit.cover, ), Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - - Image.asset( - 'assets/images/Logo.png', - width: 250, - ), - SizedBox(height: 45,), - Text( - "S'INSCRIRE", - style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 23, fontWeight: FontWeight.w700), - textAlign: TextAlign.center, - ), - SizedBox(height: 10,), - Container( - width: 500, - padding: EdgeInsets.fromLTRB(45, 0, 45, 0), - child: Stack( - children: [ - Container( - height: 43, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(50)), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.3), - spreadRadius: 5, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - ), - Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), - child: TextField( - keyboardAppearance: Brightness.dark, - controller: userNameTextField, - decoration: InputDecoration( - border: InputBorder.none, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Image.asset( + 'assets/images/Logo.png', + width: 250, + ), + SizedBox( + height: 45, + ), + Text( + "S'INSCRIRE", + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white, + fontSize: 23, + fontWeight: FontWeight.w700), + textAlign: TextAlign.center, + ), + SizedBox( + height: 10, + ), + Container( + width: 500, + padding: EdgeInsets.fromLTRB(45, 0, 45, 0), + child: Stack( + children: [ + Container( + height: 43, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(50)), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.3), + spreadRadius: 5, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], ), - cursorColor: Colors.purple, - textAlign: TextAlign.left, ), - ), - Container( - margin: EdgeInsets.fromLTRB(15, 12, 0, 0), - child: Image.asset( - 'assets/images/profil_logo.png', - height: 16, - width: 16, - fit: BoxFit.cover, - ), - ), - ], - ) - ), - Container( - width: 500, - padding: EdgeInsets.fromLTRB(45, 10, 45, 0), - child: Stack( - children: [ - Container( - height: 43, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(50)), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.3), - spreadRadius: 5, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow + Padding( + padding: EdgeInsets.fromLTRB(50, 0, 20, 0), + child: TextField( + keyboardAppearance: Brightness.dark, + controller: userNameTextField, + decoration: InputDecoration( + border: InputBorder.none, ), - ], - + cursorColor: Colors.purple, + textAlign: TextAlign.left, + ), ), - - ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), - child: TextField( - keyboardAppearance: Brightness.dark, - controller: passwordTextField, - obscureText: true, - decoration: InputDecoration( - border: InputBorder.none, + Container( + margin: EdgeInsets.fromLTRB(15, 12, 0, 0), + child: Image.asset( + 'assets/images/profil_logo.png', + height: 16, + width: 16, + fit: BoxFit.cover, ), - cursorColor: Colors.purple, - textAlign: TextAlign.left, ), - ), - Container( - margin: EdgeInsets.fromLTRB(15, 12, 0, 0), - child: Image.asset( - 'assets/images/password_logo.png', - height: 16, - width: 16, - fit: BoxFit.cover, + ], + )), + Container( + width: 500, + padding: EdgeInsets.fromLTRB(45, 10, 45, 0), + child: Stack( + children: [ + Container( + height: 43, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(50)), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.3), + spreadRadius: 5, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + ), ), - ), - ], - ) - ), - Container( - width: 500, - padding: EdgeInsets.fromLTRB(45, 10, 45, 0), - child: Stack( - children: [ - Container( - height: 43, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(50)), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.3), - spreadRadius: 5, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow + Padding( + padding: EdgeInsets.fromLTRB(50, 0, 20, 0), + child: TextField( + keyboardAppearance: Brightness.dark, + controller: passwordTextField, + obscureText: true, + decoration: InputDecoration( + border: InputBorder.none, ), - ], - + cursorColor: Colors.purple, + textAlign: TextAlign.left, + ), + ), + Container( + margin: EdgeInsets.fromLTRB(15, 12, 0, 0), + child: Image.asset( + 'assets/images/password_logo.png', + height: 16, + width: 16, + fit: BoxFit.cover, + ), ), + ], + )), + Container( + width: 500, + padding: EdgeInsets.fromLTRB(45, 10, 45, 0), + child: Stack( + children: [ + Container( + height: 43, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.all(Radius.circular(50)), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.3), + spreadRadius: 5, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ])), Padding( padding: const EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 95db087..b309a65 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -56,6 +56,7 @@ flutter: assets: - assets/images/ - assets/fonts/ + - assets/ fonts: - family: DMSans