Merge branche Lucas et master.
continuous-integration/drone/push Build is passing Details

messagerie_lucas_test
Félix MIELCAREK 2 years ago
parent fe281b9ea2
commit 069cbe873d

@ -8,12 +8,21 @@ import '../model/user.dart';
import '../persistence/searcher.dart'; import '../persistence/searcher.dart';
class Controller { class Controller {
static Controller? _this;
static Saver saver = DatabaseSaver(); static Saver saver = DatabaseSaver();
static Loader loader = DatabaseLoader(); static Loader loader = DatabaseLoader();
static final Searcher _searcher = DatabaseSearcher(); static Searcher _searcher = DatabaseSearcher();
User currentUser = User("", ""); User currentUser = User("", "");
factory Controller() {
if (_this == null) _this = Controller._();
return _this!;
}
Controller._();
void save(User userToSave) { void save(User userToSave) {
saver.save(userToSave); saver.save(userToSave);
} }
@ -27,17 +36,22 @@ class Controller {
} }
void changeCurrentUser(User user) { void changeCurrentUser(User user) {
currentUser = user; this.currentUser = user;
} }
void changeUsernameCourant(String newName){ void changeUsernameCourant(String newName) {
if(newName !=null){ if (newName != null) {
this.currentUser.usernameDafl = newName; this.currentUser.usernameDafl = newName;
} }
} }
void changePasswordCourant(String newPass){
if(newPass !=null){ void changePasswordCourant(String newPass) {
if (newPass != null) {
this.currentUser.passwDafl = newPass; this.currentUser.passwDafl = newPass;
} }
} }
Future<bool> searchByUsername(String username) async {
return await _searcher.searchByUsername(username);
}
} }

