How to do fast controller initialization - flutter

In my application with GetX, I had to create around 7 controllers, and they need to be initialized.
Everything works fine, but the controller I created for mobile ads sometimes throws an error. Actually, it does not give an error, but a bug occurs.
The problem is that when the app opens, it needs to show ads on the first click. As soon as the application is opened, when you click quickly, it does not show the interstitial ad. But a few seconds pass and if clicked, it shows the ad.
I'm not writing here because I don't have a problem with the codes. Is there any method I can solve this?

Related

all widgets in my app doesn't showing when I enter the app the seconde time

I dont know how exactly describe my problem ,my app works well
it show like this and works fine
but when I enter to it in the second time it show like this
!
enter image description here
and it's still working, its just not showing things as it should
I'm using getx as state management and I'm using it to change theme(dark,light) and the language(english,Arabic)
I dont know even what causes the issue so please help me with any think
I try to change the default language and theme and it's the same issue
when I face the issue I press the back button to be out of the app and I enter the app again( without removing it from background) it work and everything fine

Flutter mobile app, clicking an existing and valid physical back button is not working, even though the Cucumber step succeeds

I am using JDK 1.8_202, appium 2.0.0-beta.46, node v18.12.0
There is a programmer developed back button (<--) whose className as "android.widget.Button" whose className as "android.widget.Button", but when I try to verify it using search option, I am getting this pop up.
Programmatically nothing is happening, even though as a CucumberBDD step, it is showing as executed.
I am executing on locally connected physical device 'Samsung galaxy note 8'
Why back button tap/click action is not working even when it is executed??
I open my flutter mobile app. I am at landing page
Do some navigation forward. Comeback to a dashboard page
From dashboard page to get back to landing page, there is a back button like (<--), which I manual tap and can get back to landing page, with no problem.
Programmatically nothing is happening, even though as a CucumberBDD step, it is showing as executed.
From Appium Inspector I see it's className as "android.widget.Button", but when I try to verify it using search option, I am getting this pop up.
The same button with the same click() method is working fine in another scenario.
I am using JDK 1.8_202, appium 2.0.0-beta.46, node v18.12.0
Does the previous navigation affects the functioning of the button click() action ? It should not be logically.
Why back button tap/click action is not working even when it is executed??

Template10 - return user to the main page after resuming

Let's assume that my UWP app gets suspended and it is not used for a long time. When a user opens the app again (previous ApplicationExecutionState is Suspended or Terminated), I don't want the user to be navigated to the page he/she was viewing last (it became irrelevant since then), but instead do a fresh navigation to the main page. How can I do this using Template10?
It seems that when the user returns to the app, Template10 always returns the user to the page which was being viewed last. I tried overriding the OnResuming method in App.xaml.cs, however it had no effect.
I had this problem.
I solved saving a bool property like ItWasSuspended in the LocalSettings of my app.
When the OnResumming is activated I set to True this property or when the launched event was raised I set this property false.
Finally in my pages in the OnNavigatedTo I get the value of this property if this property is true I navigate to the main page and I clear the back stack.
Here is how to use the local settings
https://msdn.microsoft.com/library/windows/apps/windows.storage.applicationdata.localsettings.aspx
you can clear the back stack doing something like this
this.Frame.BackStack.Clear();
please mark this answer if it's useful for you!
Best regards

Does Activity.onStop() get called when the tab closes or refreshes?

I thought I saw somewhere that GWT's Activity onStop() method allowed the app to react to page closing. However, in an experiment, this appears not to be the case. Is it supposed to work this way, or am I doing something wrong?
It's the method mayStop(), which is called when the Activity is closed or the page is closed. If you return a non null string it will be displayed in a window.confirm box where the user can dismiss leaving the activity or page.

Prevent cached iPhone webapp from reloading (scrolling to top)

I have an iPhone webapp that uses a cache manifest to work offline. I add the webapp to my home screen, use it (say scroll to a certain location on a page), then go back to homescreen.
When I open the app again, for a brief moment I see where I used to be (at that scrolled location on that page), but then the app "reloads" and I get scrolled to the top of the mainpage. Is there a way to prevent this "reloading"? This happens even in airplane mode (ie everything is working off the cache).
You're just seeing the default startup image, which is just a screenshot of the last place you were at. It's not "reloading"; the app wasn't loaded to begin with.
Search for "apple-touch-startup-image" to set a real loading image.
What I'm struggling with here is that the app actually seems to stay "in memory" longer if I use regular Safari as opposed to running in "apple-mobile-web-app-capable" mode. In the later case something as simple as pressing the home button, then task-switching back to the app causes a reload. Doing the same thing just in Safari often does not reload. So I'm worse off by using "apple-mobile-web-app-capable".
I don't believe there is a real 'reload' event. onload and onunload are all we get.
the onload handler starts up as if it is your first time coming to the page.
the onunload handler is the key to clearing out old content.
I like to provide alternate content for people who are coming back to my web app.
window.onunload=function(){
document.getElementsByTagName('body')[0].className+=' unloading'
}
And let the CSS do the dirty work to hide most of the body and show alternate content.
(this answer does not rely on jQuery or other frameworks)
// on load
window.scroll(0,0);
To ensure no old content is displayed while launching I use this in my page:
window.addEventListener('unload', function() { $('body').hide(); } );
Thus the last state of the page is empty and is what is shown to the user when the page is opened again.