Because, sharing is caring….
This post is an extension to my previous post on WebViews. Second part, shows how to share apps in Flutter.
Flutter team @google, recently announced a plugin for displaying webview in the Flutter apps.
As a developer, we may face a situation where we would require to open a url in the application itself. Well, this plugin is an answer to all those questions.
In the video above, I have programmed a Web-Browser in Flutter using the WebView widget..and finally sharing the app. Let’s see how to do it…
import webview_flutter into the pubspec.yaml of your project as
dependencies: webview_flutter: ^0.3.0
and then include,
into your dart file. Now, you will be able to avail the features of this plugin…
NOTE : If you are programming on iOS, one small extra step :
Go to your project structure and look for the ios folder.
In the info.plist, you need to add the following :
How to use…
initialUrl: 'YOUR URL',
This is the basic structure of the WebView widget :
- key : Keys, from the flutter framework.
- initialUrl : URL which you want to load.
This basic structure is enough to get you started with the WebView widget.
You can also detect gesture recognizers on this webview by using the parameter : gestureRecognizers
This method takes the parameter of type :
Confused ??? No worries, keep scrolling…
Add the gestureRecognizers using this sample :
() => VerticalDragGestureRecognizer(),
It would give you error, because it needs two imports :
Similarly, you can add different gesture recognizers such as :
Below is a pic representing all types of keys in flutter :
When to use keys:
Most of the time you don’t………….but
- If you are adding/removing collection of stateful widgets of the same type. e.g Favorites app.
- If you are reordering collection of stateful widgets of the same type. e.g TO-DO list app
An unexplored topic in flutter which recently was demystified by Emily Fortuna in the video :
Sharing Apps in Flutter…
We need to install the share package from Flutter,
Import the library:
Invoke the static
share method, wherever you want, for instance :
Share.share('Visit my website https://flatteredwithflutter.com');
webview Not able to open keyboard.
Yes, I’m facing same issue.
Kindly have look on following link:
could you please release the sourcecode?