itemsDelete method

dynamic itemsDelete(
  1. BuildContext context
)

Implementation

itemsDelete(BuildContext context) {
  Helper.showAlert(
      message:
          "${AppConstants.delete} ${selectedChatsPosition.length} ${AppConstants.selectedChats}?",
      actions: [
        TextButton(
            onPressed: () {
              Navigator.pop(context);
              // Get.back();
            },
            child: Text(AppConstants.no,
                style:
                    TextStyle(color: MirrorflyUikit.getTheme?.primaryColor))),
        TextButton(
            onPressed: () async {
              Navigator.pop(context);
              // Get.back();
              Mirrorfly.deleteRecentChats(
                  jidList: selectedChats,
                  flyCallBack: (FlyResponse response) {
                    if (response.isSuccess) {
                      for (var chatItem in selectedChats) {
                        var chatIndex = recentChats
                            .indexWhere((element) => chatItem == element.jid);
                        recentChats.removeAt(chatIndex);
                      }
                      updateUnReadChatCount();
                      clearAllChatSelection();
                    }
                  });
            },
            child: Text(AppConstants.yes,
                style:
                    TextStyle(color: MirrorflyUikit.getTheme?.primaryColor))),
      ],
      context: context);
}