webview_flutter_plus_latest 0.0.1+1 webview_flutter_plus_latest: ^0.0.1+1 copied to clipboard
An extension of webview_flutter to load local HTML,CSS and Javascript from Assets or Strings and much more.
import 'package:flutter/material.dart';
import 'package:webview_flutter_plus_latest/webview_flutter_plus.dart';
void main() {
runApp(const WebViewPlusExample());
}
class WebViewPlusExample extends StatelessWidget {
const WebViewPlusExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: WebViewPlusExampleMainPage(),
);
}
}
class WebViewPlusExampleMainPage extends StatefulWidget {
const WebViewPlusExampleMainPage({Key? key}) : super(key: key);
@override
State createState() => _WebViewPlusExampleMainPageState();
}
class _WebViewPlusExampleMainPageState
extends State<WebViewPlusExampleMainPage> {
WebViewPlusController? _controller;
double _height = 1;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('webview_flutter_plus Example'),
),
body: ListView(
children: [
Text("Height of WebviewPlus: $_height",
style: const TextStyle(fontWeight: FontWeight.bold)),
SizedBox(
height: _height,
child: WebViewPlus(
javascriptChannels: null,
initialUrl: 'assets/index.html',
onWebViewCreated: (controller) {
_controller = controller;
},
onPageFinished: (url) {
_controller?.getHeight().then((double height) {
debugPrint("Height: $height");
setState(() {
_height = height;
});
});
},
javascriptMode: JavascriptMode.unrestricted,
),
)
],
),
);
}
}