diff --git a/lib/pages/search/controller.dart b/lib/pages/search/controller.dart index 69b4a1d7..448ccd8a 100644 --- a/lib/pages/search/controller.dart +++ b/lib/pages/search/controller.dart @@ -1,3 +1,4 @@ +import 'package:PiliPlus/common/widgets/dialog.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -132,8 +133,14 @@ class SSearchController extends GetxController { } onClearHistory() { - historyList.clear(); - GStorage.historyWord.put('cacheList', []); + showConfirmDialog( + context: Get.context!, + title: '确定清空搜索历史?', + onConfirm: () { + historyList.clear(); + GStorage.historyWord.put('cacheList', []); + }, + ); } @override diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 3dba1583..9bf4df0c 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -165,7 +165,7 @@ class Utils { ), ); } - } catch (e) {} + } catch (_) {} } }