Flutter Web: Right click -> Browser Context Menu -> Open Link in New Tab - flutter

I have a basic website using GetX for navigation. I have inkwells with ontap functions which navigate to a new view. Right now, if you right click these buttons there is no "open link in new tab/window", "save link as" or "copy link address".
Is there any way to get this functionality for Flutter Web?

Edit:
Since Flutter version 2.10, you no longer need to switch to channel beta for this.
Maybe I'm answering this late, but this may help someone in the future.
At the moment of writing this it is possible to be done, it is bugged on the stable channel, but it works perfectly on channel beta.
Just switch to channel beta:
flutter channel beta
flutter upgrade
Then follow this instructions to add url_launcher dependency to your project and import this package wherever you want to use it:
import 'package:url_launcher/link.dart';
And finally wrap any widget with this:
Link(
uri: Uri.parse('www.google.com'),
builder: (context, function) {
return InkWell(
onTap: () => print('Do something'),
child: Text('Right clickable text')
);
});

Related

How to test if a button is pressed and how to use the console in Flutter (AndroidStudio)

I am trying to test if a button works in a flutter app.
If I was developing an Android native app, I'd make use of Log.i to print a message in the Logcat.
I want to the same exact thing in flutter.
What I've tried so far:
debugPrint
print
to import 'dart:developer' package to make use of the log function
Apart from this problem, I cannot open the console in AndroidStudio.
Here's a screenshot taken after looking fot the coslone in the search bar:
enter image description here
Any help would be appreciated !!!!
Hey there,
I am trying to test if a button works in a flutter app.
If I was developing an Android native app, I'd make use of Log.i to print a message in the Logcat.
I want to the same exact thing in flutter.
What I've tried so far:
debugPrint ...
print('BUTTON CLICKED')
import 'dart:developer' as logDev; onPressed: () => logDev.log('BUTTON CLICKED', name: 'FAB -> ')
Apart from this problem, I cannot open the console in AndroidStudio.
Here's a screenshot taken after looking fot the coslone in the search bar:
enter image description here
Any help would be appreciated !!!!

How to return to the previous screen in flutter when using persistent_bottom_nav_bar package?

I have searched the package docs to return just to the previous screen & didn't find a simple solution
After some trials:
Navigator.pop(context);

Flutter issue regarding navigate to a new screen

Hello I'm new in Flutter. when I try to import a new page to navigate new screen it shows error
It's not an error, but a warning. You are importing the module 'signup.dart' (that takes a small computational cost) but you are not using it.
Flutter is just trying to make your app faster by warning you about the packages you are importing but not using. You can simply remove that line (line number 5)
Navigate using these code:
Navigator.of(context).push(MaterialPageRoute(builder: (context) => SignupPage()));

Create a button to open another app in Flutter

I would like to create a simple app in Flutter that contains for example 3 button , the event onPressed in the button should open another external app , is that possible in Flutter and how should I proceed?
You can use Column/Row to create your buttons. And after that you can simply use a RaisedButton like this:
ElevatedButton(
onPressed: () {
// use android_intent package to open other app
final intent = AndroidIntent(package: "com.android.facebook", action: "action_view");
intent.launch();
},
child: Text("Open Facebook")
)
It's easy to do it in Android using android_intent_plus and for iOS you can do it natively, this will help you.
In my case action: "action_view" caused app selection dialog getting opened. We can open specific component using below.
You can try android_intent library for launching external app. Documentation has some sample codes.
You may use sample code below.
var map={"AuthParams":authParam};
var intent=AndroidIntent(package:"in.app",arguments: map,componentName: "in.app.ui.splash.SplashActivity",/*action: "action_view"*/);
await intent.launch();

flutter webview keyboard cannot show up

I tried to integrate the webview, in the flutter app. After adding the code in the example, the page loads normally, but when I click on the input box in the page, no soft keyboard pops up,
This problem only happens on Android and it is a known issue here. https://github.com/flutter/flutter/issues/19718.
If your app does not need the webview to be on the same screen with other Flutter widgets, I recommend this webview library from the Flutter community. There is no keyboard issue here. https://pub.dartlang.org/packages/flutter_webview_plugin
I have tried multiple things but finally i have fixed it through scaffold, now my keyboard is opening.
just wrap your WebView inside Scaffold widget and apply following property inside scaffold.
resizeToAvoidBottomInset: false,
I know it's late but changing the webview version to v3.0.0 actually solved the issue for me.
This one can use for now. Hope flutter team fix it soon.
You need to open your android project in Android Studio to view all dependencies and in the webview_flutter
To fix most recent version of code, besides import
import android.app.Activity;
import io.flutter.app.FlutterApplication;
Change:
webView = new InputAwareWebView(context, containerView);
To:
Context activityContext = context;
Context appContext = context.getApplicationContext();
if (appContext instanceof FlutterApplication) {
Activity currentActivity = ((FlutterApplication) appContext).getCurrentActivity();
if (currentActivity != null) {
activityContext = currentActivity;
}
}
webView = new InputAwareWebView(activityContext, containerView);
Original answer here: #ryanhz https://github.com/flutter/flutter/issues/25767#issuecomment-588603862