Get the localPosition in onPan property of GestureDetector - flutter

I am trying to create match-the following using flutter. I got the source from which the swiping action started by the onPanStart property of GestureDetector by accessing the details.localPosition.
I need to find the destination point as well. But the onPanEnd property does not have details.localPosition.
How can I find the destination point? That is, where my swiping action stopped.

There is no property to find the localPosition in the onPanEnd parameter.
Instead declare a local variable in the class. Update the with details.localPosition inside onPanUpdate parameter.
Clearly when it ends, the variable contains the last updated value.

Related

My ValueNotifier is not Working properly, why?

I have a GestureDetector inside a ListView and a CustomFilter widget in my Scaffold.
When I filter or change me showList in CustomFiter Widget it seems to be updated because I print the correct value from my CustomValueNotifier.
When it comes to my parent widget which is supposed to show my showList inside the GestureDetector the value is not updated at all and is at all times an empty list.
So the problem seems to be between the connection of my parent widget which hold both the filter widget, which upadtes the list, and my CustomValueNotifier, which takes the updated value but as I said before does not provide it at the widget.
Right now I also do the onnection with getter and setter so in the code im goin to show the showList will be taken the correct value from the getShowList() method. The problem is it doesnt change when the filter is being activated, on change of each filter, but after that when i press somewhere inside the gesturedetector again.
I have tried Change Notifier,Value Notifier, Provider does not seem to be what i can use in this example, setState but of course it updates on click in gestureDetector later

MRTK Grid Object Collection UpdateCollection() not working if called from script

I am using the GridObjectCollection Script from MRTK to display a number of buttons. I am instantiating the buttons dynamically through a script and place them as children of the GridObjectCollection GameObject. Now you can Update the collection through the UpdateCollection() function. Everything works as expected except the following case:
If i want to display a set of different buttons in the same GridObjectCollection, i destroy all children of the collection and instantiate the new buttons as before and call the UpdateCollection() function. But the collection is not updating properly. The old buttons were destroyed and the new added, but the placement is shifted. If i click the UpdateCollection button in inspector, the collection is correctly updated.
Why UpdateCollection() is not working as expected after modifying the content of the collection?
I just fixed the problem. If the collection is updated in the next frame, the update works as expected.
So i am starting a Coroutine and call the update function there.
private IEnumerator InvokeUpdateCollection()
{
yield return null;
gridObjectCollection.UpdateCollection();
}

Updating marker position with change in Lat-Lng position of marker in Google-Maps Flutter Plugin?

I am making a vehicle tracking administration app using flutter. The part that I am stuck is only updating the marker position on the map when the location of the vehicle changes. For getting the location we are relying on the hardware and the data will be stored in the firestore database and with the use of the streambuilder, I am able to get the location from Firestone to the app.
While looking at plugin code I found a _updateMarkers() function but I have no idea how to implement the this in the application.
Adding to Adithya's answer.
import 'package:google_maps_flutter_platform_interface/src/types/marker_updates.dart';
var updates = MarkerUpdates.from(
Set<Marker>.from(markers), Set<Marker>.from(updatedMarkers));
GoogleMapsFlutterPlatform.instance.updateMarkers(updates, mapId: mapId);
Putting updateMarkers() inside a setState() is unnecessary.
I found the way after going through the documentation and plugin code it is as follows
Update the position of the markers using the MarkerUpdates class. The same class is mentioned in the documentation of the Google-Maps-Plugin. This class takes two Set<Marker> as inputs one the current Markers Set and another the new updated Marker Set. The documentation for this class is here: https://pub.dev/documentation/google_maps_flutter_platform_interface/latest/google_maps_flutter_platform_interface/MarkerUpdates-class.html
To use this class you will have to add this import statement :
import 'package:google_maps_flutter_platform_interface/src/types/marker_updates.dart';
While performing this method my google-maps plugin version was google_maps_flutter: ^0.5.29+1
then make a function as follows :
List<Markers> markers; //This the list of markers is the old set of markers that were used in the onMapCreated function
void upDateMarkers() {
List<Markers> updatedMarkers =[]; //new markers with updated position go here
updatedMarkers =['updated the markers location here and also other properties you need.'];
/// Then call the SetState function.
/// I called the MarkersUpdate class inside the setState function.
/// You can do it your way but remember to call the setState function so that the updated markers reflect on your Flutter app.
/// Ps: I did not try the second way where the MarkerUpdate is called outside the setState buttechnically it should work.
setState(() {
MarkerUpdates.from(
Set<Marker>.from(markers), Set<Marker>.from(updatedMarkers));
markers = [];
markers = updatedMarkers;
//swap of markers so that on next marker update the previous marker would be the one which you updated now.
// And even on the next app startup, it takes the updated markers to show on the map.
});
}
then call the function periodically like in my case or as you wish the markers will update.
While doing this a warning as I was promoted with a warning as :
Don't import implementation files from another package.dartimplementation_imports
I don't know if it's a safe approach to do but it is doing the job.
It would be great if someone could tell us more about the warning if it has the potential of creating a bug.
Note:
There is a similar class to update the circle, polygons and options (Map Options) the documentation has explained all and imports for those classes are similar in the same path as mentioned for the Updatemarkers class.

Changing node icon to "folder" when adding child in fancyTree

It seems to me that the standard behaviour in fancyTree, when adding child nodes is NOT to change the parent node to have a folder icon.
For example, see http://wwwendt.de/tech/fancytree/demo/index.html#sample-multi-ext.html and try adding a child node.
How is it possible to dynamically change the icon of the parent to a "folder" when adding a child?
I thought that I could apply renderTitle() to the parent node, but this did not do anything.
This question Dynamically change icon in fancy tree is similar, but (a) I could not get it to work, and also (b) I wanted a solution that didn't involve having to create new icons.
Folders may be empty, so this status is defined by node.folder = true (not by the fact that children are present or not).
So you could set node.folder and call node.render().
Note that setting an additional class may give the same effect, but may get lost when the tree is updated.
In jquery.fancytree.edit.js I added the following line
newNode.parent.addClass("fancytree-ico-ef");
The code snippet is as follows:
newNode.makeVisible(/*{noAnimation: true}*/).done(function(){
$(newNode[tree.statusClassPropName]).addClass("fancytree-edit-new");
self.tree.ext.edit.relatedNode = self;
newNode.parent.addClass("fancytree-ico-ef");
newNode.editStart();
});

Why does my script parameter get deselected when being run?

https://imgur.com/a/07o3m
Why is my point light script parameter being deactivated when I run unity..??
Your problem is in the line:
GetComponent<Light>();
You are setting it in the inspector, so no need to set it in the Start() method (also the Light is in the child object).
Delete that line and you're set.
(next time post the code in text not image.