Hi π, everyone and welcome to a brand new tutorial series on Flutter.
Today I wanted to write about one of those features in a mobile application, which as you may have guessed from the title, is a webview app in Flutter! If you want to know more about some cogent flutter Tricks and Tips and How to achieve tasks easily in Flutter, consider subscribing to my newsletter so you donβt miss anything!
In this tutorial, we will create the first example of our webview application using flutter, and this is the simplest way to showcase a webpage in our app.
This series will be split into four because weβre going to unveil four examples of a webview app we can use in a flutter application.
Kindly check out the PART ONE video on my YouTube channel. Kindly subscribe β
I have already written two articles on this same topics before but there are fresh features on the package used
- Convert your website into a mobile application in just a few minutes using flutter.
- Flutter Advanced Webview Tutorial #1 β InAppWebview(Android & iOS).
Letβs get started
Firstly, weβre going to use the flutter_webview_plugin package for PART ONE. Son install this package in your app by pasting it in your pubspec.yaml file.
Create a new dart file for the webview page and name it webApp1.dart or so π€·ββοΈ, after creating the dart file, then inside the file {webApp1.dart} create a StatefulWidget and name the class as you wish, I will name mine ## WebExampleOne π.
In the build widget, weβre going to return the webview widget called ==> WebviewScaffold instead of returning a normal Scaffold widget π€’.
But before that, you need to import our material widget and the flutter_webview_plugin widget as well
import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
And thatβs all, we can now work on our WebviewScaffold, if you press CTRL + SPACE ==> (Both Windows and Mac) inside the bracket of the WebviewScaffold( ) you will see a list of resources you can make use of while the URL is required,
url: 'https://obounce.net'
Then, after that you can just explore other useful methods you might need
appBar: AppBar(
title: Text("O'Bounce Technologies"),
centerTitle: true,
elevation: 0,
),
withZoom: true,
withLocalStorage: true,
scrollBar: true,
withJavascript: true,
initialChild: Center(child: Text('Loading...')),
bottomNavigationBar: Padding(
padding: EdgeInsets.all(12),
child: Text('This is the bottomNavigationBar on a webview page.'),
),
persistentFooterButtons: [
CircleAvatar(
backgroundColor: Colors.purple,
child: Text('btn1'),
),
CircleAvatar(
backgroundColor: Colors.orange,
child: Text('btn2'),
),
CircleAvatar(
backgroundColor: Colors.red,
child: Text('btn3'),
),
CircleAvatar(
backgroundColor: Colors.grey[700],
child: Text('btn4'),
),
],
And thatβs all the major stuff we need π, You should check out the video for more explanation.
Source Code π β Show some β€οΈ by starring β the repo and do follow me π!
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.
Join the Flutter Dev Community π¨βπ»π¨βπ» ==> Facebook | Telegram | WhatsApp | Signal.
Subscribe to my Telegram channel | Youtube channel | and also to Techpadi newsletter in the input box above ππ or below π€·ββοΈ. Thanks
Happy Fluttering π₯°π¨βπ»