@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.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';
@ -10,9 +9,6 @@ import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rive/rive.dart' as riv; import 'package:rive/rive.dart' as riv;
import '../controller/controller.dart'; import '../controller/controller.dart';
import 'package:home_indicator/home_indicator.dart';
import '../model/music.dart';
import 'model/music.dart';
import 'model/spot.dart'; import 'model/spot.dart';
import 'model/user.dart'; import 'model/user.dart';
import 'api/api.dart'; import 'api/api.dart';
@ -163,33 +159,32 @@ class CardProvider extends ChangeNotifier {
dev.log("discovery"); dev.log("discovery");
_angle = 0; _angle = 0;
_position -= Offset(0, -_screenSize.height); _position -= Offset(0, -_screenSize.height);
_discovery_card(); _discoveryCard();
dev.log("discovery"); dev.log("discovery");
if(MyApp.controller.currentUser.Discovery.contains(MyApp().controller.currentUser.Spots2.last.music)){ if (MyApp.controller.currentUser.discovery
MyApp.controller.currentUser.Discovery.remove(MyApp().controller.currentUser.Spots2.last.music); .contains(MyApp.controller.currentUser.spots.last.music)) {
MyApp.controller.currentUser.discovery
.remove(MyApp.controller.currentUser.spots.last.music);
Fluttertoast.showToast( Fluttertoast.showToast(
msg: 'Supprimer', msg: 'Supprimer',
toastLength: Toast.LENGTH_SHORT, toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.TOP, gravity: ToastGravity.TOP,
timeInSecForIosWeb: 2, timeInSecForIosWeb: 2,
backgroundColor: Colors.red, backgroundColor: Colors.red,
textColor: Colors.white textColor: Colors.white);
); } else {
} if (MyApp.controller.currentUser.spots.last != null) {
else{ MyApp.controller.currentUser
if(MyApp.controller.currentUser.Spots2.last != null){ .addDiscovery(MyApp.controller.currentUser.spots.last.music);
MyApp.controller.currentUser.addDiscovery(MyApp().controller.currentUser.Spots2.last.music);
Fluttertoast.showToast( Fluttertoast.showToast(
msg: 'Ajouté', msg: 'Ajouté',
toastLength: Toast.LENGTH_SHORT, toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.TOP, gravity: ToastGravity.TOP,
timeInSecForIosWeb: 2, timeInSecForIosWeb: 2,
backgroundColor: Colors.deepPurple, backgroundColor: Colors.deepPurple,
textColor: Colors.white textColor: Colors.white);
);
notifyListeners(); notifyListeners();
} }
} }
} }
@ -208,14 +203,16 @@ class CardProvider extends ChangeNotifier {
maxWidth: 600, maxWidth: 600,
maxHeight: double.infinity, maxHeight: double.infinity,
), ),
builder: (context) => buildSheet(context),); builder: (context) => buildSheet(context),
);
notifyListeners(); notifyListeners();
} }
Widget buildSheet(context){
Widget buildSheet(context) {
final messageTextField = TextEditingController(); final messageTextField = TextEditingController();
return SingleChildScrollView( return SingleChildScrollView(
padding: padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container( child: Container(
height: 500, height: 500,
width: 380, width: 380,
@ -235,7 +232,7 @@ class CardProvider extends ChangeNotifier {
offset: const Offset(0.0, 0.0), offset: const Offset(0.0, 0.0),
blurRadius: 0.0, blurRadius: 0.0,
spreadRadius: 0.0, spreadRadius: 0.0,
),//BoxShadow//BoxShadow ), //BoxShadow//BoxShadow
], ],
color: Color(0xFF232123), color: Color(0xFF232123),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -247,7 +244,6 @@ class CardProvider extends ChangeNotifier {
padding: EdgeInsets.fromLTRB(20, 10, 20, 10), padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
child: Column( child: Column(
children: [ children: [
Container( Container(
height: 5, height: 5,
width: 130, width: 130,
@ -256,7 +252,9 @@ class CardProvider extends ChangeNotifier {
color: Color(0xFF8A8A8A), color: Color(0xFF8A8A8A),
), ),
), ),
SizedBox(height: 30,), SizedBox(
height: 30,
),
Container( Container(
width: double.infinity, width: double.infinity,
height: 300, height: 300,
@ -270,7 +268,11 @@ class CardProvider extends ChangeNotifier {
keyboardAppearance: Brightness.dark, keyboardAppearance: Brightness.dark,
controller: messageTextField, controller: messageTextField,
maxLength: 300, 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, expands: true,
maxLines: null, maxLines: null,
textInputAction: TextInputAction.send, textInputAction: TextInputAction.send,
@ -284,29 +286,34 @@ class CardProvider extends ChangeNotifier {
), ),
), ),
), ),
SizedBox(height: 20,), SizedBox(
height: 20,
),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 70, height: 70,
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
sendMessage(messageTextField.text, MyApp().controller.currentUser.Spots2.last.user); sendMessage(messageTextField.text,
MyApp.controller.currentUser.spots.last.user);
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: Color(0xFF3F1DC3), primary: Color(0xFF3F1DC3),
textStyle: TextStyle( textStyle:
fontSize: 20, TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
fontWeight: FontWeight.bold),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(17) borderRadius: BorderRadius.circular(17)),
),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Text("Envoyer"), Text("Envoyer"),
Opacity(opacity: 0.2, Opacity(
child: Image.asset("assets/images/send_logo.png",),) 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<Splash> {
); );
} }
} }
Object Notify(int index, context, {bool isError = true}){
Object notify(int index, context, {bool isError = true}) {
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;
String message; String message;
@ -440,7 +447,7 @@ Object Notify(int index, context, {bool isError = true}){
clipBehavior: Clip.none, clipBehavior: Clip.none,
children: [ children: [
Container( Container(
padding: EdgeInsets.fromLTRB(20,height/110,20,0), padding: EdgeInsets.fromLTRB(20, height / 110, 20, 0),
height: 90, height: 90,
child: Row( child: Row(
children: [ children: [
@ -448,23 +455,33 @@ Object Notify(int index, context, {bool isError = true}){
height: 48, height: 48,
width: 48, width: 48,
), ),
Expanded(child: Column( Expanded(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Text("Ho ho !", style: TextStyle( fontWeight: FontWeight.bold),), children: [
Text(message,style: TextStyle( Text(
), "Ho ho !",
overflow: TextOverflow.ellipsis, style: TextStyle(fontWeight: FontWeight.bold),
maxLines: 2,), ),
], Text(
),), message,
style: TextStyle(),
overflow: TextOverflow.ellipsis,
maxLines: 2,
),
],
),
),
], ],
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage("assets/images/backgroundNotify.png"), image: AssetImage("assets/images/backgroundNotify.png"),
fit: BoxFit.cover), 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)), borderRadius: BorderRadius.all(Radius.circular(20)),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
@ -512,7 +529,7 @@ Object Notify(int index, context, {bool isError = true}){
clipBehavior: Clip.none, clipBehavior: Clip.none,
children: [ children: [
Container( Container(
padding: EdgeInsets.fromLTRB(20,height/110,20,0), padding: EdgeInsets.fromLTRB(20, height / 110, 20, 0),
height: 90, height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
image: const DecorationImage( image: const DecorationImage(

@ -39,71 +39,73 @@ class _HomePageState extends State<HomePage> {
height: height * 0.04, height: height * 0.04,
), ),
SizedBox( SizedBox(
height: 55, height: 55,
width: width * 0.75, width: width * 0.75,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF24CF5F), backgroundColor: const Color(0xFF24CF5F),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0), borderRadius: BorderRadius.circular(15.0),
), // background// foreground ) // background// foreground
), ),
onPressed: () {}, onPressed: () {
child: const Text( Navigator.of(context).push(
"CONTINUER AVEC SPOTIFY", PageTransition(
style: TextStyle( duration: const Duration(milliseconds: 300),
color: Colors.white, reverseDuration:
fontSize: 17, const Duration(milliseconds: 300),
fontWeight: FontWeight.bold), type: PageTransitionType.rightToLeftJoined,
textAlign: TextAlign.center, childCurrent: widget,
), child: const SignUpPage()),
), );
onPressed: () { },
Navigator.of(context).push(PageTransition( child: const Text(
duration: Duration(milliseconds: 300), "SINSCRIRE MAINTENANT",
reverseDuration: Duration(milliseconds: 300), style: TextStyle(
type: PageTransitionType.rightToLeftJoined, color: Colors.white,
childCurrent: widget, fontSize: 17,
child: SignUpPage()), 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("SINSCRIRE MAINTENANT", child: Container(
style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold,fontFamily: "DMSans"), margin: const EdgeInsets.fromLTRB(0, 0, 0, 0),
textAlign: TextAlign.center, width: double.infinity,
), height: 80,
),), decoration: const BoxDecoration(
Spacer(), color: Color(0xFF232123),
GestureDetector( border: Border(
onTap: (){ top: BorderSide(width: 1.5, color: Color(0xFF3C3C3C)),
Navigator.of(context).push( ), // Set rounded corner radius
PageTransition( ),
duration: Duration(milliseconds: 300), child: const Align(
reverseDuration: Duration(milliseconds: 300), alignment: Alignment.center,
type: PageTransitionType.rightToLeftJoined, child: Text(
childCurrent: widget, "SE CONNECTER",
child: SignInPage()), style: TextStyle(
); color: Colors.white,
}, fontFamily: "DMSans",
child: Container( fontSize: 17,
child: Align( fontWeight: FontWeight.bold),
alignment: Alignment.center, textAlign: TextAlign.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
),
),
)),
], ],
), ),
); );

@ -6,7 +6,6 @@ import 'package:flutter/cupertino.dart';
import 'package:dafl_project_flutter/model/message.dart'; import 'package:dafl_project_flutter/model/message.dart';
class ConversationPage extends StatefulWidget { class ConversationPage extends StatefulWidget {
const ConversationPage({Key? key}) : super(key: key); const ConversationPage({Key? key}) : super(key: key);
@ -15,22 +14,21 @@ class ConversationPage extends StatefulWidget {
} }
class _ConversationPageState extends State<ConversationPage> { class _ConversationPageState extends State<ConversationPage> {
User destinataire = new User("test1", '1234'); User destinataire = new User("test1", '1234');
List<Widget> messages= []; List<Widget> messages = [];
bool isNull = true; bool isNull = true;
final messageTextField = TextEditingController(); final messageTextField = TextEditingController();
void SendMessage(String content) {
void SendMessage(String content){
setState(() { setState(() {
messages.add(MessageWidget(Message(MyApp().controller.currentUser,content))); messages
.add(MessageWidget(Message(MyApp.controller.currentUser, content)));
}); });
} }
Widget MessageWidget(Message message) { Widget MessageWidget(Message message) {
if(message.sender != MyApp().controller.currentUser){ if (message.sender != MyApp.controller.currentUser) {
return Align( return Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Container( child: Container(
@ -42,18 +40,23 @@ class _ConversationPageState extends State<ConversationPage> {
topRight: Radius.circular(20), topRight: Radius.circular(20),
bottomLeft: Radius.circular(20), bottomLeft: Radius.circular(20),
), ),
border: Border.all(width: 1.5, border: Border.all(
color: Color(0xFF9C9C9C).withOpacity(0.3)), width: 1.5, color: Color(0xFF9C9C9C).withOpacity(0.3)),
color: Color(0xFF191919), color: Color(0xFF191919),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(15, 15, 15, 15), 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( return Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Container( child: Container(
@ -69,17 +72,22 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
child: Padding( child: Padding(
padding: EdgeInsets.all(15), 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 @override
void initState() { void initState() {
super.initState(); super.initState();
messageTextField.addListener(_checkIfNull); messageTextField.addListener(_checkIfNull);
print("INITSATE"); print("INITSATE");
@ -91,13 +99,12 @@ class _ConversationPageState extends State<ConversationPage> {
super.dispose(); super.dispose();
} }
void _checkIfNull(){ void _checkIfNull() {
if(messageTextField.text.length > 0){ if (messageTextField.text.length > 0) {
setState(() { setState(() {
isNull = false; isNull = false;
}); });
} } else {
else{
setState(() { setState(() {
isNull = true; isNull = true;
}); });
@ -110,7 +117,6 @@ class _ConversationPageState extends State<ConversationPage> {
double width = MediaQuery.of(context).size.width; double width = MediaQuery.of(context).size.width;
ScrollController listScrollController = ScrollController(); ScrollController listScrollController = ScrollController();
return Scaffold( return Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
@ -130,12 +136,14 @@ class _ConversationPageState extends State<ConversationPage> {
color: Colors.blue, color: Colors.blue,
), ),
), ),
SizedBox(width: 20,), SizedBox(
width: 20,
),
Text("Max"), Text("Max"),
Spacer(), Spacer(),
IconButton( IconButton(
splashColor: Colors.grey.withOpacity(0.2), splashColor: Colors.grey.withOpacity(0.2),
splashRadius: 30, splashRadius: 30,
onPressed: () { onPressed: () {
showModalBottomSheet( showModalBottomSheet(
isDismissible: true, isDismissible: true,
@ -144,34 +152,34 @@ class _ConversationPageState extends State<ConversationPage> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
context: context, context: context,
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: 600, maxWidth: 600,
maxHeight: double.infinity, 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( body: SingleChildScrollView(
child: child: Container(
Container( color: Color(0xFF141414),
color: Color(0xFF141414), height: height * 0.92,
height: height*0.92, width: double.infinity,
width: double.infinity, child: ListView.builder(
child: ListView.builder(
controller: listScrollController, controller: listScrollController,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemCount: messages.length, itemCount: messages.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return messages[index]; return messages[index];
}) })),
),
), ),
bottomSheet: BottomAppBar( bottomSheet: BottomAppBar(
color: Color(0xFF141414), color: Color(0xFF141414),
@ -180,9 +188,9 @@ class _ConversationPageState extends State<ConversationPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
height: height*0.08, height: height * 0.08,
color: Colors.transparent, color: Colors.transparent,
width: width*0.9, width: width * 0.9,
child: Container( child: Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10), margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -192,7 +200,6 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
color: Color(0xFF141414), color: Color(0xFF141414),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(15, 0, 15, 0), padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
@ -200,9 +207,10 @@ class _ConversationPageState extends State<ConversationPage> {
controller: messageTextField, controller: messageTextField,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: TextStyle(color: Colors.white.withOpacity(0.7)), hintStyle:
border: InputBorder.none, TextStyle(color: Colors.white.withOpacity(0.7)),
hintText: "Votre message...", border: InputBorder.none,
hintText: "Votre message...",
), ),
cursorColor: Colors.purple, cursorColor: Colors.purple,
textAlign: TextAlign.left, textAlign: TextAlign.left,
@ -211,58 +219,55 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
), ),
GestureDetector( GestureDetector(
onTap: isNull? onTap: isNull
null: ? null
() { : () {
SendMessage(messageTextField.text);
SendMessage(messageTextField.text); if (listScrollController.hasClients) {
if (listScrollController.hasClients) { final position =
final position = listScrollController.position.maxScrollExtent; listScrollController.position.maxScrollExtent;
listScrollController.jumpTo(position); listScrollController.jumpTo(position);
} }
messageTextField.clear(); messageTextField.clear();
},
}, child: isNull == true
child: isNull == true? ? Container(
Container( height: 1,
height: 1, width: 1,
width: 1, )
): : Container(
Container( width: 40,
width: 40, height: 40,
height: 40, margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
margin: EdgeInsets.fromLTRB(0, 0, 0, 0), decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(100),
borderRadius: BorderRadius.circular(100), gradient: LinearGradient(
gradient: LinearGradient( colors: [Color(0xff8e24a1), Color(0xff8163ff)],
colors: [Color(0xff8e24a1), Color(0xff8163ff)], begin: Alignment.topLeft,
begin: Alignment.topLeft, end: Alignment.bottomRight,
end: Alignment.bottomRight, )),
) child: Transform.rotate(
angle: -300,
child: Icon(
), Icons.arrow_back,
child: Transform.rotate(angle: -300, size: 26,
child: Icon(Icons.arrow_back, size: 26, color: Colors.white,),) color: Colors.white,
), ),
)),
) )
], ],
), ),
), ),
); );
} }
Widget buildSheet(){ Widget buildSheet() {
String dropdownValue = list.first; String dropdownValue = list.first;
final messageTextField = TextEditingController(); final messageTextField = TextEditingController();
return SingleChildScrollView( return SingleChildScrollView(
padding: padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child:Container( child: Container(
height: 500, height: 500,
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -281,7 +286,7 @@ class _ConversationPageState extends State<ConversationPage> {
offset: const Offset(0.0, 0.0), offset: const Offset(0.0, 0.0),
blurRadius: 0.0, blurRadius: 0.0,
spreadRadius: 0.0, spreadRadius: 0.0,
),//BoxShadow//BoxShadow ), //BoxShadow//BoxShadow
], ],
color: Color(0xFF232123), color: Color(0xFF232123),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -294,7 +299,6 @@ class _ConversationPageState extends State<ConversationPage> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
height: 5, height: 5,
width: 130, width: 130,
@ -303,8 +307,16 @@ class _ConversationPageState extends State<ConversationPage> {
color: Color(0xFF8A8A8A), color: Color(0xFF8A8A8A),
), ),
), ),
Padding(padding: EdgeInsets.fromLTRB(0, 20, 0, 20), Padding(
child: Text('Signaler', style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.w500),),), padding: EdgeInsets.fromLTRB(0, 20, 0, 20),
child: Text(
'Signaler',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.w500),
),
),
Container( Container(
padding: EdgeInsets.fromLTRB(20, 10, 20, 10), padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
width: double.infinity, width: double.infinity,
@ -314,12 +326,20 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
child: Column( child: Column(
children: [ 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,), Text(
Padding(padding: EdgeInsets.fromLTRB(0, 20, 0, 10), 'Vous êtes sur le point de signaler cet utilisateur. Veuillez renseigner le motif du signalement.',
child: DropdownButtonReason(),), 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( child: Column(
children: [ children: [
Container( Container(
@ -331,9 +351,12 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
child: TextField( child: TextField(
keyboardAppearance: Brightness.dark, keyboardAppearance: Brightness.dark,
onTap: (){ onTap: () {},
}, style: TextStyle(
style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), fontFamily: 'DMSans',
color: Colors.white.withOpacity(1),
fontSize: 17,
fontWeight: FontWeight.w200),
maxLines: 3, maxLines: 3,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
decoration: InputDecoration( decoration: InputDecoration(
@ -344,44 +367,49 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
border: InputBorder.none, border: InputBorder.none,
), ),
),), ),
),
], ],
)), )),
Spacer(), Spacer(),
Padding(padding: EdgeInsets.fromLTRB(0, 0, 0, 50), Padding(
padding: EdgeInsets.fromLTRB(0, 0, 0, 50),
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: 70, height: 70,
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {},
},
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: Colors.red, primary: Colors.red,
textStyle: TextStyle( textStyle:
fontSize: 20, TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
fontWeight: FontWeight.bold),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(17) borderRadius: BorderRadius.circular(17)),
),
), ),
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
top: -10, top: -10,
right: 0, right: 0,
child: Icon(Icons.report,size: 100,color: Colors.white.withOpacity(0.2),)), child: Icon(
Center(child: Text("Envoyer le signalement"),), Icons.report,
size: 100,
color: Colors.white.withOpacity(0.2),
)),
Center(
child: Text("Envoyer le signalement"),
),
], ],
), ),
), ),
),), ),
),
], ],
), ),
), ),
),
) ,); );
}
}
} }
class DropdownButtonReason extends StatefulWidget { class DropdownButtonReason extends StatefulWidget {
@ -391,7 +419,12 @@ class DropdownButtonReason extends StatefulWidget {
State<DropdownButtonReason> createState() => _DropdownButtonReasonState(); State<DropdownButtonReason> createState() => _DropdownButtonReasonState();
} }
const List<String> list = <String>['Insulte', 'Racisme', 'Messages inappropriés', "Usurpation d'identité"]; const List<String> list = <String>[
'Insulte',
'Racisme',
'Messages inappropriés',
"Usurpation d'identité"
];
class _DropdownButtonReasonState extends State<DropdownButtonReason> { class _DropdownButtonReasonState extends State<DropdownButtonReason> {
String dropdownValue = list.first; String dropdownValue = list.first;
@ -401,7 +434,10 @@ class _DropdownButtonReasonState extends State<DropdownButtonReason> {
return DropdownButton<String>( return DropdownButton<String>(
dropdownColor: Colors.grey.shade900.withOpacity(1), dropdownColor: Colors.grey.shade900.withOpacity(1),
value: dropdownValue, value: dropdownValue,
icon: const Icon(Icons.arrow_downward, color: Colors.grey,), icon: const Icon(
Icons.arrow_downward,
color: Colors.grey,
),
elevation: 16, elevation: 16,
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
underline: Container( underline: Container(

@ -90,64 +90,93 @@ class _DiscoveryListState extends State<DiscoveryList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RefreshIndicator(child: ListView.builder( return RefreshIndicator(
itemCount: MyApp().controller.currentUser.Discovery.length, child: ListView.builder(
itemBuilder: (context, index){ itemCount: MyApp.controller.currentUser.discovery.length,
int itemCount = MyApp().controller.currentUser.Discovery.length; itemBuilder: (context, index) {
int reversedIndex = itemCount - 1 - index; int itemCount = MyApp.controller.currentUser.discovery.length;
return Dismissible( int reversedIndex = itemCount - 1 - index;
key: Key(MyApp().controller.currentUser.Discovery[reversedIndex].name), return Dismissible(
direction: DismissDirection.startToEnd, key: Key(
child: Container( MyApp.controller.currentUser.discovery[reversedIndex].name),
margin: EdgeInsets.fromLTRB(0, 10, 0, 0), direction: DismissDirection.startToEnd,
padding: EdgeInsets.fromLTRB(30, 0, 30, 0), child: Container(
child: Column( margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
children: [ padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
child: Column(
Container( children: [
margin: EdgeInsets.fromLTRB(0, 5, 0, 0), Container(
width: double.infinity, margin: EdgeInsets.fromLTRB(0, 5, 0, 0),
child: Row( width: double.infinity,
children: [ child: Row(
Container( children: [
height: 60, Container(
width: 60, height: 60,
decoration: BoxDecoration( width: 60,
border: Border.all(width: 0, color: Colors.grey.withOpacity(0)), decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)), border: Border.all(
), width: 0,
child: Container( color: Colors.grey.withOpacity(0)),
child: FadeInImage.assetNetwork(placeholder: "assets/images/loadingPlaceholder.gif", image: MyApp().controller.currentUser.Discovery[reversedIndex].linkCover), borderRadius:
),), BorderRadius.all(Radius.circular(10)),
Container( ),
margin: EdgeInsets.fromLTRB(20, 0, 0, 0), child: Container(
child: Column( child: FadeInImage.assetNetwork(
crossAxisAlignment: CrossAxisAlignment.start, placeholder:
mainAxisAlignment: MainAxisAlignment.center, "assets/images/loadingPlaceholder.gif",
children: [ image: MyApp.controller.currentUser
Text(MyApp().controller.currentUser.Discovery[reversedIndex].name,style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),), .discovery[reversedIndex].linkCover),
Text(MyApp().controller.currentUser.Discovery[reversedIndex].artist,style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),), ),
),
], 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(
), onDismissed: (direction) { fontFamily: 'DMSans',
if(direction == DismissDirection.startToEnd) color: Colors.white.withOpacity(1),
MyApp().controller.currentUser.Discovery.removeAt(reversedIndex); fontSize: 20,
}, fontWeight: FontWeight.w800),
background: Container(decoration: BoxDecoration( ),
image: DecorationImage(image: AssetImage("assets/images/delete_background.png"), fit: BoxFit.cover), Text(
)),); MyApp.controller.currentUser
} .discovery[reversedIndex].artist,
), onRefresh: () async { style: TextStyle(
refreshList(); fontFamily: 'DMSans',
}, key: refreshKey,); 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,
);
} }
} }

@ -12,31 +12,27 @@ class MessagesWidget extends StatefulWidget {
class _MessagesWidgetState extends State<MessagesWidget> { class _MessagesWidgetState extends State<MessagesWidget> {
int indexSectedButton = 0; int indexSectedButton = 0;
Widget currentList = const ListConfirmedWidget(); Widget currentList = ListConfirmedWidget();
var colorConfirm = Color(0xFFFFFFFF); var colorConfirm = Color(0xFFFFFFFF);
var colorWaiting = Color(0xFFA8A8A8); var colorWaiting = Color(0xFFA8A8A8);
void changeSelected(int num){
if(indexSectedButton == num){ void changeSelected(int num) {
if (indexSectedButton == num) {
return; return;
} } else {
else{ if (num == 0) {
if(num == 0){ setState(() {
setState((){
colorConfirm = Color(0xFFFFFFFF); colorConfirm = Color(0xFFFFFFFF);
colorWaiting = Color(0xFFA8A8A8); colorWaiting = Color(0xFFA8A8A8);
listeActuelle = ListConfirmedWidget(); currentList = ListConfirmedWidget();
indexSectedButton = num; indexSectedButton = num;
}); });
} else {
setState(() {
}
else{
setState((){
colorConfirm = Color(0xFFA8A8A8); colorConfirm = Color(0xFFA8A8A8);
colorWaiting = Color(0xFFFFFFFF); colorWaiting = Color(0xFFFFFFFF);
listeActuelle = ListWaitingWidget(); currentList = ListWaitingWidget();
indexSectedButton = num; indexSectedButton = num;
}); });
} }
@ -49,8 +45,8 @@ class _MessagesWidgetState extends State<MessagesWidget> {
double width = MediaQuery.of(context).size.width; double width = MediaQuery.of(context).size.width;
return Container( return Container(
color: Color(0xFF141414), color: Color(0xFF141414),
child: Padding(
child: Padding(padding: EdgeInsets.fromLTRB(30, 50, 30, 0), padding: EdgeInsets.fromLTRB(30, 50, 30, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -58,68 +54,85 @@ class _MessagesWidgetState extends State<MessagesWidget> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ 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)), 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(
padding: EdgeInsets.fromLTRB(0, height*0.01, 0, 0), padding: EdgeInsets.fromLTRB(0, height * 0.01, 0, 0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
SizedBox( SizedBox(
height: 35, height: 35,
width: width*0.35, width: width * 0.35,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: colorConfirm, backgroundColor: colorConfirm,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0), borderRadius: BorderRadius.circular(15.0),
),// background// foreground ), // background// foreground
), ),
onPressed: () { onPressed: () {
changeSelected(0); changeSelected(0);
}, },
child: Text("Validées", child: Text(
style: TextStyle(color: Colors.black ,fontSize: 17, fontWeight: FontWeight.bold), "Validées",
textAlign: TextAlign.center, style: TextStyle(
), color: Colors.black,
),), fontSize: 17,
SizedBox( fontWeight: FontWeight.bold),
height: 35, textAlign: TextAlign.center,
width: width*0.35, ),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: colorWaiting,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),// background// foreground
), ),
onPressed: () { ),
changeSelected(1); SizedBox(
}, height: 35,
child: Text("En attente", width: width * 0.35,
style: TextStyle(color: Colors.black ,fontSize: 17, fontWeight: FontWeight.bold), child: ElevatedButton(
textAlign: TextAlign.center, 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( Expanded(
child: child: currentList,
listeActuelle,
), ),
], ],
),), ),
),
); );
} }
} }
class MessagesButtonWidget extends StatelessWidget{ class MessagesButtonWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
@ -138,14 +151,17 @@ class MessagesButtonWidget extends StatelessWidget{
width: 60, width: 60,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( 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, 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)), borderRadius: BorderRadius.all(Radius.circular(30)),
),), ),
),
Container( Container(
width: width-160, width: width - 160,
margin: EdgeInsets.fromLTRB(20, 0, 20, 0), margin: EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -155,33 +171,49 @@ class MessagesButtonWidget extends StatelessWidget{
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('Max',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),), Text(
Text('1 jour(s)',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.8) ,fontSize: 15, fontWeight: FontWeight.w400),), '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 @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;
return ListView( return ListView(
children: [ children: [
MessagesButtonWidget(), MessagesButtonWidget(),
MessagesButtonWidget(), MessagesButtonWidget(),
@ -192,13 +224,12 @@ class ListConfirmedWidget extends StatelessWidget{
} }
} }
class ListWaitingWidget extends StatelessWidget{ class ListWaitingWidget extends StatelessWidget {
@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;
return ListView( return ListView(
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
@ -211,9 +242,7 @@ class ListWaitingWidget extends StatelessWidget{
}, },
child: MessagesButtonWidget(), child: MessagesButtonWidget(),
), ),
], ],
); );
} }
} }

@ -25,12 +25,12 @@ class MainPageProfil extends StatefulWidget {
} }
class _MainPageProfilState extends State<MainPageProfil> { class _MainPageProfilState extends State<MainPageProfil> {
String? username = MyApp.controller.currentUser.usernameDafl;
String? username = MyApp().controller.currentUser.usernameDafl;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
String username = MyApp().controller.currentUser.usernameDafl ?? "default"; String username = MyApp.controller.currentUser.usernameDafl ?? "default";
} }
@override @override
@ -48,13 +48,12 @@ class _MainPageProfilState extends State<MainPageProfil> {
Container( Container(
width: double.infinity, width: double.infinity,
margin: const EdgeInsets.fromLTRB(30, 50, 0, 0), margin: const EdgeInsets.fromLTRB(30, 50, 0, 0),
child: const Text( child: const Text("Profil",
"Profil", style: TextStyle(
style: TextStyle( fontSize: 25,
fontSize: 25, fontWeight: FontWeight.w600,
fontWeight: FontWeight.w600, color: Colors.white,
color: Colors.white), fontFamily: "DMSans") fontFamily: "DMSans")),
),
), ),
Container( Container(
margin: const EdgeInsets.fromLTRB(0, 10, 0, 10), margin: const EdgeInsets.fromLTRB(0, 10, 0, 10),
@ -74,14 +73,22 @@ class _MainPageProfilState extends State<MainPageProfil> {
], ],
), ),
child: Center( child: Center(
child: Text(username![0], child: Text(
style: TextStyle(color: Colors.white ,fontSize: 60, fontWeight: FontWeight.w500), username![0],
style: TextStyle(
color: Colors.white,
fontSize: 60,
fontWeight: FontWeight.w500),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
), ),
Text(username!, Text(
style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.w400), username!,
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
Container( Container(
@ -284,9 +291,14 @@ class _MainPageProfilState extends State<MainPageProfil> {
), // background// foreground ), // background// foreground
), ),
onPressed: () { onPressed: () {
Navigator.push(context,MaterialPageRoute(builder: (context)=> SettingsWidget())).then((value) => setState(() { Navigator.push(
username = MyApp.controller.currentUser.usernameDafl!; context,
})); MaterialPageRoute(
builder: (context) => SettingsWidget()))
.then((value) => setState(() {
username =
MyApp.controller.currentUser.usernameDafl!;
}));
}, },
child: Row( child: Row(
children: [ children: [
@ -322,4 +334,3 @@ class _MainPageProfilState extends State<MainPageProfil> {
); );
} }
} }

@ -10,8 +10,11 @@ class SettingsWidget extends StatefulWidget {
} }
class _SettingsWidgetState extends State<SettingsWidget> { class _SettingsWidgetState extends State<SettingsWidget> {
final userNameTextField = TextEditingController(text: MyApp().controller.currentUser.usernameDafl); final userNameTextField =
final passwordTextField = TextEditingController(text: MyApp().controller.currentUser.passwDafl); 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;

@ -1,9 +1,6 @@
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 '../../../main.dart'; import '../../../main.dart';
import '../../../model/music.dart';
import '../../../model/spot.dart';
import '../../../model/user.dart';
import '../sign_up/p_sign_up.dart'; import '../sign_up/p_sign_up.dart';
class SignInPage extends StatefulWidget { class SignInPage extends StatefulWidget {
@ -15,11 +12,12 @@ class SignInPage extends StatefulWidget {
class _SignInPageState extends State<SignInPage> { class _SignInPageState extends State<SignInPage> {
var boxColor = Colors.white; var boxColor = Colors.white;
@override
bool isChecked = false; bool isChecked = false;
final userNameTextField = TextEditingController(); final userNameTextField = TextEditingController();
final passwordTextField = TextEditingController(); final passwordTextField = TextEditingController();
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
@ -57,49 +55,49 @@ class _SignInPageState extends State<SignInPage> {
height: 10, height: 10,
), ),
Container( Container(
width: 500, width: 500,
padding: EdgeInsets.fromLTRB(45, 0, 45, 0), padding: const EdgeInsets.fromLTRB(45, 0, 45, 0),
child: Stack( child: Stack(
children: [ children: [
Container( Container(
height: 43, height: 43,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius:
Radius.circular(50)), const BorderRadius.all(Radius.circular(50)),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withOpacity(0.3), color: Colors.black.withOpacity(0.3),
spreadRadius: 5, spreadRadius: 5,
blurRadius: 7, blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow offset: const Offset(
), 0, 3), // changes position of shadow
], ),
],
),
), ),
), Padding(
Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), padding: const EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
keyboardAppearance: Brightness.dark, controller: userNameTextField,
controller: userNameTextField, decoration: const InputDecoration(
decoration: InputDecoration( border: InputBorder.none,
border: InputBorder.none, ),
cursorColor: Colors.purple,
textAlign: TextAlign.left,
), ),
cursorColor: Colors.purple,
textAlign: TextAlign.left,
), ),
), Container(
Container( margin: const EdgeInsets.fromLTRB(15, 12, 0, 0),
margin: EdgeInsets.fromLTRB(15, 12, 0, 0), child: Image.asset(
child: Image.asset( 'assets/images/profil_logo.png',
'assets/images/profil_logo.png', height: 16,
height: 16, width: 16,
width: 16, fit: BoxFit.cover,
fit: BoxFit.cover, ),
), ),
), ],
], )),
)
),
Container( Container(
width: 500, width: 500,
padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), padding: const EdgeInsets.fromLTRB(45, 10, 45, 0),
@ -125,7 +123,6 @@ class _SignInPageState extends State<SignInPage> {
Padding( Padding(
padding: const EdgeInsets.fromLTRB(50, 0, 20, 0), padding: const EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
keyboardAppearance: Brightness.dark,
controller: passwordTextField, controller: passwordTextField,
obscureText: true, obscureText: true,
decoration: const InputDecoration( decoration: const InputDecoration(
@ -149,7 +146,7 @@ class _SignInPageState extends State<SignInPage> {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
SizedBox( Container(
width: double.infinity, width: double.infinity,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -190,6 +187,14 @@ class _SignInPageState extends State<SignInPage> {
userNameTextField.text, passwordTextField.text); userNameTextField.text, passwordTextField.text);
}, },
child: Ink( 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), padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
width: 83, width: 83,
height: 83, height: 83,
@ -205,14 +210,6 @@ class _SignInPageState extends State<SignInPage> {
), ),
], ],
), ),
child: const Align(
alignment: Alignment.center,
child: Icon(
Icons.check,
color: Color(0xFF406DE1),
size: 60.0,
),
),
), ),
), ),
), ),
@ -257,51 +254,25 @@ class _SignInPageState extends State<SignInPage> {
); );
} }
void checkInformations(String username, String password) { void checkInformations(String username, String password) async {
if (username == "") { if (username == "") {
notify(2, context); notify(2, context);
} else if (password == "") { } else if (password == "") {
notify(4, context); notify(4, context);
} else { } else {
//MyApp().controller.load(userNameTextField.text, passwordTextField.text); await MyApp.controller
MyApp.controller.currentUser = .load(userNameTextField.text, passwordTextField.text);
User(userNameTextField.text, passwordTextField.text);
MyApp.controller.currentUser.spots = [ if (MyApp.controller.currentUser.usernameDafl != "") {
Spot( Navigator.of(context).push(
User('Félix', '1234'), PageTransition(
Music('Couleurs', 'Khali', type: PageTransitionType.fade,
'https://khaligidilit.com/assets/images/cover-LAI%CC%88LA-Khali.jpeg')), childCurrent: widget,
Spot( child: const Splash()),
User('Audric', '1234'), );
Music("J'suis PNL", 'PNL', } else {
'https://m.media-amazon.com/images/I/61aUOMzwS8L._SL1440_.jpg')), notify(2, context);
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()),
);
} }
} }
} }

