Flutter: detect if device has "back navigation" built into the OS? - flutter

In Flutter, I would like to know if the device has any functionality built into the OS for navigating back. Or in other words, if the user can trigger navigation without having an actual button within the app.
For example, an iPhone 7 does not have a physical back button or a swipe-back gesture. If the app doesn't have it's own way to navigate, the user can get stuck.
On the contrary, most modern devices have some way of going back built into the system, like a physical/virtual back button or a swipe-back gesture.
Can I distinguish between these types of devices?

From what I have seen it is only IOS that do this, so it can be done with:
if (Platform.isIOS){
#show backButton();
}
But I have not seen a package or function that specifically lets you know this information. Keep me in the loop if you find anything

Related

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.

is there any way to develop first screen contents by flutter?

I'm just trying to develop first-screen contents application which acts like...
If you unlock your smartphone, this application show up and show its contents like today's whether, a sentence of bible, etc.. before smartphone's own contents. And then if you touch the screen one more time, you can use your smartphone.
So it seems like.. a splash screen of smartphone, instead an application.
Because I'm not good at English, I don't know how to call this technique by English.
So what I want to know is anything. The name of this technique.. helpful flutter widget.. or any reference about this written by flutter.
Thank you.
For Android:
You can't listen to phone unlock event after Android 8.0, see https://stackoverflow.com/a/20225681/10874380
For iOS:
I'm not very familiar with iOS restrictions, but as far as I know, apps on iOS has no way to know the phone is unlocked. Also, ios apps can't open without user tapping on it.

Swiftui sheets on mac app doesn't work properly

When attempting to use sheets on a Mac OS app, it's not interactable (sliding down to go back to the previous view) like on iOs. Is this normal or would I need a workaround to go back to the previous view?
You’ll need a close button on macOS, there is no dismissal gesture. If your app supports iOS too, it’s probably wise to have a close button there too — not all iPad users are familiar with the gesture, and the gesture doesn’t work on landscape phones.

How to start a Flutter app after tapping a hardware button after a number of times?

Hey can anyone assist me in letting me know what to use to effectively start a flutter app from hardware detection?
I see that there's a hardware detection plug in but this only works when the application is open.
I'm trying to get the app to automatically start or display an Alert Dialog Widget after tapping say the power button after 3 times.
I am not sure what technologies/plugins to use. Can anyone assist?

Recognising gestures from the home screen

I am developing an app for iPhone.
I am looking for a way to run some code once a drag gesture is recognized on the homescreen (or on all screens if possible).
Does anyone know how to get this with the iOS SDK using Xcode and Objective-C?
Your app cannot receive gestures anywhere in iOS except within itself and its own views while it's active (not counting system notifications and the app icon).
I doubt this is possible. To do this, you will need to hook into the OS at a lower level than is usually allowed.
iOS is locked down much more than Mac OS, I'm afraid.