From 84ad3100eeb3cef1327dd4c9256f96d81af7b44c Mon Sep 17 00:00:00 2001 From: delanierlucas Date: Sun, 6 Nov 2022 14:11:00 +0100 Subject: [PATCH 1/6] add action when tap on send button --- .../lib/model/message.dart | 3 +- .../lib/views/pages/main/p_conversation.dart | 156 +++++++++++------- .../lib/views/pages/main/w_messages.dart | 4 +- Sources/dafl_project_flutter/pubspec.yaml | 1 + 4 files changed, 101 insertions(+), 63 deletions(-) diff --git a/Sources/dafl_project_flutter/lib/model/message.dart b/Sources/dafl_project_flutter/lib/model/message.dart index 2fe88a8..5fcd074 100644 --- a/Sources/dafl_project_flutter/lib/model/message.dart +++ b/Sources/dafl_project_flutter/lib/model/message.dart @@ -4,8 +4,9 @@ class Message{ User sender; String content; - Message(this.sender,this.content); @override String toString() => "$sender : $content"; + + Message(this.sender, this.content); } \ No newline at end of file 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 30580f7..e9b1782 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 @@ -1,7 +1,13 @@ +import 'package:dafl_project_flutter/main.dart'; +import 'package:dafl_project_flutter/model/user.dart'; +import 'package:dafl_project_flutter/views/pages/main/w_messages.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:fluttericon/font_awesome5_icons.dart'; +import 'package:dafl_project_flutter/model/message.dart'; + + class ConversationPage extends StatefulWidget { const ConversationPage({Key? key}) : super(key: key); @@ -10,10 +16,76 @@ class ConversationPage extends StatefulWidget { } class _ConversationPageState extends State { + + + User destinataire = new User("test1", '1234'); + List messages= []; + + final messageTextField = TextEditingController(); + + + void SendMessage(String content){ + setState(() { + messages.add(MessageWidget(Message(MyApp().controller.currentUser,content))); + }); + } + Widget MessageWidget(Message message) { + if(message.sender != MyApp().controller.currentUser){ + return Container( + margin: EdgeInsets.fromLTRB(40, 7, 80, 7), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(20), + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + bottomLeft: Radius.circular(20), + ), + border: Border.all(width: 1.5, + color: Color(0xFF9C9C9C).withOpacity(0.3)), + color: Color(0xFF191919), + ), + child: Padding( + padding: EdgeInsets.fromLTRB(15, 15, 15, 15), + child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400), + )), + ); + } + else{ + return Container( + margin: EdgeInsets.fromLTRB(80, 7, 40, 7), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(20), + bottomLeft: Radius.circular(20), + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + ), + color: Color(0xFF2F2F2F), + ), + child: Padding( + padding: EdgeInsets.fromLTRB(15, 15, 15, 15), + child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400), + )), + ); + } + + + } + + @override + void initState() { + + super.initState(); + + print("INITSATE"); + } + @override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; + + return Scaffold( extendBodyBehindAppBar: true, resizeToAvoidBottomInset: true, @@ -47,18 +119,19 @@ class _ConversationPageState extends State { color: Color(0xFF141414), height: height*0.92, width: double.infinity, - child: ListView( + child: /*ListView( reverse: true, scrollDirection: Axis.vertical, children: [ - Message('Adolescebat autem obstinatum propositum erga haec et similia multa scrutanda, stimulos admovente regina, quae abrupte mariti fortunas trudebat in exitium praeceps, cum eum potius lenitate feminea ad veritatis humanitatisque viam reducere utilia suadendo deberet, ut in Gordianorum actibus factitasse Maximini truculenti illius imperatoris rettulimus coniugem.', 0), - Message('Claudiopolis olim Seleucia Caesar potens quidem olim interneciva enim et.', 1), - Message('Quae quae praeceps feminea quae truculenti humanitatisque cum humanitatisque in truculenti abrupte imperatoris mariti regina regina ad lenitate veritatis veritatis.', 1), - Message('Quae quae praeceps feminea quae truculenti humanitatisque cum humanitatisque in truculenti abrupte imperatoris mariti regina regina ad lenitate veritatis veritatis.', 0), - Message('Quae quae praeceps feminea quae truculenti humanitatisque cum humanitatisque in truculenti abrupte imperatoris mariti regina regina ad lenitate veritatis veritatis.', 0), - Message('Quae quae praeceps feminea quae truculenti humanitatisque cum humanitatisque in truculenti abrupte imperatoris mariti regina regina ad lenitate veritatis veritatis.', 1), + messages; ], - ), + ),*/ + ListView.builder( + physics: BouncingScrollPhysics(), + itemCount: messages.length, + itemBuilder: (context, index) { + return messages[index]; + }) ), ), @@ -87,6 +160,7 @@ class _ConversationPageState extends State { child: Padding( padding: EdgeInsets.fromLTRB(10, 0, 10, 0), child: TextField( + controller: messageTextField, style: TextStyle(color: Colors.white), decoration: InputDecoration( hintStyle: TextStyle(color: Colors.white), @@ -99,15 +173,22 @@ class _ConversationPageState extends State { ), ), ), - Container( - width: 40, - height: 40, - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Colors.blue, + GestureDetector( + onTap: () { + + SendMessage(messageTextField.text); + + }, + child: Container( + width: 40, + height: 40, + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + color: Colors.purple, + ), + child: Icon(Icons.send, size: 20, color: Colors.white,), ), - child: Icon(Icons.send, size: 20, color: Colors.white,), ) ], ), @@ -115,47 +196,4 @@ class _ConversationPageState extends State { ); } - - Widget Message(String message, int user) { - if(user == 0){ - return Container( - margin: EdgeInsets.fromLTRB(40, 7, 80, 7), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(20), - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - bottomLeft: Radius.circular(20), - ), - border: Border.all(width: 1.5, - color: Color(0xFF9C9C9C).withOpacity(0.3)), - color: Color(0xFF191919), - ), - child: Padding( - padding: EdgeInsets.fromLTRB(15, 15, 15, 15), - child: Text(message,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400), - )), - ); - } - else{ - return Container( - margin: EdgeInsets.fromLTRB(80, 7, 40, 7), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(20), - bottomLeft: Radius.circular(20), - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - ), - color: Color(0xFF2F2F2F), - ), - child: Padding( - padding: EdgeInsets.fromLTRB(15, 15, 15, 15), - child: Text(message,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400), - )), - ); - } - - - } } 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 6b9e4ea..295de36 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 @@ -163,7 +163,7 @@ class MessagesButtonWidget extends StatelessWidget{ Text('1 jour(s)',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.8) ,fontSize: 15, fontWeight: FontWeight.w400),), ], ), - Text('A envoyé un musique.',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),), + Text('A envoyé une musique.',style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(0.6) ,fontSize: 16, fontWeight: FontWeight.w400),), ], ),), @@ -187,7 +187,6 @@ class ListConfirmedWidget extends StatelessWidget{ return ListView( children: [ - SizedBox(height: 40,), MessagesButtonWidget(), MessagesButtonWidget(), MessagesButtonWidget(), @@ -208,7 +207,6 @@ class ListWaitingWidget extends StatelessWidget{ return ListView( children: [ - SizedBox(height: 40,), GestureDetector( onTap: () { Navigator.of(context).push(PageTransition( diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 12d9cee..41dd958 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -91,6 +91,7 @@ flutter: assets: - assets/images/ - assets/fonts/ + - assets/logs.txt # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware From 8c5bdfe940d679895a119fee9834c4a5a12cba15 Mon Sep 17 00:00:00 2001 From: delanierlucas Date: Sun, 6 Nov 2022 19:32:37 +0100 Subject: [PATCH 2/6] page conversation fonctionnelle --- .../lib/views/pages/main/p_conversation.dart | 71 +++++++++++-------- 1 file changed, 42 insertions(+), 29 deletions(-) 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 e9b1782..bc7eb3e 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 @@ -27,45 +27,51 @@ class _ConversationPageState extends State { void SendMessage(String content){ setState(() { messages.add(MessageWidget(Message(MyApp().controller.currentUser,content))); + messages.add(MessageWidget(Message(destinataire,"reponse test gyegryzgrgz zyegruhzb hvhbzy vhu ry z yrzrv ze vhv hzvh z zv zz ev"))); }); } Widget MessageWidget(Message message) { if(message.sender != MyApp().controller.currentUser){ - return Container( - margin: EdgeInsets.fromLTRB(40, 7, 80, 7), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(20), - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - bottomLeft: Radius.circular(20), + return Align( + alignment: Alignment.centerLeft, + child: Container( + margin: EdgeInsets.fromLTRB(40, 7, 80, 7), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(20), + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + bottomLeft: Radius.circular(20), + ), + border: Border.all(width: 1.5, + color: Color(0xFF9C9C9C).withOpacity(0.3)), + color: Color(0xFF191919), ), - 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: Padding( - padding: EdgeInsets.fromLTRB(15, 15, 15, 15), - child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400), - )), ); } else{ - return Container( - margin: EdgeInsets.fromLTRB(80, 7, 40, 7), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(20), - bottomLeft: Radius.circular(20), - topLeft: Radius.circular(20), - topRight: Radius.circular(20), + return Align( + alignment: Alignment.centerRight, + child: Container( + margin: EdgeInsets.fromLTRB(80, 7, 40, 7), + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(20), + bottomLeft: Radius.circular(20), + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + ), + color: Color(0xFF2F2F2F), ), - color: Color(0xFF2F2F2F), - ), - 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: Padding( + padding: EdgeInsets.all(15), + child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),), + ),), ); } @@ -84,6 +90,7 @@ class _ConversationPageState extends State { Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; + ScrollController listScrollController = ScrollController(); return Scaffold( @@ -127,6 +134,7 @@ class _ConversationPageState extends State { ], ),*/ ListView.builder( + controller: listScrollController, physics: BouncingScrollPhysics(), itemCount: messages.length, itemBuilder: (context, index) { @@ -177,6 +185,11 @@ class _ConversationPageState extends State { onTap: () { SendMessage(messageTextField.text); + if (listScrollController.hasClients) { + final position = listScrollController.position.maxScrollExtent; + listScrollController.jumpTo(position+40); + } + messageTextField.clear(); }, child: Container( From 08ca05f6f4455fc1422e0fdcfac820272823a53f Mon Sep 17 00:00:00 2001 From: delanierlucas Date: Sun, 6 Nov 2022 22:37:44 +0100 Subject: [PATCH 3/6] page conversation fonctionnelle --- .../lib/views/pages/main/p_conversation.dart | 50 ++++++++++++++++--- 1 file changed, 42 insertions(+), 8 deletions(-) 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 bc7eb3e..42e1e63 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 @@ -20,6 +20,7 @@ class _ConversationPageState extends State { User destinataire = new User("test1", '1234'); List messages= []; + bool isNull = true; final messageTextField = TextEditingController(); @@ -82,10 +83,29 @@ class _ConversationPageState extends State { void initState() { super.initState(); - + messageTextField.addListener(_checkIfNull); print("INITSATE"); } + @override + void dispose() { + messageTextField.dispose(); + super.dispose(); + } + + void _checkIfNull(){ + if(messageTextField.text.length > 0){ + setState(() { + isNull = false; + }); + } + else{ + setState(() { + isNull = true; + }); + } + } + @override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; @@ -146,16 +166,16 @@ class _ConversationPageState extends State { bottomSheet: BottomAppBar( color: Color(0xFF141414), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( height: height*0.08, color: Colors.transparent, - width: width*0.8, + width: width*0.9, child: Container( - margin: EdgeInsets.fromLTRB(20, 10, 0, 10), + margin: EdgeInsets.fromLTRB(10, 10, 10, 10), decoration: BoxDecoration( border: Border.all( width: 1, @@ -182,7 +202,9 @@ class _ConversationPageState extends State { ), ), GestureDetector( - onTap: () { + onTap: isNull? + null: + () { SendMessage(messageTextField.text); if (listScrollController.hasClients) { @@ -192,15 +214,27 @@ class _ConversationPageState extends State { messageTextField.clear(); }, - child: Container( + 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), - color: Colors.purple, + gradient: LinearGradient( + colors: [Color(0xff8e24a1), Color(0xff8163ff)], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ) + + ), - child: Icon(Icons.send, size: 20, color: Colors.white,), + child: Transform.rotate(angle: -300, + child: Icon(Icons.arrow_back, size: 26, color: Colors.white,),) ), ) ], From 7763284364076a4086bd5a27cfc6a7448ec506a0 Mon Sep 17 00:00:00 2001 From: delanierlucas Date: Tue, 8 Nov 2022 11:03:21 +0100 Subject: [PATCH 4/6] rectification bug setstate --- Sources/dafl_project_flutter/lib/main.dart | 4 +- .../lib/views/pages/main/p_conversation.dart | 195 +++++++++++++++++- .../lib/views/pages/main/w_profile.dart | 27 ++- Sources/dafl_project_flutter/pubspec.yaml | 1 - 4 files changed, 211 insertions(+), 16 deletions(-) diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart index 01b07d9..697a4bb 100644 --- a/Sources/dafl_project_flutter/lib/main.dart +++ b/Sources/dafl_project_flutter/lib/main.dart @@ -171,7 +171,7 @@ class CardProvider extends ChangeNotifier{ ); } else{ - if(MyApp().controller.currentUser.Spots2?.last != null){ + if(MyApp().controller.currentUser.Spots2.last != null){ MyApp().controller.currentUser.addDiscovery(MyApp().controller.currentUser.Spots2.last.music); Fluttertoast.showToast( msg: 'Ajouté', @@ -264,7 +264,7 @@ class CardProvider extends ChangeNotifier{ style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), expands: true, maxLines: null, - keyboardType: TextInputType.multiline, + textInputAction: TextInputAction.send, decoration: InputDecoration( hintStyle: TextStyle( color: Colors.white, 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 42e1e63..f16a930 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 @@ -28,7 +28,6 @@ class _ConversationPageState extends State { void SendMessage(String content){ setState(() { messages.add(MessageWidget(Message(MyApp().controller.currentUser,content))); - messages.add(MessageWidget(Message(destinataire,"reponse test gyegryzgrgz zyegruhzb hvhbzy vhu ry z yrzrv ze vhv hzvh z zv zz ev"))); }); } Widget MessageWidget(Message message) { @@ -117,6 +116,7 @@ class _ConversationPageState extends State { extendBodyBehindAppBar: true, resizeToAvoidBottomInset: true, appBar: AppBar( + elevation: 20, backgroundColor: Color(0xFF141414), toolbarHeight: 70, title: Container( @@ -133,12 +133,30 @@ class _ConversationPageState extends State { ), SizedBox(width: 20,), Text("Max"), + Spacer(), + IconButton( + splashColor: Colors.grey.withOpacity(0.2), + splashRadius: 30, + onPressed: () { + showModalBottomSheet( + isDismissible: true, + useRootNavigator: true, + isScrollControlled: true, + backgroundColor: Colors.transparent, + context: context, + constraints: BoxConstraints( + maxWidth: 600, + maxHeight: double.infinity, + ), + builder: (context) => buildSheet(),); + + }, + icon: Icon(Icons.report_problem, color: Colors.grey.withOpacity(0.3),size: 25,), + ), ], ), ), - - elevation: 0, ), body: SingleChildScrollView( child: @@ -186,14 +204,14 @@ class _ConversationPageState extends State { ), child: Padding( - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + padding: EdgeInsets.fromLTRB(15, 0, 15, 0), child: TextField( controller: messageTextField, style: TextStyle(color: Colors.white), decoration: InputDecoration( - hintStyle: TextStyle(color: Colors.white), + hintStyle: TextStyle(color: Colors.white.withOpacity(0.7)), border: InputBorder.none, - hintText: "Envoyer un message...", + hintText: "Votre message...", ), cursorColor: Colors.purple, textAlign: TextAlign.left, @@ -209,7 +227,7 @@ class _ConversationPageState extends State { SendMessage(messageTextField.text); if (listScrollController.hasClients) { final position = listScrollController.position.maxScrollExtent; - listScrollController.jumpTo(position+40); + listScrollController.jumpTo(position); } messageTextField.clear(); @@ -242,5 +260,168 @@ class _ConversationPageState extends State { ), ); + + + + + } + + Widget buildSheet(){ + String dropdownValue = list.first; + final messageTextField = TextEditingController(); + return Container( + height: 550, + width: double.infinity, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.4), + offset: const Offset( + 0, + 0, + ), + blurRadius: 10.0, + spreadRadius: 2.0, + ), + BoxShadow( + color: Colors.white.withOpacity(0.3), + offset: const Offset(0.0, 0.0), + blurRadius: 0.0, + spreadRadius: 0.0, + ),//BoxShadow//BoxShadow + ], + color: Color(0xFF232123), + borderRadius: BorderRadius.only( + topRight: Radius.circular(30), + topLeft: Radius.circular(30), + ), + ), + child: Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + + Container( + height: 5, + width: 130, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Color(0xFF8A8A8A), + ), + ), + 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, + decoration: BoxDecoration( + color: Colors.grey.shade900, + borderRadius: BorderRadius.circular(15), + ), + 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(),), + ], + ),), + Padding(padding: EdgeInsets.fromLTRB(0, 20, 0, 20), + child: Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + width: double.infinity, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(0.07), + borderRadius: BorderRadius.circular(15), + ), + child: TextField( + style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), + maxLines: 3, + textInputAction: TextInputAction.done, + decoration: InputDecoration( + hintText: '* Commentaires', + hintStyle: TextStyle( + fontSize: 15, + color: Colors.white, + ), + border: InputBorder.none, + ), + ),), + ], + )), + Spacer(), + Padding(padding: EdgeInsets.fromLTRB(0, 0, 0, 50), + child: SizedBox( + width: double.infinity, + height: 70, + child: ElevatedButton( + onPressed: () { + }, + style: ElevatedButton.styleFrom( + primary: Colors.red, + textStyle: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(17) + ), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("Envoyer le signalement"), + ], + ), + ), + ),), + ], + ), + ), + + ); + + } +} + +class DropdownButtonReason extends StatefulWidget { + const DropdownButtonReason({super.key}); + + @override + State createState() => _DropdownButtonReasonState(); +} + +const List list = ['Insulte', 'Racisme', 'Messages inappropriés', "Usurpation d'identité"]; + +class _DropdownButtonReasonState extends State { + String dropdownValue = list.first; + + @override + Widget build(BuildContext context) { + return DropdownButton( + dropdownColor: Colors.grey.shade900.withOpacity(1), + value: dropdownValue, + icon: const Icon(Icons.arrow_downward, color: Colors.grey,), + elevation: 16, + style: const TextStyle(color: Colors.white), + underline: Container( + height: 2, + color: Colors.grey.withOpacity(0.6), + ), + onChanged: (String? value) { + // This is called when the user selects an item. + setState(() { + dropdownValue = value!; + }); + }, + items: list.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ); } } 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 50fc84e..d62f9e9 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 @@ -18,14 +18,26 @@ class _ProfilWidgetState extends State { @override Widget build(BuildContext context) { - double height = MediaQuery.of(context).size.height; return MainPageProfil(); } } -class MainPageProfil extends StatelessWidget { - const MainPageProfil({super.key}); +class MainPageProfil extends StatefulWidget { + const MainPageProfil({Key? key}) : super(key: key); + + @override + State createState() => _MainPageProfilState(); +} + +class _MainPageProfilState extends State { + + String? username = MyApp().controller.currentUser.usernameDafl; + @override + void initState() { + super.initState(); + String username = MyApp().controller.currentUser.usernameDafl ?? "default"; + } @override Widget build(BuildContext context) { @@ -64,13 +76,13 @@ class MainPageProfil extends StatelessWidget { ), child: Center( - child: Text(MyApp().controller.currentUser.usernameDafl![0] ?? '', + child: Text(username![0] ?? '', style: TextStyle(color: Colors.white ,fontSize: 60, fontWeight: FontWeight.w500), textAlign: TextAlign.center, ), ), ), - Text(MyApp().controller.currentUser.usernameDafl ?? '', + Text(username!, style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.w400), textAlign: TextAlign.center, ), @@ -221,7 +233,9 @@ class MainPageProfil extends StatelessWidget { ),// background// foreground ), onPressed: () { - Navigator.push(context,MaterialPageRoute(builder: (context)=> SettingsWidget())); + Navigator.push(context,MaterialPageRoute(builder: (context)=> SettingsWidget())).then((value) => setState(() { + username = MyApp().controller.currentUser.usernameDafl!; + })); }, child: Row( children: [ @@ -245,3 +259,4 @@ class MainPageProfil extends StatelessWidget { } } + diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 41dd958..12d9cee 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -91,7 +91,6 @@ flutter: assets: - assets/images/ - assets/fonts/ - - assets/logs.txt # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware From e332d84debee0d5f6664ff33ccbd6e54a5c69c4a Mon Sep 17 00:00:00 2001 From: delanierlucas Date: Tue, 8 Nov 2022 16:35:27 +0100 Subject: [PATCH 5/6] commit --- .idea/libraries/Dart_Packages.xml | 8 + Sources/dafl_project_flutter/ios/Podfile.lock | 6 + .../lib/controller/controller.dart | 4 +- Sources/dafl_project_flutter/lib/main.dart | 190 +++++++-------- .../dafl_project_flutter/lib/model/user.dart | 4 +- .../lib/views/pages/home/p_home.dart | 4 +- .../lib/views/pages/main/p_conversation.dart | 221 +++++++++--------- .../lib/views/pages/main/p_main.dart | 4 +- .../lib/views/pages/main/w_discovery.dart | 10 +- .../lib/views/pages/main/w_profile.dart | 4 +- .../lib/views/pages/main/w_settings.dart | 6 +- .../lib/views/pages/sign_in/p_sign_in.dart | 2 + .../lib/views/pages/sign_up/p_sign_up.dart | 2 + Sources/dafl_project_flutter/pubspec.lock | 7 + Sources/dafl_project_flutter/pubspec.yaml | 1 + 15 files changed, 254 insertions(+), 219 deletions(-) diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index 279019c..7ae99d3 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -198,6 +198,13 @@ + + + + + + @@ -541,6 +548,7 @@ + diff --git a/Sources/dafl_project_flutter/ios/Podfile.lock b/Sources/dafl_project_flutter/ios/Podfile.lock index 6d41903..fb54b7d 100644 --- a/Sources/dafl_project_flutter/ios/Podfile.lock +++ b/Sources/dafl_project_flutter/ios/Podfile.lock @@ -5,6 +5,8 @@ PODS: - fluttertoast (0.0.2): - Flutter - Toast + - home_indicator (0.0.1): + - Flutter - path_provider_ios (0.0.1): - Flutter - Toast (4.0.0) @@ -15,6 +17,7 @@ DEPENDENCIES: - Flutter (from `Flutter`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) + - home_indicator (from `.symlinks/plugins/home_indicator/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - vibration (from `.symlinks/plugins/vibration/ios`) @@ -29,6 +32,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_native_splash/ios" fluttertoast: :path: ".symlinks/plugins/fluttertoast/ios" + home_indicator: + :path: ".symlinks/plugins/home_indicator/ios" path_provider_ios: :path: ".symlinks/plugins/path_provider_ios/ios" vibration: @@ -38,6 +43,7 @@ SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef fluttertoast: 74526702fea2c060ea55dde75895b7e1bde1c86b + home_indicator: 60c6a4b60d17173cd164c112eb9be37055b23af8 path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 vibration: 7d883d141656a1c1a6d8d238616b2042a51a1241 diff --git a/Sources/dafl_project_flutter/lib/controller/controller.dart b/Sources/dafl_project_flutter/lib/controller/controller.dart index 053e331..f4f943b 100644 --- a/Sources/dafl_project_flutter/lib/controller/controller.dart +++ b/Sources/dafl_project_flutter/lib/controller/controller.dart @@ -40,12 +40,12 @@ class Controller{ void changeUsernameCourant(String newName){ if(newName !=null){ - this.currentUser?.usernameDafl = newName; + this.currentUser.usernameDafl = newName; } } void changePasswordCourant(String newPass){ if(newPass !=null){ - this.currentUser?.passwDafl = newPass; + this.currentUser.passwDafl = newPass; } } } diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart index 697a4bb..637078d 100644 --- a/Sources/dafl_project_flutter/lib/main.dart +++ b/Sources/dafl_project_flutter/lib/main.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:vibration/vibration.dart'; import 'dart:math'; @@ -9,6 +10,7 @@ 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'; @@ -22,12 +24,11 @@ void main() { class MyApp extends StatelessWidget { Controller controller = Controller(); - // This widget is the root of your application. @override Widget build(BuildContext context){ Paint.enableDithering = true; - SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); + SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]); return ChangeNotifierProvider( create: (context) => CardProvider(), child: MaterialApp( @@ -159,8 +160,8 @@ class CardProvider extends ChangeNotifier{ _position -= Offset(0, -_screenSize.height); _discovery_card(); print("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.Spots2.last.music)){ + MyApp().controller.currentUser.Discovery.remove(MyApp().controller.currentUser.Spots2.last.music); Fluttertoast.showToast( msg: 'Supprimer', toastLength: Toast.LENGTH_SHORT, @@ -203,109 +204,114 @@ class CardProvider extends ChangeNotifier{ maxWidth: 600, maxHeight: double.infinity, ), - builder: (context) => buildSheet(),); + builder: (context) => buildSheet(context),); notifyListeners(); } - Widget buildSheet(){ + Widget buildSheet(context){ final messageTextField = TextEditingController(); - return Container( - height: 550, - width: 350, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.4), - offset: const Offset( - 0, - 0, + return SingleChildScrollView( + padding: + EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + child: Container( + height: 500, + width: 380, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.4), + offset: const Offset( + 0, + 0, + ), + blurRadius: 10.0, + spreadRadius: 2.0, ), - blurRadius: 10.0, - spreadRadius: 2.0, + BoxShadow( + color: Colors.white.withOpacity(0.3), + offset: const Offset(0.0, 0.0), + blurRadius: 0.0, + spreadRadius: 0.0, + ),//BoxShadow//BoxShadow + ], + color: Color(0xFF232123), + borderRadius: BorderRadius.only( + topRight: Radius.circular(30), + topLeft: Radius.circular(30), ), - BoxShadow( - color: Colors.white.withOpacity(0.3), - offset: const Offset(0.0, 0.0), - blurRadius: 0.0, - spreadRadius: 0.0, - ),//BoxShadow//BoxShadow - ], - color: Color(0xFF232123), - borderRadius: BorderRadius.only( - topRight: Radius.circular(30), - topLeft: Radius.circular(30), ), - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), - child: Column( - children: [ - - Container( - height: 5, - width: 130, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: Color(0xFF8A8A8A), - ), - ), - SizedBox(height: 30,), - Container( - width: double.infinity, - height: 300, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: Color(0xFF302C30), + child: Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + child: Column( + children: [ + + Container( + height: 5, + width: 130, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Color(0xFF8A8A8A), + ), ), - child: Padding( - padding: EdgeInsets.all(20), - child: TextField( - controller: messageTextField, - maxLength: 300, - style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), - expands: true, - maxLines: null, - textInputAction: TextInputAction.send, - decoration: InputDecoration( - hintStyle: TextStyle( - color: Colors.white, + SizedBox(height: 30,), + Container( + width: double.infinity, + height: 300, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Color(0xFF302C30), + ), + child: Padding( + padding: EdgeInsets.all(20), + child: TextField( + keyboardAppearance: Brightness.dark, + controller: messageTextField, + maxLength: 300, + style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), + expands: true, + maxLines: null, + textInputAction: TextInputAction.send, + decoration: InputDecoration( + hintStyle: TextStyle( + color: Colors.white, + ), + border: InputBorder.none, + hintText: "Mon message", ), - border: InputBorder.none, - hintText: "Mon message", ), ), ), - ), - SizedBox(height: 20,), - SizedBox( - width: double.infinity, - height: 70, - child: ElevatedButton( - onPressed: () { - sendMessage(messageTextField.text, MyApp().controller.currentUser.Spots2.last.user); - }, - style: ElevatedButton.styleFrom( - primary: Color(0xFF3F1DC3), - textStyle: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(17) + SizedBox(height: 20,), + SizedBox( + width: double.infinity, + height: 70, + child: ElevatedButton( + onPressed: () { + sendMessage(messageTextField.text, MyApp().controller.currentUser.Spots2.last.user); + }, + style: ElevatedButton.styleFrom( + primary: Color(0xFF3F1DC3), + textStyle: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(17) + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text("Envoyer"), + Opacity(opacity: 0.2, + child: Image.asset("assets/images/send_logo.png",),) + ], ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text("Envoyer"), - Opacity(opacity: 0.2, - child: Image.asset("assets/images/send_logo.png",),) - ], - ), - ), - ) - ], + ) + ], + ), ), - ), + ), ); diff --git a/Sources/dafl_project_flutter/lib/model/user.dart b/Sources/dafl_project_flutter/lib/model/user.dart index 56a269f..55eafc6 100644 --- a/Sources/dafl_project_flutter/lib/model/user.dart +++ b/Sources/dafl_project_flutter/lib/model/user.dart @@ -43,11 +43,11 @@ class User{ Map conversations={}; void addDiscovery(Music newmusic){ - if(MyApp().controller?.currentUser?.Discovery == null){ + if(MyApp().controller.currentUser.Discovery == null){ } else{ - MyApp().controller.currentUser?.Discovery.add(newmusic); + MyApp().controller.currentUser.Discovery.add(newmusic); } 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 781c451..ac896cf 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 @@ -54,7 +54,7 @@ class _HomePageState extends State { ); }, child: Text("S’INSCRIRE MAINTENANT", - style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold), + style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold,fontFamily: "DMSans"), textAlign: TextAlign.center, ), ),), @@ -74,7 +74,7 @@ class _HomePageState extends State { child: Align( alignment: Alignment.center, child: Text("SE CONNECTER", - style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.bold), + style: TextStyle(color: Colors.white ,fontFamily: "DMSans",fontSize: 17, fontWeight: FontWeight.bold), textAlign: TextAlign.center, ), ), 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 f16a930..be59dd0 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 @@ -164,14 +164,7 @@ class _ConversationPageState extends State { color: Color(0xFF141414), height: height*0.92, width: double.infinity, - child: /*ListView( - reverse: true, - scrollDirection: Axis.vertical, - children: [ - messages; - ], - ),*/ - ListView.builder( + child: ListView.builder( controller: listScrollController, physics: BouncingScrollPhysics(), itemCount: messages.length, @@ -269,119 +262,127 @@ class _ConversationPageState extends State { Widget buildSheet(){ String dropdownValue = list.first; final messageTextField = TextEditingController(); - return Container( - height: 550, - width: double.infinity, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.4), - offset: const Offset( - 0, - 0, + return SingleChildScrollView( + padding: + EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + child:Container( + height: 500, + width: double.infinity, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.4), + offset: const Offset( + 0, + 0, + ), + blurRadius: 10.0, + spreadRadius: 2.0, ), - blurRadius: 10.0, - spreadRadius: 2.0, + BoxShadow( + color: Colors.white.withOpacity(0.3), + offset: const Offset(0.0, 0.0), + blurRadius: 0.0, + spreadRadius: 0.0, + ),//BoxShadow//BoxShadow + ], + color: Color(0xFF232123), + borderRadius: BorderRadius.only( + topRight: Radius.circular(30), + topLeft: Radius.circular(30), ), - BoxShadow( - color: Colors.white.withOpacity(0.3), - offset: const Offset(0.0, 0.0), - blurRadius: 0.0, - spreadRadius: 0.0, - ),//BoxShadow//BoxShadow - ], - color: Color(0xFF232123), - borderRadius: BorderRadius.only( - topRight: Radius.circular(30), - topLeft: Radius.circular(30), ), - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + child: Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ - Container( - height: 5, - width: 130, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: Color(0xFF8A8A8A), - ), - ), - 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, - decoration: BoxDecoration( - color: Colors.grey.shade900, - borderRadius: BorderRadius.circular(15), + Container( + height: 5, + width: 130, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Color(0xFF8A8A8A), + ), ), - 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(),), - ], - ),), - Padding(padding: EdgeInsets.fromLTRB(0, 20, 0, 20), - child: Column( - children: [ - Container( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), - width: double.infinity, - decoration: BoxDecoration( - color: Colors.grey.withOpacity(0.07), - borderRadius: BorderRadius.circular(15), + 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, + decoration: BoxDecoration( + color: Colors.grey.shade900, + borderRadius: BorderRadius.circular(15), + ), + 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(),), + ], + ),), + Padding(padding: EdgeInsets.fromLTRB(0, 20, 0, 20), + child: Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + width: double.infinity, + decoration: BoxDecoration( + color: Colors.grey.withOpacity(0.07), + borderRadius: BorderRadius.circular(15), + ), + child: TextField( + keyboardAppearance: Brightness.dark, + onTap: (){ + }, + style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), + maxLines: 3, + textInputAction: TextInputAction.done, + decoration: InputDecoration( + hintText: '* Commentaires', + hintStyle: TextStyle( + fontSize: 15, + color: Colors.white, + ), + border: InputBorder.none, + ), + ),), + ], + )), + Spacer(), + Padding(padding: EdgeInsets.fromLTRB(0, 0, 0, 50), + child: SizedBox( + width: double.infinity, + height: 70, + child: ElevatedButton( + onPressed: () { + }, + style: ElevatedButton.styleFrom( + primary: Colors.red, + textStyle: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(17) + ), ), - child: TextField( - style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), - maxLines: 3, - textInputAction: TextInputAction.done, - decoration: InputDecoration( - hintText: '* Commentaires', - hintStyle: TextStyle( - fontSize: 15, - color: Colors.white, + 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"),), + ], ), - border: InputBorder.none, ), ),), - ], - )), - Spacer(), - Padding(padding: EdgeInsets.fromLTRB(0, 0, 0, 50), - child: SizedBox( - width: double.infinity, - height: 70, - child: ElevatedButton( - onPressed: () { - }, - style: ElevatedButton.styleFrom( - primary: Colors.red, - textStyle: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(17) - ), - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("Envoyer le signalement"), - ], - ), - ), - ),), - ], + ], + ), ), - ), - ); + ) ,); } } diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart b/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart index 4a083b9..c66bd71 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart @@ -41,11 +41,11 @@ class _MainPageState extends State { ), child: ConstrainedBox( constraints: BoxConstraints( - minHeight: height*0.1, + minHeight: 100, maxHeight: 100, ), child: NavigationBar( - animationDuration: Duration(seconds: 1), + animationDuration: Duration(microseconds: 800), selectedIndex: index, height: height*0.1, onDestinationSelected: (index) => 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 cb1fc71..57635cb 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 @@ -79,9 +79,9 @@ class _DiscoveryListState extends State { } Widget build(BuildContext context) { return RefreshIndicator(child: ListView.builder( - itemCount: MyApp().controller.currentUser.Discovery.length ?? 0, + itemCount: MyApp().controller.currentUser.Discovery.length, itemBuilder: (context, index){ - int itemCount = MyApp().controller.currentUser.Discovery.length ?? 0; + int itemCount = MyApp().controller.currentUser.Discovery.length; int reversedIndex = itemCount - 1 - index; return Dismissible( key: Key(MyApp().controller.currentUser.Discovery[reversedIndex].name), @@ -113,8 +113,8 @@ class _DiscoveryListState extends State { 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),), + 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),), ], ),), @@ -128,7 +128,7 @@ class _DiscoveryListState extends State { ), onDismissed: (direction) { if(direction == DismissDirection.startToEnd) - MyApp().controller.currentUser?.Discovery.removeAt(reversedIndex); + MyApp().controller.currentUser.Discovery.removeAt(reversedIndex); }, background: Container(decoration: BoxDecoration( image: DecorationImage(image: AssetImage("assets/images/delete_background.png"), fit: BoxFit.cover), 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 d62f9e9..c25f7d9 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 @@ -56,7 +56,7 @@ class _MainPageProfilState extends State { margin: EdgeInsets.fromLTRB(30, 50, 0, 0), child: Text( "Profil", - style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600, color: Colors.white),), + style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600, color: Colors.white, fontFamily: "DMSans"),), ), Container( margin: EdgeInsets.fromLTRB(0, 10, 0, 10), @@ -76,7 +76,7 @@ class _MainPageProfilState extends State { ), child: Center( - child: Text(username![0] ?? '', + child: Text(username![0], style: TextStyle(color: Colors.white ,fontSize: 60, fontWeight: FontWeight.w500), textAlign: TextAlign.center, ), 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 ab0daa5..5c26591 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,8 @@ 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; @@ -58,6 +58,7 @@ class _SettingsWidgetState extends State { SizedBox( width: 230, child: TextField( + keyboardAppearance: Brightness.dark, controller: userNameTextField, style: TextStyle(color: Colors.white), decoration: InputDecoration( @@ -111,6 +112,7 @@ class _SettingsWidgetState extends State { SizedBox( width: 230, child: TextField( + keyboardAppearance: Brightness.dark, controller: passwordTextField, obscureText: true, style: TextStyle(color: Colors.white), 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 50d9e3a..be80471 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 @@ -74,6 +74,7 @@ class _SignInPageState extends State { ), Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( + keyboardAppearance: Brightness.dark, controller: userNameTextField, decoration: InputDecoration( border: InputBorder.none, @@ -118,6 +119,7 @@ class _SignInPageState extends State { ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( + keyboardAppearance: Brightness.dark, controller: passwordTextField, obscureText: true, decoration: InputDecoration( 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 e09ee2a..23572b2 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 @@ -75,6 +75,7 @@ class _SignUpPageState extends State { ), Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( + keyboardAppearance: Brightness.dark, controller: userNameTextField, decoration: InputDecoration( border: InputBorder.none, @@ -119,6 +120,7 @@ class _SignUpPageState extends State { ),Padding(padding: EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( + keyboardAppearance: Brightness.dark, controller: passwordTextField, obscureText: true, decoration: InputDecoration( diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock index 1ffe1de..d30318a 100644 --- a/Sources/dafl_project_flutter/pubspec.lock +++ b/Sources/dafl_project_flutter/pubspec.lock @@ -191,6 +191,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + home_indicator: + dependency: "direct main" + description: + name: home_indicator + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" html: dependency: transitive description: diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 12d9cee..ea03465 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -46,6 +46,7 @@ dependencies: postgresql2: ^1.0.3 path_provider: ^2.0.11 font_awesome_flutter: ^10.2.1 + home_indicator: ^2.0.2 dev_dependencies: flutter_test: From d265a8e49ff4bc9a318218726110490d58d92c47 Mon Sep 17 00:00:00 2001 From: delanierlucas Date: Mon, 14 Nov 2022 17:42:13 +0100 Subject: [PATCH 6/6] commit avant merge --- Sources/dafl_project_flutter/lib/main.dart | 8 ++-- .../lib/views/pages/main/w_top.dart | 39 ++++++++----------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart index 637078d..7ecbd90 100644 --- a/Sources/dafl_project_flutter/lib/main.dart +++ b/Sources/dafl_project_flutter/lib/main.dart @@ -405,6 +405,8 @@ class _SplashState extends State { } } Object Notify(int index, context, {bool isError = true}){ + double height = MediaQuery.of(context).size.height; + double width = MediaQuery.of(context).size.width; String message; if(isError == true){ switch(index){ @@ -443,7 +445,7 @@ Object Notify(int index, context, {bool isError = true}){ children: [ Container( - padding: EdgeInsets.all(16), + padding: EdgeInsets.fromLTRB(20,height/110,20,0), height: 90, child: Row( children: [ @@ -454,7 +456,7 @@ Object Notify(int index, context, {bool isError = true}){ Expanded(child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Oh oh !", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),), + Text("Ho ho !", style: TextStyle( fontWeight: FontWeight.bold),), Text(message,style: TextStyle( ), overflow: TextOverflow.ellipsis, @@ -515,7 +517,7 @@ Object Notify(int index, context, {bool isError = true}){ children: [ Container( - padding: EdgeInsets.all(16), + padding: EdgeInsets.fromLTRB(20,height/110,20,0), height: 90, child: Row( children: [ diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_top.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_top.dart index 26c28bf..d0771b1 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_top.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_top.dart @@ -55,6 +55,8 @@ class _TopsWidgetState extends State { class TopWidget extends StatelessWidget{ @override Widget build(BuildContext context) { + double height = MediaQuery.of(context).size.height; + double width = MediaQuery.of(context).size.width; return Container( padding: EdgeInsets.fromLTRB(30, 0, 30, 0), width: double.infinity, @@ -102,10 +104,12 @@ class TopWidget extends StatelessWidget{ placeholder: "assets/images/loadingPlaceholder.gif", image: 'https://images.genius.com/ef4849be3da5fdb22ea9e656679be3a3.600x600x1.jpg'), ), ), - Stack( + Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( - margin: EdgeInsets.fromLTRB(12, 5, 80, 60), + margin: EdgeInsets.fromLTRB(12, 5, 0, 0), child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, @@ -115,30 +119,21 @@ class TopWidget extends StatelessWidget{ ], ), ), - Positioned( - bottom: 0, - right: 0, - child: Row( - children: [ - GradientText( - '7,2%', - style: const TextStyle(fontSize: 60, fontWeight: FontWeight.bold), - gradient: LinearGradient(colors: [ - Colors.orange, - Colors.red, - Colors.purple, - ]), - ), - ], - ), - ), + GradientText( + '7,2%', + style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 40), + gradient: LinearGradient(colors: [ + Colors.orange, + Colors.red, + Colors.purple, + ]), + ), + ], + ), ], ), - ], ), - ], - ), ); } }