From 002d418841a90c3609dda282426ba580ea737f8e Mon Sep 17 00:00:00 2001 From: vishalxl <> Date: Wed, 24 Aug 2022 23:58:21 +0530 Subject: [PATCH] printed name of channel at top --- lib/tree_ds.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/tree_ds.dart b/lib/tree_ds.dart index 3f49824..6a02ef8 100644 --- a/lib/tree_ds.dart +++ b/lib/tree_ds.dart @@ -419,6 +419,15 @@ class Tree { } void printChannel(ChatRoom room) { + String displayName = room.chatRoomId; + if( room.name != "") { + displayName = "${room.name} ( ${displayName.substring(0, 6)} )"; + } + + int lenDashes = 10; + String str = getNumSpaces(gNumLeftMarginSpaces + 10) + getNumDashes(lenDashes) + displayName + getNumDashes(lenDashes); + print(" ${getNumSpaces(gNumLeftMarginSpaces + displayName.length~/2 + 4)}In Channel"); + print("\n$str\n"); for(int i = 0; i < room.messageIds.length; i++) { String eId = room.messageIds[i]; @@ -430,10 +439,9 @@ class Tree { } } - // shows the given channelId, where channelId is prefix-id or channel name as mentioned in room.name. returns full id of channel. String showChannel(String channelId) { - + for( String key in chatRooms.keys) { if( key.substring(0, channelId.length) == channelId ) { ChatRoom? room = chatRooms[key]; @@ -451,7 +459,6 @@ class Tree { if( room.name.length < channelId.length) { continue; } - print("room = ${room.name} channelId = $channelId"); if( room.name.substring(0, channelId.length) == channelId ) { printChannel(room);