showInComingMessage method
void
showInComingMessage(
- NERoomChatMessage chatRoomMessage
提示聊天室接受消息
Implementation
void showInComingMessage(NERoomChatMessage chatRoomMessage) {
// 聊天菜单不显示时,不出现聊天气泡
if (!_isMenuItemShowing(NEMenuIDs.chatroom)) {
return;
}
String? content;
if (chatRoomMessage is NERoomChatTextMessage) {
content = chatRoomMessage.text;
}
if (content == null) {
return;
}
cancelInComingTips();
_overlayEntry = OverlayEntry(builder: (context) {
return SafeArea(
top: false,
child: Align(
alignment: Alignment.bottomRight,
child: Container(
margin: EdgeInsets.only(bottom: bottomBarHeight + 12, right: 12),
padding: EdgeInsets.all(12),
decoration: ShapeDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: <Color>[
UIColors.grey_292933,
UIColors.color_212129
]),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8))),
width: 240,
height: 60,
child: GestureDetector(
onTap: () {
_hideMorePopupMenu();
onChat();
},
child: Row(children: <Widget>[
buildHead(chatRoomMessage.fromNick),
SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
buildName(chatRoomMessage.fromNick),
buildContent(content)
]))
]))),
),
);
});
Overlay.of(context)!.insert(_overlayEntry!);
_inComingTipsTimer = Timer(const Duration(seconds: 5), () {
_overlayEntry?.remove();
_overlayEntry = null;
});
}