Track screen rendering traces for a Flutter app - flutter

How to track rendering traces? Drop down menu doesn’t offer me any of my screens, only Android activities.
I use setCurrentScreen() function to tell Firebase my current screen.

Related

Screen flickering and flashing continually when i navigate from one screen to another

Here is the video showing the problem:
https://streamable.com/ge4z0b
I have a Google Map screen, which shows a dialog on initialization and when you click the OK button of the dialog, you are redirected to the next screen, which has AR and camera implemented.
This happens only when i navigate from the Map Screen to AR screen. When i put AR screen as first screen, it doesnt flicker and works as it supposed to work.
Both screens are stateful and both are wrapped into Scaffolds.
Any idea why this happens?
I tried removing Scaffolds and a lot of suggestions from the community but nothing seems to work.
You can view the code here : https://codeshare.io/OdREVA
Screen flickering and flashing during navigation can be caused by a number of factors, including:
Performance issues: The cause of the screen flickering could be due to performance issues with the device or the app. If the app is not optimized or if the device is slow, it may cause the screen to flicker.
Stateful widgets: If you are using stateful widgets in your app, it may cause the screen to flicker if the state changes during navigation. Consider using stateless widgets instead.
Animations: If you are using animations in your app, it may cause the screen to flicker if the animation is not optimized or if it is too complex. Consider simplifying the animation or optimizing it for performance.
Flutter framework bugs: In some cases, the screen flickering issue could be caused by bugs in the Flutter framework itself. Consider filing a bug report with the Flutter team if you believe this to be the case.
Third-party plugins: If you are using third-party plugins in your app, it may cause the screen to flicker if the plugin is not optimized or if it is causing conflicts with other parts of the app. Consider disabling or removing the plugin to see if it resolves the issue.
It is difficult to determine the exact cause of the screen flickering without more information, such as the code and any related logs. Consider providing more information or filing a bug report with the Flutter team for a more accurate diagnosis

Flutter overlay over other apps

I want to build a Flutter App that can show information in a modalBottomSheet, but outside of the App.
The App should run in the background and when I want it to show something, it should show a modalBottomSheet over the curently used App. It doesn't matter if the user is in a App or just the Homescreen, important is that the App runs from the background and can overlay other Apps.
You could use flutter_overlay_window. It can display your flutter app over other apps on the screen

How can I run my flutter app full stretched for Android Q gesture navigation?

Here you can see the clock app's ui is running behind the gesture. how can i implement this in flutter? I updated flutter to 2.5 but it's not working.
This is the first question I asked on stackoverflow and i couldn't quite get the question layout. sorry for this.
You have to use
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
in your main.dart before runApp.
As per the description of SystemUiMode.edgeToEdge:
Fullscreen display with status and navigation elements rendered over the
application.
Available starting at SDK 16 or Android J. Earlier versions of Android
will not be affected by this setting.
For applications running on iOS, the status bar and home indicator will be
visible.
The system overlays will not disappear or reappear in this mode as they
are permanently displayed on top of the application.

In Flutter, how can I check if a mouse device or a touch device?

How can I check if the device is a touch device or a mouse device?
Using kIsWeb is not sufficient because if using web version of the app on a mobile device kIsWeb returns true, but I need it to return false because it is a touch device.
Checking the platform doesn't work either because if using web version of the app on an iOS device for example returns false for iOS platform check.
Use case - I have two different types of video players for my app. One is suitable for touch devices (you tap to show and hide controls) and one is suitable for mouse devices (controls show when you mouse into the player and hide when you mouse out).
Youtube has the same idea. If I use the youtube app or website on my iPhone I get touch controls. If I use the youtube app or website on my iPad Pro I get touch controls. If I use the youtube website on my Mac I get mouse controls at all screen sizes (even mobile screen sizes).
So I guess I really just need to know platform on the web. I can get platform if not on the web.
Great question #jwasher! I had the same issue - a touch and swipe based UI that was great as a native mobile app, great as an single page web app (SPA) on mobile web browsers, but that was weird and clunky for mouse based interactions when the SPA was used in a desktop web browser.
The solution I have settled on is to wrap sensitive widgets in a MouseRegion (https://api.flutter.dev/flutter/widgets/MouseRegion-class.html) to detect mouse activity at runtime, then reacting by augmenting the UI with buttons to provide a mouse focussed way of triggering actions previously only linked to touch triggers.
You could use this to "mouse-enable" individual widgets, or you could wrap the whole app in a MouseRegion, trip a state field when activity was detected then rebuild the widget tree in a substantially different way for point and click users.
This strategy may incur some minor complexity/CPU overhead on devices that will never have a mouse attached (like a smartphone), but the solution will be more flexible than a build or configuration time capability determination. If a user starts the app on a tablet, then puts it in a stand and attaches a bluetooth mouse - it will react appropriately.
A device isn't "a mouse device" or "a pointer device". Events have an input type--see Pointer event.kind--but not the whole device. A laptop can have a touch screen, and a tablet can have a stylus or external mouse; an app running in those environments can receive both types of event.
Without knowing what you are trying to accomplish with this classification, is hard to advise on how to accomplish it. Trying to style your UI based on a guess of the primary interaction mode, for instance, is a completely different problem than reacting to a mouse event differently than a touch event.

Flutter Native SplashScreens Background processes

I have created SplashScreens for my Flutter app for both iOS and Android using the native way which is editing the LaunchScreen.storyboard and it is working currently when I run my app but the SplashScreen does not hold long enough and is there a way to programmatically hide the native splashscreen in dart after I am done with some data processing and logic?
The solutions I found online are all flutter apps with SplashScreen that is build using flutter widgets and not the native way...
Even if you build the splash screen if Flutter, you still need to set one in via XCode. Otherwise, the app loads with a momentary plan white screen and Apple rejects it.
If you want to extend the time till the moment data process is over, then you will have to make a replica of LaunchScreen.storyboard in Flutter. The data processing and logic are written in Flutter. There's no way it can tell LaunchScreen.storyboard "I am done". What you can do is though, make a splash screen in Flutter which will look like LaunchScreen.storyboard. And once the data processing is done, you can navigate the user to the desired screen. Since the two screens are same, use won't see the difference and the app will smoothly show the next screen.
Just a word of caution - be careful about extending the timing of launch screen. Apple may reject the app. See if something can be done after the screen load. You can use flutter after layout package for this or the below line will do the trick :
WidgetsBinding.instance
.addPostFrameCallback((_) => myFunction(context));
This thread may help you to delay the screen for XX seconds.