New post Thank you for 2021. Expecting a bigger you in 2022 Read More

MobileRandom

FLUTTER WEBVIEW TUTORIAL #3 – Convert a website to an app using flutter.

2 Mins read

Hi πŸ‘‹, everyone and welcome to part three of the flutter webview tutorial series.

Today, we’re going to learn the third example on how to convert a website into an app in a few minutes using Flutter. If you want to know more about some cogent flutter Tricks and Tips and How to achieve tasks easily in Flutter, consider following me so you don’t miss any updates and subscribing to myΒ YouTube Channel. Thanks

Check the video out for more explanation on part three and part twoΒ πŸ‘‡

Part 3 video tutorial

PART TWO ARTICLE

Let get started

We’re still using the flutter_inappwebview package, so just create another dart file for example 3, you can name it WebExampleThree.

The example is pretty straightforward, we just need some methods and parameters like the code below

import 'package:flutter_inappwebview/flutter_inappwebview.dart';

class WebExampleThree extends InAppBrowser {
  @override
  Future onBrowserCreated() async {}

  @override
  Future onLoadStart(url) async {}

  @override
  Future onLoadStop(url) async {}

  @override
  void onLoadError(url, code, msg) {}

  @override
  void onProgressChanged(progress) {}

  @override
  void onExit() {}

  @override
  Future<ShouldOverrideUrlLoadingAction> shouldOverrideUrlLoading(
      ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async {
    return ShouldOverrideUrlLoadingAction.ALLOW;
  }

  @override 
  void onLoadResource(response) {}

  @override 
  void onConsoleMessage(msg) {}
}

And don’t forget to import the flutter_appwebview library

import 'package:flutter_inappwebview/flutter_inappwebview.dart';

For more explanation kindly check the video tutorial

And that’s all for the WebExampleThree page you can now move to the homepage.dart file or any page you want your user to click the button to navigate to the WebExampleThree page.

So in the homepage, we just have to declare a final variable for WebExampleThree and that’s all

class _HomePageState extends State<HomePage> {
  final WebExampleThree inAppBrowser = WebExampleThree();

Then, on button pressed

              MaterialButton(
                onPressed: () {
                  inAppBrowser.openUrl(url: 'https://obounce.net');
                },
                child: Text(
                  'Example 3',
                  style: TextStyle(color: Colors.white),
                ),
                color: Colors.purple[700],
                padding: EdgeInsets.symmetric(horizontal: 70, vertical: 12),
              ),

And that’s all the major stuff you need to know πŸ‘Œ, For more explanation kindly check the video tutorial.

Source Code πŸ‘‡ – Show some ❀️ by starring ⭐ the repo and do follow me πŸ˜„!

GitHub – Flutter Webview

I hope you have learned one thing or the other, kindly give this article much appreciation you want if you enjoy it, feel free to ask a question and leave a comment if you feel like 🀭. Thanks for reading and see you in the next series.

πŸ”— Social Media / Let’s Connect πŸ”— ==> Github | Twitter | Youtube | WhatsApp | LinkedIn | Patreon | Facebook.

Join the Flutter Dev Community πŸ‘¨β€πŸ’»πŸ‘¨β€πŸ’» ==> Facebook | Telegram | WhatsApp | Signal.

Subscribe to my Telegram channel | Youtube channel | and also to hashnode newsletter in the input box above πŸ‘†πŸ‘†. Thanks

Happy Fluttering πŸ₯°πŸ‘¨β€πŸ’»

18 posts

About author
I'm passionate about learning and teaching programming, majorly Flutter at the moment. I make friends, develop, or learn from them.
Articles
Related posts
RandomStartups

Pivo A Nigerian Freight Carrier Digital Bank Raises $2 million In Seed Funding

2 Mins read
SMEs contribute a greater percentage in the business sector and a key players in the overall demand and supply chain. It is…
Now you knowRandom

Sony Acquires Beyond Sports - A 3D Animation Company To Complete Sports Metaverse Experience

1 Mins read
The Metaverse is shifting us from the old ways of social interaction devoid of experience to an immersive mode of social interaction…
Now you knowRandomStartups

SponsorUnited Raises $35M In Investment To Develop A Database Of Brand Sponsorships

2 Mins read
Every business no matter how big or small it may be will require some form of sponsorship to meet greater market demand,…
Get powered up with Techpadi Newsletter

Be the first to know what's happening in the African tech space

Leave a Reply