Skip to content

Commit

Permalink
Bug: menu mode didn't open choices when on hosted web. lcuis#9 and #39
Browse files Browse the repository at this point in the history
  • Loading branch information
lcuis committed Apr 17, 2020
1 parent 7446df2 commit 3de8dd3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 76 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.4

* Bug: menu mode didn't open choices when on hosted web. https://github.com/lcuis/search_choices/issues/9 and https://github.com/icemanbsi/searchable_dropdown/issues/39

## 1.1.3

* Corrected issue #21 to allow selection update from outside the plugin. Thanks to @lechuk and @ettiennelr !
Expand Down
91 changes: 21 additions & 70 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,69 +1,55 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "2.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
version: "1.1.3"
clock:
dependency: transitive
description:
name: convert
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
version: "1.0.1"
collection:
dependency: transitive
description:
name: crypto
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "1.14.12"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -74,13 +60,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
Expand All @@ -101,35 +80,14 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "1.7.0"
searchable_dropdown:
dependency: "direct dev"
description:
path: ".."
relative: true
source: path
version: "1.1.2"
version: "1.1.4"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -141,7 +99,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
version: "1.7.0"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -176,7 +134,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.15"
typed_data:
dependency: transitive
description:
Expand All @@ -191,12 +149,5 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.6.0 <3.0.0"
15 changes: 10 additions & 5 deletions lib/searchable_dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ class NotGiven {
const NotGiven();
}

class PointerThisPlease<T> {
T value;
PointerThisPlease(this.value);
}

Widget prepareWidget(dynamic object,
{dynamic parameter = const NotGiven(),
BuildContext context,
Expand Down Expand Up @@ -363,7 +368,7 @@ class SearchableDropdown<T> extends StatefulWidget {

class _SearchableDropdownState<T> extends State<SearchableDropdown<T>> {
List<int> selectedItems;
List<bool> displayMenu = [false];
PointerThisPlease<bool> displayMenu = PointerThisPlease<bool>(false);

TextStyle get _textStyle =>
widget.style ??
Expand Down Expand Up @@ -547,7 +552,7 @@ class _SearchableDropdownState<T> extends State<SearchableDropdown<T>> {
widget.onChanged(selectedResult);
}
} else {
displayMenu.first = true;
displayMenu.value = true;
}
setState(() {});
},
Expand Down Expand Up @@ -658,7 +663,7 @@ class _SearchableDropdownState<T> extends State<SearchableDropdown<T>> {
style: TextStyle(color: Colors.red, fontSize: 13),
)
: validatorOutput,
displayMenu.first ? menuWidget : SizedBox.shrink(),
displayMenu.value ? menuWidget : SizedBox.shrink(),
],
);
}
Expand Down Expand Up @@ -688,7 +693,7 @@ class DropdownDialog<T> extends StatefulWidget {
final dynamic doneButton;
final Function validator;
final bool dialogBox;
final List<bool> displayMenu;
final PointerThisPlease<bool> displayMenu;
final BoxConstraints menuConstraints;
final Function callOnPop;
final Color menuBackgroundColor;
Expand Down Expand Up @@ -923,7 +928,7 @@ class _DropdownDialogState<T> extends State<DropdownDialog> {
if (widget.dialogBox) {
Navigator.pop(context);
} else {
widget.displayMenu.first = false;
widget.displayMenu.value = false;
if (widget.callOnPop != null) {
widget.callOnPop();
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: searchable_dropdown
description: Widget to let the user search through a keyword string typed on a customizable keyboard in a single or multiple choices list presented as a dropdown in a dialog box or a menu.
version: 1.1.3
version: 1.1.4
homepage: https://github.com/icemanbsi/searchable_dropdown
repository: https://github.com/icemanbsi/searchable_dropdown
issue_tracker: https://github.com/icemanbsi/searchable_dropdown/issues
Expand Down

0 comments on commit 3de8dd3

Please sign in to comment.