I want to float a flush bar - flutter

enter image description here
I also added dependency on flushbar to Yaml.
Also import Flushbar helper carried out.
However, I don't know why the error occurs in the container part.

It needs to be body: Container(.

Related

Flutter detect PointerEvents over Widget

I have a sample code which detects a hovering stylus over a widget.
The code is from this Stackoverflow Quesion.
In short. It binds using GestureBinding.instance?.pointerRouter.addGlobalRoute and checks in the handler if the event is of type stylus.
This gets triggered when the stylus is hovering over the screen (no contact).
It works great on Widgets like Text(), Container() etc.
Question:
I want to use this functionality on a different Widget, the Flutter InAppWebView but the event will not get triggered until the pen has contact with the surface. Even on the Container it does not work, if the child is the InAppWebView.
I think this problem will occur on other Widgets too.
I tried the Listener, AbsorbPointer and IgnorePointer.
Update 1:
I can see the following in the debug output when I start hovering the stylus over the screen.
I/ViewRootImpl(23491): updatePointerIcon pointerType = 20001, calling pid = 23491
D/InputManager(23491): setPointerIconType iconId = 20001, callingPid = 23491
Update 2:
The InAppWebView has an option useHybridComposition which is false by default. Setting it to true solves the issue. But the WebView is becoming very slow.
HERE is a repository that shows the problem.
Thanks!
EDIT
As desribed below, this question has two solutions.
Set useHybridComposition to true. For slowness, maybe raise an issue to that repo.
Hook at android/ios level instead of Flutter level, and forward events back to Flutter.
The debugging method maybe like this: Firstly, print out the pointer events in methods like your _handleEvent. Then you will know whether the pointer event just occur, or they even do not occur.
Secondly, try what widgets are OK and what are not. Text is OK, WebView is not. Then is Container OK? Is InkWell OK? Is IconButton OK? Is IconButton OK? etc. By doing this you gain insight of what is special about Text that makes it work.
Thirdly, as a hacky workaround, could you please try Text.rich(WidgetSpan(child: your_web_view))? Since you say Text is OK while other widgets are not OK.
Lastly, maybe need to dig into Text's source to see what magic happens - probably some special configuration? - to let it work.

Get the previous route name in Flutter

I understand that Flutter routes works like a stack, so I want to know the previous route name which I came from.
I'm using a preview page to show a picture, but this picture can come from the camera or the gallery, I'd like to show a dialog only if it came from gallery.
I read I have to use an observer, but I think there is an easy way to do that.
Thanks in advance.
You can use getx pack to get previous Route
Get.previousRoute;
get current Route
Get.currentRoute;
Well, upon further investigation, there is no way to know the previous page.
I fixed this sending an argument previousPage with the route name value.
You can also use a NavigatorObserver.

GoogleMaps on Ionic5 messing up Swipe Modal

I’m having issues with the GoogleMaps and the new ‘swipe to close’ modal.
My issue is that the class _gmaps_cdv_ that gets attached to the body by GoogleMaps is changing the background color to white. The effect looks weird and bad.
I’ve tried pretty much everything…
Removing the class once the modal gets loaded. That will make the map disappear and take whatever color I’ve set to the background.
Removing the class once the modal gets loaded and attaching it again once the modal gets destroyed. Same result as previous
Destroying the map on the ionViewWillLeave() and recreating using the ionViewWIllLoad(). Same result as previous.
Any tips? Is this a bug?
Thanks
I got around this. The solution is pretty simple. The background color can be setup on the Environment class of the GoogleMaps.
Make sure the Environment is imported on your component and do as follows:
// If you're following the documentation, there should be more things imported here, because I'm focusing on the Environment, I will only use this one.
import { Environment } from '#ionic-native/google-maps/ngx';
ngOninit() {
Environment.setBackgroundColor('black'); // Or whatever color you want.
}
That's it!
Here is the documentation link for reference:
https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/environment/README.md

Ionic View is not Updating with Two way Data Binding

I am creating very basic ionic app. I want to show splash, then admob interstitial and on close of interstitial, i want to redirect to home page.
The only problem which I am facing here is updating the view in the home page. In home page, i have very simple text box and button. I am using 2 way data binding here and its not working at all.
I have created repo for this if somebody wants to have a look and let me know why the view is not updating.
https://github.com/krishnaa99/admobissue
Demo Video
https://www.youtube.com/watch?v=t_BKJ1mGpag
if the value is changing in component but not in view(html) then after action in component use this.
import { ChangeDetectorRef } from '#angular/core';
constructor(private changeRef: ChangeDetectorRef){}
this.changeRef.detectChanges();
i hope it can help.
Possible solutions you can try
you should check the logs for errors
Assign clear type to "input" variable. ( try making it explicitly
public )
"input" may be considered as a keyword, try using a different
variable name ( less likely )

Unity not allowing me to use Screen.safeArea

I am trying to adjust the UI in my game to properly fit on the screen of an iPhone X.
In my code I am attempting to code the line return Screen.safeArea
However 'safeArea' is highlighted red and when I hover over the error with my cursor a message is displayed saying "error CS0117: 'UnityEngine.Screen' does not contain a definition for 'safeArea'".
I dont understand why I'm getting this error because according to Unity's documentation UnityEngine.Screen does contain a definition for safeArea.
Any inclination or idea as to why I am running into this error?
Also, I am working with Unity 2017.2.0f3
As per comments bellow, code as been asked for.
private Screen ReturnSafeArea(){return Screen.safeArea}
as I tried saying, the code has nothing to do with it. Even in this simplistic instance of the use of Screen.safeArea, safeArea is listed as not a definition of UnityEngine.Screen.
Hovering over safeArea displays the following message
"'Screen' does not contain a definition for 'safeArea"
Screen.screenArea is of type Rect and your method is defined as returning a value of type Screen
https://docs.unity3d.com/ScriptReference/Screen-safeArea.html
One way to correct this:
private Rect ReturnSafeArea(){
return Screen.safeArea;
}
Additionally, the field was added in 2017.2.0p1 (Nov 6) and you're on 2017.2.0f3 (Oct 3). Link is for 0.2, but 0.f3 does not have its own page, so likely was made either the same day or very shortly after.
I believe Screen.safeArea was added in a minor release of 2017.2, so 2017.2.0f3 would not have it. Try your code in 2017.2.1 and newer to confirm. It's too bad the documentation doesn't specify that.