Skip to content

Commit

Permalink
TW-727: close selection mode after action in chat list
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian KOUNE authored and hoangdat committed Oct 11, 2023
1 parent ca27d50 commit 66a5894
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/pages/chat_list/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ class ChatListController extends State<ChatList>
_clearSelectionItem();
}

Future<void> actionWithToggleSelectMode(Function action) async {
await action();
toggleSelectMode();
}

void _clearSelectionItem() {
conversationSelectionNotifier.value = [];
}
Expand Down Expand Up @@ -255,7 +260,6 @@ class ChatListController extends State<ChatList>
}
},
);
toggleSelectMode();
}

Future<void> toggleFavouriteRoom() async {
Expand All @@ -272,7 +276,6 @@ class ChatListController extends State<ChatList>
}
},
);
toggleSelectMode();
}

Future<void> toggleMuted() async {
Expand All @@ -291,7 +294,6 @@ class ChatListController extends State<ChatList>
}
},
);
toggleSelectMode();
}

Future<void> archiveAction() async {
Expand Down Expand Up @@ -507,19 +509,20 @@ class ChatListController extends State<ChatList>
) async {
switch (chatListBottomNavigatorBar) {
case ChatListSelectionActions.read:
await toggleUnread();
toggleSelectMode();
await actionWithToggleSelectMode(toggleUnread);
return;
case ChatListSelectionActions.mute:
await toggleMuted();
toggleSelectMode();
await actionWithToggleSelectMode(toggleMuted);
return;
case ChatListSelectionActions.pin:
await toggleFavouriteRoom();
toggleSelectMode();
await actionWithToggleSelectMode(toggleFavouriteRoom);
return;
case ChatListSelectionActions.more:
toggleSelectMode();
await actionWithToggleSelectMode(
() => {
TwakeSnackBar.show(context, 'Not implemented yet'),
},
);
return;
}
}
Expand Down

0 comments on commit 66a5894

Please sign in to comment.