@ -36,132 +36,137 @@ class _SignUpPageState extends State<SignUpPage> {
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Image.asset(
Image.asset( 'assets/images/Logo.png',
'assets/images/Logo.png', width: 250,
width: 250, ),
), SizedBox(
SizedBox(height: 45,), height: 45,
Text( ),
"S'INSCRIRE", Text(
style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 23, fontWeight: FontWeight.w700), "S'INSCRIRE",
textAlign: TextAlign.center, style: TextStyle(
), fontFamily: 'DMSans',
SizedBox(height: 10,), color: Colors.white,
Container( fontSize: 23,
width: 500, fontWeight: FontWeight.w700),
padding: EdgeInsets.fromLTRB(45, 0, 45, 0), textAlign: TextAlign.center,
child: Stack( ),
children: [ SizedBox(
Container( height: 10,
height: 43, ),
decoration: BoxDecoration( Container(
color: Colors.white, width: 500,
borderRadius: BorderRadius.all( padding: EdgeInsets.fromLTRB(45, 0, 45, 0),
Radius.circular(50)), child: Stack(
boxShadow: [ children: [
BoxShadow( Container(
color: Colors.black.withOpacity(0.3), height: 43,
spreadRadius: 5, decoration: BoxDecoration(
blurRadius: 7, color: Colors.white,
offset: Offset(0, 3), // changes position of shadow borderRadius: BorderRadius.all(Radius.circular(50)),
), boxShadow: [
], BoxShadow(
), color: Colors.black.withOpacity(0.3),
), spreadRadius: 5,
Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), blurRadius: 7,
child: TextField( offset:
keyboardAppearance: Brightness.dark, Offset(0, 3), // changes position of shadow
controller: userNameTextField, ),
decoration: InputDecoration( ],
border: InputBorder.none,
), ),
cursorColor: Colors.purple,
textAlign: TextAlign.left,
), ),
), Padding(
Container( padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
margin: EdgeInsets.fromLTRB(15, 12, 0, 0), child: TextField(
child: Image.asset( keyboardAppearance: Brightness.dark,
'assets/images/profil_logo.png', controller: userNameTextField,
height: 16, decoration: InputDecoration(
width: 16, border: InputBorder.none,
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
), ),
], cursorColor: Colors.purple,
textAlign: TextAlign.left,
),
), ),
Container(
),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), margin: EdgeInsets.fromLTRB(15, 12, 0, 0),
child: TextField( child: Image.asset(
keyboardAppearance: Brightness.dark, 'assets/images/profil_logo.png',
controller: passwordTextField, height: 16,
obscureText: true, width: 16,
decoration: InputDecoration( fit: BoxFit.cover,
border: InputBorder.none,
), ),
cursorColor: Colors.purple,
textAlign: TextAlign.left,
), ),
), ],
Container( )),
margin: EdgeInsets.fromLTRB(15, 12, 0, 0), Container(
child: Image.asset( width: 500,
'assets/images/password_logo.png', padding: EdgeInsets.fromLTRB(45, 10, 45, 0),
height: 16, child: Stack(
width: 16, children: [
fit: BoxFit.cover, 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,
Container( controller: passwordTextField,
width: 500, obscureText: true,
padding: EdgeInsets.fromLTRB(45, 10, 45, 0), decoration: InputDecoration(
child: Stack( border: InputBorder.none,
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/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(
padding: const EdgeInsets.fromLTRB(50, 0, 20, 0), padding: const EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(

@ -56,6 +56,7 @@ flutter:
assets: assets:
- assets/images/ - assets/images/
- assets/fonts/ - assets/fonts/
- assets/
fonts: fonts:
- family: DMSans - family: DMSans

Loading…
Cancel
Save