Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormBuilderDateTimePicker: Picker always showing when field is required and empty #1304

Open
3 of 7 tasks
SherpaMiguel opened this issue Oct 13, 2023 · 5 comments
Open
3 of 7 tasks
Labels
bug Something isn't working

Comments

@SherpaMiguel
Copy link

SherpaMiguel commented Oct 13, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

9.1.1

Platforms

  • Android
  • iOS
  • Linux
  • MacOS
  • Web
  • Windows

Flutter doctor

Flutter doctor
[✓] Flutter (Channel stable, 3.13.7, on macOS 14.0 23A344 darwin-arm64, locale es-ES)
    • Flutter version 3.13.7 on channel stable at /Users/miguel/bin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2f708eb839 (4 days ago), 2023-10-09 09:58:08 -0500
    • Engine revision a794cf2681
    • Dart version 3.1.3
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/miguel/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • 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
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.83.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.56.0

[✓] Connected device (3 available)
    • iPhone de Miguel Angel (mobile) • 00008110-000414892152401E • ios            • iOS 17.0.3 21A360
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 117.0.5938.149
    ! Error: Browsing on the local area network for iPad de Miguel Angel Alvarez Rivero. 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)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Minimal code example

Code
FormBuilderDateTimePicker(
      validator: FormBuilderValidators.required(),
      autovalidateMode: AutovalidateMode.onUserInteraction,
      name: 'test',
      inputType: InputType.time,
);

Current Behavior

When validation is fired and field is empty and required, picker is randomly opened.

Expected Behavior

Picker dialog should not open when validation is fired and field is invalid.

Steps To Reproduce

  1. Tap on field to display picker dialog
  2. Press cancel to close dialog without setting a value
  3. Dialog never hides

Aditional information

No response

@SherpaMiguel SherpaMiguel added the bug Something isn't working label Oct 13, 2023
@pixnbit
Copy link

pixnbit commented Oct 18, 2023

Can confirm.

@mokamhawy
Copy link

mokamhawy commented Nov 12, 2023

For me Resolved by setting focusOnInvalid: false, the default is focusOnInvalid: true
yourExpiryDateFieldKey.currentState!.validate(focusOnInvalid: false)

@pixnbit
Copy link

pixnbit commented Nov 12, 2023

For me Resolved by setting focusOnInvalid: false, the default is focusOnInvalid: true yourExpiryDateFieldKey.currentState!.validate(focusOnInvalid: false)

This doesn't work if the field is inside a form and is validated with the generic form key. The previous version didn't need this setting.

@CGrandez
Copy link

I also have the same problem, any solution?

@brandon-watkins-avcrm
Copy link

For me Resolved by setting focusOnInvalid: false, the default is focusOnInvalid: true yourExpiryDateFieldKey.currentState!.validate(focusOnInvalid: false)

This worked for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants