diff --git a/.vscode/settings.json b/.vscode/settings.json index 8c26f35..22694e8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,13 +11,20 @@ "statusBar.background": "#0f0f0f", "statusBar.foreground": "#e7e7e7", "statusBarItem.hoverBackground": "#282828", - "statusBarItem.remoteBackground": "#0f0f0f", + "statusBarItem.remoteBackground": "#8f3030", "statusBarItem.remoteForeground": "#e7e7e7", "titleBar.activeBackground": "#0f0f0f", "titleBar.activeForeground": "#e7e7e7", "titleBar.inactiveBackground": "#0f0f0f99", "titleBar.inactiveForeground": "#e7e7e799", - "commandCenter.border": "#e7e7e799" + "commandCenter.border": "#e7e7e799", + "activityBarTop.activeBackground": "#282828", + "activityBarTop.background": "#282828", + "activityBarTop.foreground": "#e7e7e7", + "activityBarTop.inactiveForeground": "#e7e7e799", + "commandCenter.foreground": "#e7e7e7", + "statusBar.debuggingBackground": "#0f0f0f", + "statusBar.debuggingForeground": "#e7e7e7" }, "peacock.color": "0F0F0F", "editor.codeActionsOnSave": { diff --git a/README.md b/README.md index 26accef..4f03ee2 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ Repository: This project is licensed under the terms in the `LICENSE` file. -## Authors +## Contributors diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 94adc3a..eac5ff9 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,7 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true +# This builtInKotlin flag was added automatically by Flutter migrator +android.builtInKotlin=false +# This newDsl flag was added automatically by Flutter migrator +android.newDsl=false diff --git a/example/lib/main.dart b/example/lib/main.dart index d286f58..6e53fa5 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -48,10 +48,34 @@ class ExampleWidget extends StatelessWidget { ), body: const TabBarView( children: [ - BasicSearchableListview(), - AsyncSearchableListview(), - SliverSearchableListview(), - ExpansionSearchableListview(), + Padding( + padding: EdgeInsets.symmetric( + vertical: 5, + horizontal: 10, + ), + child: BasicSearchableListview(), + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 5, + horizontal: 10, + ), + child: AsyncSearchableListview(), + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 5, + horizontal: 10, + ), + child: SliverSearchableListview(), + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 5, + horizontal: 10, + ), + child: ExpansionSearchableListview(), + ), ], ), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index 138da22..8307be8 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -145,7 +145,7 @@ packages: path: ".." relative: true source: path - version: "2.19.4" + version: "2.19.5" sky_engine: dependency: transitive description: flutter diff --git a/lib/searchable_listview.dart b/lib/searchable_listview.dart index a600d38..97aaf91 100644 --- a/lib/searchable_listview.dart +++ b/lib/searchable_listview.dart @@ -1,6 +1,7 @@ // ignore_for_file: must_be_immutable import 'dart:async'; +import 'dart:developer'; import 'package:async/async.dart'; import 'package:flutter/material.dart'; @@ -88,7 +89,7 @@ class SearchableList extends StatefulWidget { required this.asyncListCallback, required this.asyncListFilter, required this.itemBuilder, - this.asyncDebounceTime = 0, + this.asyncDebounceTime = 3000, this.loadingWidget, this.errorWidget, this.searchTextController, @@ -288,7 +289,7 @@ class SearchableList extends StatefulWidget { /// Debouncing time when typing in search field in milliseconds /// Wait [asyncDebounceTime] milliseconds without any new entry before invoking [asyncListFilter] - int asyncDebounceTime = 0; + int asyncDebounceTime = 3000; /// Loading widget displayed when [asyncListCallback] is loading /// if nothing is provided in [loadingWidget] searchable list will display a [CircularProgressIndicator] @@ -551,6 +552,10 @@ class _SearchableListState extends State> { @override void dispose() { + log('disposing searchable listview'); + if (widget.focusNode?.hasFocus == true) { + FocusScope.of(context).requestFocus(FocusNode()); + } if (widget.scrollController == null) { scrollController.dispose(); } @@ -802,6 +807,7 @@ class _SearchableListState extends State> { _debouncer!.run(() async { if (mounted) setState(() {}); _activeOperation?.cancel(); + log('Filtering list with value: $value'); await _asyncFilter(value); if (mounted) setState(() {}); });