link view modele profil page and discovery
continuous-integration/drone/push Build is passing Details

messagerie_lucas_test
Lucas Delanier 3 years ago
parent fbf7a2c283
commit 057c9117c8

@ -0,0 +1,35 @@
import '../model/user.dart';
class Controller{
static Controller? _this;
User currentUser = User(null, null);
factory Controller(){
if (_this == null) _this = Controller._();
return _this!;
}
Controller._();
void save(User userToSave){
}
void load(String username, String password) async{
}
User createUser(String username, String password){
return User(username, password);
}
void changeCurrentUser(User user){
this.currentUser = user;
}
void changeUsernameCourant(String newName){
if(newName !=null){
this.currentUser?.usernameDafl = newName;
}
}
}

@ -9,17 +9,21 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rive/rive.dart'; import 'package:rive/rive.dart';
import '../controller/controller.dart';
void main() { void main() {
MyApp mainApp = MyApp();
runApp(MyApp()); runApp(MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
Controller controller = Controller();
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context){ Widget build(BuildContext context){
Paint.enableDithering = true;
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
return ChangeNotifierProvider( return ChangeNotifierProvider(
create: (context) => CardProvider(), create: (context) => CardProvider(),

@ -0,0 +1,21 @@
import 'message.dart';
import 'user.dart';
class Conversation{
User firstUser;
User secondUser;
List<Message> messages=[];
Conversation(this.firstUser,this.secondUser);
void addMessage(User sender,String content){
messages.add(Message(sender, content));
}
void displayMessages(){
print("-----Conversation entre $firstUser et $secondUser-----");
for (var element in messages) {
print(element);
}
}
}

@ -0,0 +1,11 @@
import 'user.dart';
class Message{
User sender;
String content;
Message(this.sender,this.content);
@override
String toString() => "$sender : $content";
}

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

@ -0,0 +1,67 @@
import 'package:dafl_project_flutter/main.dart';
import 'conversation.dart';
import 'music.dart';
class User{
//attributes from DAFL
int? idDafl;
String? usernameDafl;
String? passwDafl;
//attributes to link with API
String? usernameAPI;
String? passwAPI;
//constructors
User(this.usernameDafl, this.passwDafl);
User.name(this.usernameDafl);
User.fromDatabase(this.idDafl, this.usernameDafl);
//lists
Set<User> likedUsers={};
List<Music> Discovery=[
Music('Couleurs','Khali','https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
Music('Couleurs','Khali','https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
Music('Couleurs','Khali','https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
Music('Couleurs','Khali','https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
Music('Couleurs','Khali','https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
Music('Couleurs','Khali','https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
Music('Couleurs','Khali','https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg')];
Map<User,Conversation> conversations={};
void addDiscovery(Music newmusic){
if(MyApp().controller.currentUser?.Discovery == null){
}
else{
MyApp().controller.currentUser?.Discovery?.add(newmusic);
}
}
void like(User liked){
likedUsers.add(liked);
Conversation? conv = liked.conversations[this];
if(conv==null) {
conversations[liked]= Conversation(this, liked);
} else {
conversations[liked]= conv;
}
}
void chat(User recipient,String content){
Conversation? conv = conversations[recipient];
if(conv != null) conv.addMessage(this, content);
}
void displayConversations(){
conversations.forEach((k,v) => v.displayMessages());
}
@override
String toString() => "$usernameDafl ($idDafl)";
}

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

@ -15,15 +15,27 @@ class _ConversationPageState extends State<ConversationPage> {
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 Scaffold( return Scaffold(
extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: Color(0xFF141414),
appBar: AppBar( appBar: AppBar(
toolbarHeight: 100, flexibleSpace: Container(
title: Row( decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.black, Colors.transparent],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
)
),
),
toolbarHeight: 70,
title: Container(
child: Row(
children: [ children: [
Container( Container(
height: 60, padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
width: 60, height: 40,
width: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
color: Colors.blue, color: Colors.blue,
@ -34,16 +46,16 @@ class _ConversationPageState extends State<ConversationPage> {
], ],
), ),
),
backgroundColor: Color(0xFF141414), backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child:
children: [
Container( Container(
color: Color(0xFF141414), color: Color(0xFF141414),
height: height*0.76, height: height*0.92,
width: double.infinity, width: double.infinity,
child: ListView( child: ListView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
@ -58,28 +70,37 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
), ),
Row( ),
bottomSheet: BottomAppBar(
color: Color(0xFF141414),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
height: height*0.08, height: height*0.08,
color: Color(0xFF141414), color: Colors.transparent,
width: width*0.8, width: width*0.8,
child: Container( child: Container(
margin: EdgeInsets.fromLTRB(20, 10, 0, 10), margin: EdgeInsets.fromLTRB(20, 10, 0, 10),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(
width: 1,
color: Color(0xFF2F2F2F),
),
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
color: Colors.white, color: Color(0xFF141414),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
child: TextField( child: TextField(
style: TextStyle(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: TextStyle(color: Colors.white),
border: InputBorder.none, border: InputBorder.none,
hintText: "Envoyer un message..." hintText: "Envoyer un message...",
), ),
cursorColor: Colors.purple, cursorColor: Colors.purple,
textAlign: TextAlign.left, textAlign: TextAlign.left,
@ -99,9 +120,8 @@ class _ConversationPageState extends State<ConversationPage> {
) )
], ],
), ),
],
),
), ),
); );
} }
@ -121,8 +141,8 @@ class _ConversationPageState extends State<ConversationPage> {
color: Color(0xFF191919), color: Color(0xFF191919),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(20, 20, 20, 20), padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
child: Text(message,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 19, fontWeight: FontWeight.w400), child: Text(message,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),
)), )),
); );
} }
@ -139,8 +159,8 @@ class _ConversationPageState extends State<ConversationPage> {
color: Color(0xFF2F2F2F), color: Color(0xFF2F2F2F),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(20, 20, 20, 20), padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
child: Text(message,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 19, fontWeight: FontWeight.w400), child: Text(message,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),
)), )),
); );
} }

