flutter-form-builder-ecosystem / flutter-form-builder-ecosystem/form_builder_extra_fields
[FormBuilderSearchableDropdown] how to open dropdown programatically
- Dominant language
- Dart
- Stars
- 29
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Package/Plugin version
8.3.0
### Platforms
- [X] Android
- [X] iOS
- [ ] Linux
- [ ] MacOS
- [ ] Web
- [ ] Windows
### Flutter doctor
Flutter doctor
```
[✓] Flutter (Channel stable, 3.3.10, on macOS 13.5.2 22G91 darwin-arm, locale en-IN)
• Flutter version 3.3.10 on channel stable at /Applications/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (1 year, 2 months ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/ronakkalavadia/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15A240d
• CocoaPods version 1.14.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2023.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] Connected device (3 available)
• iPhone 15 (mobile) • F0CD531E-982B-4CDC-B593-9E974CB747C1 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.5.2 22G91 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 121.0.6167.139
! Error: Browsing on the local area network for RK iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as
this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
! Error: Browsing on the local area network for iPhone SE Old. Ensure the device is unlocked and attached with a cable or associated with the same local area network
as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
```
### Minimal code example
Code sample
```dart
final _focusNode = FocusNode();
@override
void initState() {
afterBuild(() {
_focusNode.requestFocus();
});
super.initState();
}
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ValueListenableBuilder(
valueListenable: widget.field,
builder: (context, dynamic value, _) {
return FormBuilderSearchableDropdown(
key: ValueKey(value),
focusNode: _focusNode,
name: widget.field.internalName!,
items: const ["Brazil", "France", "Tunisia", "Canada"],
compareFn:
(String existingSelectedValue, String valueToBeRemoved) =>
existingSelectedValue == valueToBeRemoved,
);
}),
],
);
```
### Current Behavior
Dropdown is not opening with focusNode.
### Expected Behavior
Dropdown should open with focus node.
### Steps To Reproduce
1. Set focus node of FormBuilderSearchableDropdown.
2. Then set focusNode.requestFocus(); in init function.
3. Dropdown not opening automatically.
### Aditional information
_No response_
Contributor guide
Research direction
Start at the FormBuilderSearchableDropdown entry point and reproduce the issue using the provided FocusNode example on Android or iOS. Trace how focus changes are handled and verify that calling requestFocus() opens the dropdown; confirm the behavior with a regression test if the project provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100