rectification bug setstate
continuous-integration/drone/push Build is passing Details

messagerie_lucas_test
Lucas DELANIER 2 years ago
parent 08ca05f6f4
commit 7763284364

@ -171,7 +171,7 @@ class CardProvider extends ChangeNotifier{
); );
} }
else{ 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); MyApp().controller.currentUser.addDiscovery(MyApp().controller.currentUser.Spots2.last.music);
Fluttertoast.showToast( Fluttertoast.showToast(
msg: 'Ajouté', msg: 'Ajouté',
@ -264,7 +264,7 @@ class CardProvider extends ChangeNotifier{
style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200),
expands: true, expands: true,
maxLines: null, maxLines: null,
keyboardType: TextInputType.multiline, textInputAction: TextInputAction.send,
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: TextStyle( hintStyle: TextStyle(
color: Colors.white, color: Colors.white,

@ -28,7 +28,6 @@ class _ConversationPageState extends State<ConversationPage> {
void SendMessage(String content){ void SendMessage(String content){
setState(() { setState(() {
messages.add(MessageWidget(Message(MyApp().controller.currentUser,content))); messages.add(MessageWidget(Message(MyApp().controller.currentUser,content)));
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) { Widget MessageWidget(Message message) {
@ -117,6 +116,7 @@ class _ConversationPageState extends State<ConversationPage> {
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: AppBar( appBar: AppBar(
elevation: 20,
backgroundColor: Color(0xFF141414), backgroundColor: Color(0xFF141414),
toolbarHeight: 70, toolbarHeight: 70,
title: Container( title: Container(
@ -133,12 +133,30 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
SizedBox(width: 20,), SizedBox(width: 20,),
Text("Max"), 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( body: SingleChildScrollView(
child: child:
@ -186,14 +204,14 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
child: Padding( child: Padding(
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
child: TextField( child: TextField(
controller: messageTextField, controller: messageTextField,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: TextStyle(color: Colors.white), hintStyle: TextStyle(color: Colors.white.withOpacity(0.7)),
border: InputBorder.none, border: InputBorder.none,
hintText: "Envoyer un message...", hintText: "Votre message...",
), ),
cursorColor: Colors.purple, cursorColor: Colors.purple,
textAlign: TextAlign.left, textAlign: TextAlign.left,
@ -209,7 +227,7 @@ class _ConversationPageState extends State<ConversationPage> {
SendMessage(messageTextField.text); SendMessage(messageTextField.text);
if (listScrollController.hasClients) { if (listScrollController.hasClients) {
final position = listScrollController.position.maxScrollExtent; final position = listScrollController.position.maxScrollExtent;
listScrollController.jumpTo(position+40); listScrollController.jumpTo(position);
} }
messageTextField.clear(); messageTextField.clear();
@ -242,5 +260,168 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
); );
}
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<DropdownButtonReason> createState() => _DropdownButtonReasonState();
}
const List<String> list = <String>['Insulte', 'Racisme', 'Messages inappropriés', "Usurpation d'identité"];
class _DropdownButtonReasonState extends State<DropdownButtonReason> {
String dropdownValue = list.first;
@override
Widget build(BuildContext context) {
return DropdownButton<String>(
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<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
);
} }
} }

@ -18,14 +18,26 @@ class _ProfilWidgetState extends State<ProfilWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
return MainPageProfil(); return MainPageProfil();
} }
} }
class MainPageProfil extends StatelessWidget { class MainPageProfil extends StatefulWidget {
const MainPageProfil({super.key}); const MainPageProfil({Key? key}) : super(key: key);
@override
State<MainPageProfil> createState() => _MainPageProfilState();
}
class _MainPageProfilState extends State<MainPageProfil> {
String? username = MyApp().controller.currentUser.usernameDafl;
@override
void initState() {
super.initState();
String username = MyApp().controller.currentUser.usernameDafl ?? "default";
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -64,13 +76,13 @@ class MainPageProfil extends StatelessWidget {
), ),
child: Center( child: Center(
child: Text(MyApp().controller.currentUser.usernameDafl![0] ?? '', child: Text(username![0] ?? '',
style: TextStyle(color: Colors.white ,fontSize: 60, fontWeight: FontWeight.w500), style: TextStyle(color: Colors.white ,fontSize: 60, fontWeight: FontWeight.w500),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
), ),
Text(MyApp().controller.currentUser.usernameDafl ?? '', Text(username!,
style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.w400), style: TextStyle(color: Colors.white ,fontSize: 17, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -221,7 +233,9 @@ class MainPageProfil extends StatelessWidget {
),// background// foreground ),// background// foreground
), ),
onPressed: () { 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( child: Row(
children: [ children: [
@ -245,3 +259,4 @@ class MainPageProfil extends StatelessWidget {
} }
} }

@ -91,7 +91,6 @@ flutter:
assets: assets:
- assets/images/ - assets/images/
- assets/fonts/ - assets/fonts/
- assets/logs.txt
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware # https://flutter.dev/assets-and-images/#resolution-aware

Loading…
Cancel
Save