showClearPrompt method
- {required BuildContext context,
- required WidgetRef ref,
- required AppModel appModel}
Shows when the clear button is pressed.
Implementation
void showClearPrompt(
{required BuildContext context,
required WidgetRef ref,
required AppModel appModel}) async {
Widget alertDialog = AlertDialog(
title: Text(t.clear_message_title),
content: Text(t.clear_message_description),
actions: <Widget>[
TextButton(
child: Text(
t.dialog_clear,
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
onPressed: () async {
Navigator.pop(context);
await appModel.clearMessages();
mediaType.refreshTab();
},
),
TextButton(
child: Text(t.dialog_cancel),
onPressed: () => Navigator.pop(context),
),
],
);
await showDialog(
context: context,
builder: (context) => alertDialog,
);
}