@ -19,7 +19,7 @@ class _MainPageState extends State<MainPage> {
int get index => _index; int get index => _index;
final screens = [ final screens = [
ProfilWidget(), ProfilWidget(),
DiscoveryWidget(), new DiscoveryWidget(),
SpotsWidget(), SpotsWidget(),
Center(child: Text('Tops'),), Center(child: Text('Tops'),),
MessagesWidget(), MessagesWidget(),

@ -1,6 +1,11 @@
import 'dart:math';
import 'package:dafl_project_flutter/main.dart';
import 'package:fluttericon/font_awesome5_icons.dart'; import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../model/music.dart';
class DiscoveryWidget extends StatefulWidget { class DiscoveryWidget extends StatefulWidget {
const DiscoveryWidget({Key? key}) : super(key: key); const DiscoveryWidget({Key? key}) : super(key: key);
@ -16,11 +21,12 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
return Container( return Container(
color: Color(0xFF141414), color: Color(0xFF141414),
child: Padding(padding: EdgeInsets.fromLTRB(30, 50, 30, 0), child: Padding(padding: EdgeInsets.fromLTRB(0, 50, 0, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -37,129 +43,48 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
), ),
), ),
Expanded( Expanded(
child: ListView( child: DiscoveryList(),
children: [
SizedBox(height: 40,),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Column(
children: [
Container(
margin: EdgeInsets.fromLTRB(0, 5, 0, 0),
width: double.infinity,
child: Row(
children: [
Container(
height: 60,
width: 60,
decoration: BoxDecoration(
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: 'https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
),),
Container(
margin: EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('IVERSON',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text('Laylow',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),),
],
),),
],
),
),
],
) )
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Column(
children: [
Container(
margin: EdgeInsets.fromLTRB(0, 5, 0, 0),
width: double.infinity,
child: Row(
children: [
Container(
height: 60,
width: 60,
decoration: BoxDecoration(
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: 'https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
),),
Container(
margin: EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('IVERSON',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text('Laylow',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),),
], ],
),), ),),
], );
), }
), }
class DiscoveryList extends StatefulWidget {
const DiscoveryList({Key? key}) : super(key: key);
], @override
) State<DiscoveryList> createState() => _DiscoveryListState();
), }
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Column(
children: [
Container(
margin: EdgeInsets.fromLTRB(0, 5, 0, 0),
width: double.infinity,
child: Row(
children: [
Container(
height: 60,
width: 60,
decoration: BoxDecoration(
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: 'https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
),),
Container(
margin: EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('IVERSON',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text('Laylow',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),),
],
),),
],
),
),
class _DiscoveryListState extends State<DiscoveryList> {
late GlobalKey<RefreshIndicatorState> refreshKey;
@override
void initState() {
print('testttt');
refreshKey = GlobalKey<RefreshIndicatorState>();
refreshList();
super.initState();
}
], Future<Null> refreshList() async {
) await Future.delayed(Duration(seconds: 1));
), setState(() {
Container( MyApp().controller.currentUser.Discovery;
print('test');
});
return null;
}
Widget build(BuildContext context) {
return RefreshIndicator(child: ListView.builder(
itemCount: MyApp().controller.currentUser.Discovery.length ?? 0,
itemBuilder: (context, index){
int itemCount = MyApp().controller.currentUser.Discovery.length ?? 0;
int reversedIndex = itemCount - 1 - index;
return Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0), margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
child: Column( child: Column(
children: [ children: [
@ -184,7 +109,7 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('IVERSON',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),), Text(MyApp().controller.currentUser.Discovery[reversedIndex].name ?? '',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 20, fontWeight: FontWeight.w800),),
Text('Laylow',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),), Text('Laylow',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),),
], ],
@ -196,14 +121,11 @@ class _DiscoveryWidgetState extends State<DiscoveryWidget> {
], ],
) )
),
],
),
),
],
),),
); );
} }
), onRefresh: () async {
refreshList();
}, key: refreshKey,);
}
} }

