showTopicActions static method
Implementation
static Future<void> showTopicActions({
required BuildContext context,
required String currentTitle,
required Future<NIMResult<dynamic>> Function(String title) onRename,
required Future<NIMResult<void>> Function() onDelete,
bool Function()? checkNetwork,
}) async {
final action = await showCupertinoModalPopup<_BotSubsessionAction>(
context: context,
builder: (context) {
return CupertinoActionSheet(
actions: [
CupertinoActionSheetAction(
onPressed: () {
Navigator.pop(context, _BotSubsessionAction.rename);
},
child: Text(S.of(context).botSubsessionRename),
),
CupertinoActionSheetAction(
isDestructiveAction: true,
onPressed: () {
Navigator.pop(context, _BotSubsessionAction.delete);
},
child: Text(S.of(context).chatMessageActionDelete),
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () {
Navigator.pop(context);
},
child: Text(S.of(context).messageCancel),
),
);
},
);
if (!context.mounted) {
return;
}
switch (action) {
case _BotSubsessionAction.rename:
await _renameTopic(
context: context,
currentTitle: currentTitle,
onRename: onRename,
checkNetwork: checkNetwork,
);
break;
case _BotSubsessionAction.delete:
await _deleteTopic(
context: context,
onDelete: onDelete,
);
break;
case null:
break;
}
}