Flutter showInfoWindow after googleMap build complete - flutter

I'm building an App which contains GoogleMap and some markers on it, and I'm using FutureBuilder Wrap the googleMap widget.
After FutureBuilder get the data for building map, the googleMap widget build the map and put the markers on it.
But now I want one of the markers show its info window ,and I tried controller.showInfoWindow method.
It's work perfectly after the map build completely(for example, if I put the method in some button's onTap method, it works fine),but doesn't work if put it in onMapCreated.
How can I show info window automatically when map build finish, not to press something?
I also tried WidgetsBinding.instance.addPostFrameCallback and didn't work too.

I found the problem really is: When the Map Camera is Moving, the showInfoWindow method doesn't work. So I just added a delay time in onMapCreate, and it seems to works fine now.

Related

How to create a slider which should be returned to starting position when user stop dragging and need to call method when it completes full in flutter

In flutter i tried with sliderTheme and slider widget but the it is working as a seek bar not as a draggable slider.
Any idea or widgets would be helpful.
Thanks in advance.
try to use slider_button i think this package is fit your requirement very well https://pub.dev/packages/slider_button

Flutter: PageView seems to ignore PageController's page property after setState

I'm having the following problem: My library easy_image_viewer has a request to add swipe-to-dismiss. I implemented it using the Dismissible widget. However, when the user zooms in on an image, I noticed I had to find a way to "deactivate" the Dismissible widget because otherwise the user can't pan around on the zoomed-in image. I solved that by using setState and a dismissDirection variable on the state that can be either none or down.
Now for the weird part: Whenever I call setState and the dismissDirection changes, the PageView jumps back to the first item. I've tried using AutomaticKeepAliveClientMixin, but to no avail.
The code can be found here: https://github.com/thesmythgroup/easy_image_viewer/tree/pagecontroller_problem_demo
Simply run the app (example/lib/main.dart), tap on Show Multiple Images (Simple), swipe to the second image and use pinch & zoom to zoom in. You'll notice it jumps back to the first image. What am I doing wrong?
Instead of changing the dismiss direction you can use confirmDismiss i opened a PR for you to check here

How can I see when a Widget rebuilds?

Code source
Is there any trick to know that a widget has been rebuilt?
As a demonstration, i.e. if we randomly colored the widgets on every rebuild, it would look like this:
Flutter actually has built-in functionality for exactly what you are trying to achieve in the DevTools inspector:
This is called the Repaint Rainbow and it can be enabled in Android Studio, i.e. IntelliJ, as demonstrated above or directly in Dart DevTools:
Repaint Rainbow
Shows rotating colors on layers when repainting.
From the linked article
Notes
There can be many reasons for repaints and seeing a widget rebuild does not inherently mean that you triggered the rebuild as it can also come from somewhere else in the tree.
You cannot know if a widget has been rebuilt in code because that is against how the framework works - you can obviously catch any build or paint calls by integrating that into your build or paint function, but you should really not do that because builds and paints should be idempotent.
If you use android studio you can open Flutter Performance and checked Track widgets rebuild in Widget rebuild stats
Every time the widgets are rebuild ,the build() is called So You can write a print() in your build() and track when the widgets are getting rebuilt
You can't know it, and should not build a word around to obtain that value yourself either.
This is anti pattern, as the number of times a widget rebuilt should never have an impact on the output.

flutter-mapbox-gl Style is not coming

"I"m integrating MapBox in my existing flutter app, and I am able to see the Map, and can hover over the map, it changes it coordinates and other embedded features. However, the style is not coming, ie, map is not displayed properly.
I am just trying to get the minimum workable Map, so I can add desired features on top of that.
When I run the code as it is, from https://github.com/tobrun/flutter-mapbox-gl , as a new project on IntelliJ Idea, it all looks fine.
So it seems like, style is missing, but I can't figured out what else to include.
I copied map_ui.dart code in my class, and calling the class from home page of our flutter app.
Apart of this, I added, mapbox_gl: ^0.0.3 dependency in pubspec.yaml file
I expect the following
Output Map
. However, my code is displaying the following
Current Map
Flutter Mapbox GL Native
[edit:] Updated the current screen shot, after wrapping the widget in a Scaffold
So after wrapping the widget in a Scaffold, this is looking good now!
And, I had to zoom in a bit to see the image.
Latest Screen Shot

How to update StatefulWidget from other class?

First of all, I'm a real beginner with Flutter, so I have probably not even grasped the basic design patterns yet. My problem is probably simple for someone who understands flutter. Here goes:
I have a tabbed GUI in my app and a floating action button. Each tab has a list that I want to update using that action button (FAB). The easy way to do this seemed to have one action button for each tab, but I read that you should not do this in flutter. So I made the button "global" and call a method on the current tab when the button is pressed. The method then adds some data that should be shown in the list, but the problem is that the list of course isn't actually updated just because I add data. The setState() is never called inside that list widget.
All the exampels I've found are very simple with the FAB being inside the list having access to its setState() method. But in my case I'm outside the list. How do I solve this? Notifier? Stream? I'm lost...
I think the correct solution is to use a "Stack" and "Positioned" widged like:
- Stack
- Scaffold
- TabBar
- Positioned
- FloatingActionButton