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