aiButtonTap method
Implementation
aiButtonTap(
CometChatTheme theme,
BuildContext context,
id,
) async {
List<CometChatMessageComposerAction> aiFeatureList =
CometChatUIKit.getDataSource()
.getAIOptions(user, group, theme, context, id, aiOptionStyle);
if (aiFeatureList.isNotEmpty) {
List<CometChatMessageComposerAction> actionList = [];
for (int i = 0; i < aiFeatureList.length; i++) {
actionList.add(CometChatMessageComposerAction(
id: aiFeatureList[i].id,
title: aiFeatureList[i].title,
titleStyle:
aiFeatureList[i].titleStyle ?? aiOptionStyle?.itemTextStyle,
background:
aiFeatureList[i].background ?? aiOptionStyle?.background,
cornerRadius:
aiFeatureList[i].cornerRadius ?? aiOptionStyle?.borderRadius,
onItemClick: (BuildContext context, User? user, Group? group) {
if (aiFeatureList[i].onItemClick != null) {
aiFeatureList[i].onItemClick!(context, user, group);
}
}));
}
showCometChatAiOptionSheet(
context: context,
theme: theme,
user: user,
group: group,
actionItems: actionList,
backgroundColor: theme.palette.getBackground(),
);
return;
}
}