Skip to content

Commit

Permalink
#61 fix: message - ChatScreen hint message
Browse files Browse the repository at this point in the history
  • Loading branch information
opjoobe committed Jul 29, 2022
1 parent 8f42391 commit 7b3e16d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/screens/message/chat_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ class _ChatScreenState extends State<ChatScreen> {
final bool _showSpinner = false;
final bool _showVisibleWidget = false;
final bool _showErrorIcon = false;
var socketFlag = false;
bool socketFlag = false;
String hintmsg = 'Loading...';

void setStateIfMounted(f) {
if (mounted) setState(f);
Expand Down Expand Up @@ -184,6 +185,7 @@ class _ChatScreenState extends State<ChatScreen> {
socket.emit('join', widget.chatroomID);
setState(() {
socketFlag = true;
hintmsg = 'Write message...';
});
debugPrint('연결완료');
});
Expand All @@ -205,6 +207,10 @@ class _ChatScreenState extends State<ChatScreen> {
});
socket.on('disconnect', (data) {
debugPrint('socket disconnected');
setState(() {
socketFlag = false;
hintmsg = 'Disconnected...';
});
socket.disconnect();
});
// socket.onDisconnect((_) => debugPrint('disconnect'));
Expand Down Expand Up @@ -368,8 +374,7 @@ class _ChatScreenState extends State<ChatScreen> {
onTap: () {},
decoration: InputDecoration.collapsed(
enabled: socketFlag ? true : false,
hintText:
socketFlag ? 'Write message...' : 'Loading...',
hintText: hintmsg,
hintStyle: TextStyle(color: Colors.grey),
border: InputBorder.none),
controller: _messageController,
Expand Down

0 comments on commit 7b3e16d

Please sign in to comment.