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

Issue when using [selectedPlaceWidgetBuilder] with MediaQuery #30

Closed
RicardoRB opened this issue Apr 28, 2020 · 2 comments
Closed

Issue when using [selectedPlaceWidgetBuilder] with MediaQuery #30

RicardoRB opened this issue Apr 28, 2020 · 2 comments

Comments

@RicardoRB
Copy link

Describe the bug
When the selectedPlaceWidgetBuilder is overridden and want to search an address by the top bar, it doesn't move the map to the found address.

To Reproduce
Steps to reproduce the behavior:

  1. Rewrite selectedPlaceWidgetBuilder:
    Example:
    selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
    return isSearchBarFocused
    ? Container()
    // Use FloatingCard or just create your own Widget.
    : FloatingCard(
    bottomPosition: MediaQuery.of(context).size.height * 0.05,
    leftPosition: MediaQuery.of(context).size.width * 0.05,
    width: MediaQuery.of(context).size.width * 0.9,
    borderRadius: BorderRadius.circular(12.0),
    child: state == SearchingState.Searching ?
    Center(child: CircularProgressIndicator()) :
    RaisedButton(onPressed: () { print("do something with [selectedPlace] data"); },),
    );
    },

  2. Click on top bar

  3. Write a address

  4. Click the address

  5. You get the adress but the map doesn't move to the selected address

Expected behavior
When the user selects the address in top bar, the map should move there

Flutter Doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.9 at /home/ricardo/flutter
• Framework revision f139b11009 (4 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/ricardo/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 28.0.3
• Java binary at: /snap/android-studio/88/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.

[✓] Android Studio (version 3.6)
• Android Studio at /snap/android-studio/88/android-studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (1 available)
• Redmi 4X • 6f9199b7d440 • android-arm64 • Android 7.1.2 (API 25)

• No issues found!

@fysoul17
Copy link
Owner

Hi @RicardoRB ,

I think it is because of MediaQuery since it rebuilds your widget.

Try to put something like:

bottomPosition: 0.0,    
leftPosition: 0.0,
rightPosition: 0.0,

instead of MediaQuery.

@RicardoRB
Copy link
Author

Hi @fysoul17

That's the trick!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants