showDeleteSearchHistoryPrompt method

void showDeleteSearchHistoryPrompt()

Shows when the clear search history is shown.

Implementation

void showDeleteSearchHistoryPrompt() async {
  Widget alertDialog = AlertDialog(
    title: Text(t.clear_search_title),
    content: Text(
      t.clear_search_description,
    ),
    actions: <Widget>[
      TextButton(
        child: Text(
          t.dialog_clear,
          style: TextStyle(
            color: theme.colorScheme.primary,
          ),
        ),
        onPressed: () async {
          appModel.clearSearchHistory(historyKey: mediaSource.uniqueKey);
          mediaType.floatingSearchBarController.clear();

          setState(() {});
          Navigator.pop(context);
        },
      ),
      TextButton(
        child: Text(t.dialog_cancel),
        onPressed: () => Navigator.pop(context),
      ),
    ],
  );

  await showDialog(
    context: context,
    builder: (context) => alertDialog,
  );
}