How can I open read-only webpage on Flutter App - flutter

Can you show me the right way to solve my problem?
I want to run a webpage in the application and disable the screen response to user actions. (read only)
I run the page using the code:
String _url = 'https://google.com
await launch(
_url,
enableJavaScript: true,
forceWebView: true,
forceSafariVC: true,
)
But I can't cope with making this page insensitive to user actions (buttons, zooming, etc.). I've tried:
Enable "launch" in ignoring or absorbing. Did not work.
I tried to run a URL as a background and then put an inactive transparent button on it. I failed to.
I have no idea how to bite it.

use webview_flutter instead it gives you more control over the web screen

Related

How to open the bottom sheet that contains the list of applications for opening URL or google map. So the user can select their preferred application?

I tried this one. But, it Directly opens on the Google Maps application. The bottom sheet for choosing the preferred application is not showing. How do I achieve it? So, the user can select their preferred application.
This is my code for now,
try {
launchUrl(
Uri.parse("geo:${taskAddress.lat},${taskAddress.lng}"),
mode: LaunchMode.externalApplication,
);
} catch (e) {
} finally {
launchUrl(Uri.parse(
"google.navigation:q=${taskAddress.lat},${taskAddress.lng}&mode=d"));
}
I think you can't do that. It's user device preferred setting. If the user set it to "Always Open" or similar it will not ask again.

Url launcher does not open with appbar

what i want is to get the top bar when I launch URL inappwebview, where it shows Done Mobile.twitter.com aA and refresh icon
So I've tried
await launchUrl(
Uri.parse(url),
mode: LaunchMode.inAppWebView,
);
as well as downgraded url_launcher and tried this
launch(url,
forceWebView: true, forceSafariVC: true, enableJavaScript: true);
None seem to work,
I keep getting the website without the appbar with Done, refresh on top of it
I encountered the same problem when upgrading from using the deprecated launch(url) method to launchUrl(uri).
All it needs is to pass the LaunchMode as below.
launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication )

How to Tap on native iOS popup to allow Notifications. (Flutter Integration Test)

Flutter Driver code has to tap on the native "Allow" button to continue and simulate the correct user behaviour.
See this screenshot. Native iOS popup before app starts - Allow Notifications
App has not yet completely started and is waiting for this tap.
How does one get the driver to tap on the native iOS popup?
Any suggestions and ideas are welcome.
Here is the code for one attempt to wait for the app before continuing with other tests; it just awaits indefinitely:
setUpAll(() async {
driver = await FlutterDriver.connect();
await driver.waitUntilFirstFrameRasterized();
});
Here is another attempt at finding the word "Allow" in the popup and tapping on it:
test('Allow app to send Notifications.', () async {
final allow = find.byTooltip("Allow");
await delay(750);
await driver.tap(allow);
});
It does not find the word.
The issue is probably that Flutter Driver is not aware of the iOS native popup.
Other tests are very simple once in the app, for example, to tap on fields, enter text, scroll pages, etc.
Any ideas on how to do this?
Unfortunately this feature is currently not possible. Flutter Driver can't interact with native elements (v1.20.4).
https://github.com/flutter/flutter/issues/34345
https://github.com/flutter/flutter/issues/12561

Using uni_links when the app is in the background

My application has the following structure:
- InheritedWidget for dependencies
--> Splash Screen Page
--> Login Pages
--> Main Pages
When the app runs for the first time, I can use var link = await getInitialLink(); to get the value for the link that opened the app.
However, I cannot get the same result if I open the app on the background.
I tried to use
getLinksStream().listen((link) => (link) {
try {
var _latestUri;
if (link != null) _latestUri = Uri.parse(link);
print("=== Formated successfully a link!");
} on FormatException {
print("--- A link got here but was invalid");
}
});
For getting the link in the Splash Screen, but if the app is already open in the Login or Main pages, it won't go through the Splash Screen again.
Then, I tried to put it in the InheritedWidget, but alas, didn't get any result whatsoever.
So my question is: Where and how should I set up uni_links so that I can catch all incoming links even if the app is open?
Or better, is there an alternative for App Links/Universal Links that I can use?
Though it's not the best and most elegant way, I got around this.
First, I was not using getLinksStream correctly
Instead of
(link) => (link) {...}
It's
(link) {...}
Then, I need to put this subscription in my Splash Screen and do not dispose of it, so that it can listen to new events.
If anybody has a better solution, please free to add it
For this situation, you need to use both of getInitialUri() and getUriLinksStream(),
If app launchs directly u will get uri from getInitialUri, if app already running on background u will get uri from getUriLinksStream.

Responsive converse.js UI

I want converse.js such that it should work properly in mobile browser.
converse.initialize({
websocket_url: webSocketUrl, // ConnectionUrl
keepalive: true,
message_carbons: true,
message_archiving: 'roster',
//play_sounds: true,
auto_login: true,
jid: user,
password: password,
show_controlbox_by_default: false,
auto_list_rooms:true,
allow_logout: false,
allow_registration: false,
});
Can we set in config?
I finally got the answer , i removed "this.chatboxviews.trimChats();" from $(window).on("resize") function in converse.js.The main issue was when we open the chat box it opens the android keyboard on focus which resizes the window and minimize the chat box ,where as in IOS it doesnt happen like that it doesnt open keyboard on focus. So, finding the main cause of the issue solved my problem.