|
|
@ -27,11 +27,14 @@ 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) {
|
|
|
|
if(message.sender != MyApp().controller.currentUser){
|
|
|
|
if(message.sender != MyApp().controller.currentUser){
|
|
|
|
return Container(
|
|
|
|
return Align(
|
|
|
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(40, 7, 80, 7),
|
|
|
|
margin: EdgeInsets.fromLTRB(40, 7, 80, 7),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
@ -48,10 +51,13 @@ class _ConversationPageState extends State<ConversationPage> {
|
|
|
|
padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
|
|
|
|
padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
|
|
|
|
child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),
|
|
|
|
child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
return Container(
|
|
|
|
return Align(
|
|
|
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(80, 7, 40, 7),
|
|
|
|
margin: EdgeInsets.fromLTRB(80, 7, 40, 7),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
@ -63,9 +69,9 @@ class _ConversationPageState extends State<ConversationPage> {
|
|
|
|
color: Color(0xFF2F2F2F),
|
|
|
|
color: Color(0xFF2F2F2F),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
|
|
|
|
padding: EdgeInsets.all(15),
|
|
|
|
child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),
|
|
|
|
child: Text(message.content,style: TextStyle(fontFamily: 'DMSans', color: Colors.white ,fontSize: 15, fontWeight: FontWeight.w400),),
|
|
|
|
)),
|
|
|
|
),),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -84,6 +90,7 @@ class _ConversationPageState extends State<ConversationPage> {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
double height = MediaQuery.of(context).size.height;
|
|
|
|
double height = MediaQuery.of(context).size.height;
|
|
|
|
double width = MediaQuery.of(context).size.width;
|
|
|
|
double width = MediaQuery.of(context).size.width;
|
|
|
|
|
|
|
|
ScrollController listScrollController = ScrollController();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
@ -127,6 +134,7 @@ class _ConversationPageState extends State<ConversationPage> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),*/
|
|
|
|
),*/
|
|
|
|
ListView.builder(
|
|
|
|
ListView.builder(
|
|
|
|
|
|
|
|
controller: listScrollController,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
itemCount: messages.length,
|
|
|
|
itemCount: messages.length,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
@ -177,6 +185,11 @@ class _ConversationPageState extends State<ConversationPage> {
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
|
|
|
|
SendMessage(messageTextField.text);
|
|
|
|
SendMessage(messageTextField.text);
|
|
|
|
|
|
|
|
if (listScrollController.hasClients) {
|
|
|
|
|
|
|
|
final position = listScrollController.position.maxScrollExtent;
|
|
|
|
|
|
|
|
listScrollController.jumpTo(position+40);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
messageTextField.clear();
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|