@ -1,3 +1,5 @@
import 'package:dafl_project_flutter/main.dart';
import './w_settings.dart'; import './w_settings.dart';
import './w_spot.dart'; import './w_spot.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -43,14 +45,32 @@ class MainPageProfil extends StatelessWidget {
style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600, color: Colors.white),), style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600, color: Colors.white),),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 40), margin: EdgeInsets.fromLTRB(0, 10, 0, 10),
height: height*0.14, height: height*0.14,
width: height*0.14, width: height*0.14,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100.0), borderRadius: BorderRadius.circular(100.0),
color: Colors.blue,border: Border.all(width: 6.0, color: Colors.white), color: Colors.blue,border: Border.all(width: 6.0, color: Colors.white),
boxShadow: [
BoxShadow(
offset: Offset(0, 0),
spreadRadius: 5,
blurRadius:10,
color: Color.fromRGBO(0, 0, 0, 1),
),
],
), ),
child: Center(
child: Text(MyApp().controller.currentUser?.usernameDafl![0] ?? '',
style: TextStyle(color: Colors.white ,fontSize: 60, fontWeight: FontWeight.w500),
textAlign: TextAlign.center,
),
),
),
Text(MyApp().controller.currentUser?.usernameDafl ?? '',
style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
), ),
Container( Container(
height: 55, height: 55,
@ -59,7 +79,7 @@ class MainPageProfil extends StatelessWidget {
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent, color: Colors.transparent,
), ),
margin: EdgeInsets.fromLTRB(30, 0, 30, 0), margin: EdgeInsets.fromLTRB(30, 40, 30, 0),
child: SizedBox( child: SizedBox(
height: 55, height: 55,
width: double.infinity, width: double.infinity,
@ -187,7 +207,7 @@ class MainPageProfil extends StatelessWidget {
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
color: Colors.transparent, color: Colors.transparent,
), ),
margin: EdgeInsets.fromLTRB(30, 0, 30, height*0.04), margin: EdgeInsets.fromLTRB(30, 0, 30,0),
child: SizedBox( child: SizedBox(
height: 55, height: 55,
width: double.infinity, width: double.infinity,
@ -215,6 +235,7 @@ class MainPageProfil extends StatelessWidget {
) )
),), ),),
), ),
Spacer(),
], ],
), ),
), ),

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

