Tuesday, September 1, 2020

Build Web pages view in flutter in just few minutes

 Steps to do:

Step 1:

First of all get the Flutter_Web_View_Plugin from pub.dev and paste it in the pubspec.yaml





After that click on packages get to get the package to use in the application

import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return WebviewScaffold(
      withZoom: true,
      url: 'https://www.google.com/',
      appBar: AppBar(
        title: Text("My Site"),
        backgroundColor: Colors.deepOrange,
      ),
    );
  }
}


This is the output you can use any site you want just change the url in the code

No comments:

Post a Comment

Comment , if you have any doubt

C++