Untitled
unknown
dart
4 years ago
3.4 kB
8
Indexable
void _sendMessage() {
String messageText = _messageController.text.trim();
_messageController.text = '';
print(messageText);
if (messageText != '') {
var messagePost = {
'CustomerID': customerID,
'DriverID': GlobalV.user.driver.sId,
'Message': messageText,
};
WebServices.socket.emit('SendMessageToCustomer', messagePost);
}
}
Widget messageWidget(height, width) {
return ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
cacheExtent: 1000,
itemCount: ConversationsModel.conversations.length,
itemBuilder: (BuildContext context, int index) {
var customer = ConversationsModel
.conversations[index].participants.first.userID !=
GlobalV.user.driver.sId
? ConversationsModel.conversations[index].participants.first
: ConversationsModel.conversations[index].participants.last;
return InkWell(
onTap: () {
customerID = customer.userID;
customerName = customer.fullName;
WebServices.socket.emit('get-conversation-between', {
'User1': customerID, // 1.kişinin ID si
'User2': GlobalV.user.driver.sId, //2. kişinin ID si
'Limit': 5 //Kaç adet mesajın döndürüleceği
});
setState(() {
isMessageOpened = true;
});
},
child: Card(
elevation: 30,
color: Colors.grey[50],
shape: RoundedRectangleBorder(
// side: BorderSide(width: 1),
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(25),
topRight: Radius.circular(25))),
child: ClipPath(
clipper: ShapeBorderClipper(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25))),
child: Container(
height: height * 0.075,
decoration: BoxDecoration(
border: Border(
right: BorderSide(color: Colors.amber, width: 25))),
child: Row(
children: [
SizedBox(
width: width * 0.2,
child: FittedBox(
fit: BoxFit.contain,
child: Padding(
padding: EdgeInsets.all(height * 0.05),
child:
Image(image: AssetImage('assets/customer.png')),
),
),
),
SizedBox(
width: width * 0.6,
height: height * 0.033,
child: FittedBox(
alignment: Alignment.centerLeft,
fit: BoxFit.contain,
child: Text(
customer.fullName,
),
),
),
],
),
),
),
),
);
});
}Editor is loading...