@ -1,4 +1,7 @@
import 'dart:ui'; import 'dart:ui';
import 'package:dafl_project_flutter/views/pages/main/w_discovery.dart';
import '../../../model/music.dart';
import './w_card.dart'; import './w_card.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/painting/gradient.dart' as gradiant; import 'package:flutter/src/painting/gradient.dart' as gradiant;
@ -94,6 +97,7 @@ class _SpotsWidgetState extends State<SpotsWidget> {
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
MyApp().controller.currentUser.addDiscovery(Music('e','Khali','https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'));
final provider = Provider.of<CardProvider>(context, listen: false); final provider = Provider.of<CardProvider>(context, listen: false);
provider.discovery(); provider.discovery();
}, },
@ -145,7 +149,7 @@ class _SpotsWidgetState extends State<SpotsWidget> {
IgnorePointer(child: Container(height: 200, IgnorePointer(child: Container(height: 200,
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: gradiant.LinearGradient( gradient: gradiant.LinearGradient(
colors: [Colors.black, Colors.transparent], colors: [Colors.black.withOpacity(0.95),Colors.black.withOpacity(0.84),Colors.black.withOpacity(0.66),Colors.black.withOpacity(0.41),Colors.black.withOpacity(0)],
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
) )

@ -16,6 +16,8 @@ class _SignInPageState extends State<SignInPage> {
@override @override
bool isChecked = false; bool isChecked = false;
final userNameTextField = TextEditingController();
final passwordTextField = TextEditingController();
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
@ -68,6 +70,7 @@ class _SignInPageState extends State<SignInPage> {
), ),
Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: userNameTextField,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
), ),
@ -111,6 +114,7 @@ class _SignInPageState extends State<SignInPage> {
),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: passwordTextField,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
@ -165,12 +169,18 @@ class _SignInPageState extends State<SignInPage> {
highlightColor: Colors.grey.shade100, highlightColor: Colors.grey.shade100,
splashColor: Color(0xFF406DE1), splashColor: Color(0xFF406DE1),
onTap: (){ onTap: (){
if(passwordTextField.text != "" && userNameTextField.text != ""){
MyApp().controller.changeCurrentUser(MyApp().controller.createUser(userNameTextField.text, passwordTextField.text));
Navigator.of(context).push( Navigator.of(context).push(
PageTransition( PageTransition(
type: PageTransitionType.fade, type: PageTransitionType.fade,
childCurrent: widget, childCurrent: widget,
child: Splash()), child: Splash()),
); );
}
else{
print('probleme connexion');
}
}, },
child:Ink( child:Ink(
child: Align( child: Align(

@ -1,7 +1,9 @@
import 'package:dafl_project_flutter/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart'; import 'package:page_transition/page_transition.dart';
import '../home/p_home.dart'; import '../home/p_home.dart';
import '../sign_in/p_sign_in.dart'; import '../sign_in/p_sign_in.dart';
import '../../../controller/controller.dart';
class SignUpPage extends StatefulWidget { class SignUpPage extends StatefulWidget {
const SignUpPage({Key? key}) : super(key: key); const SignUpPage({Key? key}) : super(key: key);
@ -15,8 +17,10 @@ class _SignUpPageState extends State<SignUpPage> {
Color boxColor = Colors.white; Color boxColor = Colors.white;
bool isHovering = false; bool isHovering = false;
@override @override
TextEditingController passwordconfirm = new TextEditingController();
bool isChecked = false; bool isChecked = false;
final userNameTextField = TextEditingController();
final passwordTextField = TextEditingController();
final passwordConfirmTextField = TextEditingController();
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
@ -69,6 +73,7 @@ class _SignUpPageState extends State<SignUpPage> {
), ),
Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: userNameTextField,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
), ),
@ -112,6 +117,7 @@ class _SignUpPageState extends State<SignUpPage> {
),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
controller: passwordTextField,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
@ -157,7 +163,7 @@ class _SignUpPageState extends State<SignUpPage> {
),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0),
child: TextField( child: TextField(
obscureText: true, obscureText: true,
controller: passwordconfirm, controller: passwordConfirmTextField,
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
), ),
@ -231,17 +237,20 @@ class _SignUpPageState extends State<SignUpPage> {
highlightColor: Colors.grey.shade100, highlightColor: Colors.grey.shade100,
splashColor: Color(0xFF406DE1), splashColor: Color(0xFF406DE1),
onTap: (){ onTap: (){
setState(() { if(passwordConfirmTextField.text == passwordTextField.text && userNameTextField.text != null){
boxColor = Colors.blue; MyApp().controller.createUser(userNameTextField.text, passwordConfirmTextField.text);
});
Navigator.of(context).push( Navigator.of(context).push(
PageTransition( PageTransition(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
reverseDuration: Duration(milliseconds: 300), reverseDuration: Duration(milliseconds: 300),
type: PageTransitionType.leftToRightJoined, type: PageTransitionType.leftToRightJoined,
childCurrent: widget, childCurrent: widget,
child: HomePage()), child: HomePage()),);
); }
else{
print('Null');
}
}, },
child:Ink( child:Ink(
child: Align( child: Align(

Loading…
Cancel
Save