diff --git a/lib/pages/home/search_page.dart b/lib/pages/home/search_page.dart index 1397c8d7..d40bfb1a 100755 --- a/lib/pages/home/search_page.dart +++ b/lib/pages/home/search_page.dart @@ -108,7 +108,8 @@ class SearchPageState extends State with AutomaticKeepAliveClientMix } void search(BuildContext context, String content, {bool isMore = false}) { - if (_controller.text?.trim()?.isNotEmpty ?? false) { + final String query = filteredSearchQuery(content); + if (query?.isNotEmpty ?? false) { _focusNode.unfocus(); _loading = true; if (!isMore) { @@ -137,6 +138,21 @@ class SearchPageState extends State with AutomaticKeepAliveClientMix } } + String filteredSearchQuery(String query) { + String result; + if (query?.isNotEmpty ?? false) { + result = query + .replaceAll('+', '') + .replaceAll('-', '') + .replaceAll('*', '') + .replaceAll('/', '') + .replaceAll('=', '') + .replaceAll('\$', '') + .trim(); + } + return result; + } + Widget get searchButton => IconButton( icon: Icon(Icons.search, size: suSetWidth(30.0)), onPressed: () {