ソースを参照

Remove unnecessary rebuild

ashilkn 2 年 前
コミット
6bbc63cbc7
1 ファイル変更5 行追加3 行削除
  1. 5 3
      lib/ui/collection_action_sheet.dart

+ 5 - 3
lib/ui/collection_action_sheet.dart

@@ -155,9 +155,11 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
                             prefixIcon: Icons.search_rounded,
                             prefixIcon: Icons.search_rounded,
                             autoFocus: true,
                             autoFocus: true,
                             onChange: (value) {
                             onChange: (value) {
-                              setState(() {
-                                _searchQuery = value;
-                              });
+                              value != _searchQuery
+                                  ? setState(() {
+                                      _searchQuery = value;
+                                    })
+                                  : null;
                             },
                             },
                             cancellable: true,
                             cancellable: true,
                             shouldUnfocusOnCancelOrSubmit: true,
                             shouldUnfocusOnCancelOrSubmit: true,