0% found this document useful (0 votes)
11 views

Testing Upload

This document shows code for a Flutter app that displays a webview. It imports necessary packages and defines a WebviewPage stateful widget class with a _WebviewPageState inner class. The state class initializes the webview controller and handles navigation requests.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Testing Upload

This document shows code for a Flutter app that displays a webview. It imports necessary packages and defines a WebviewPage stateful widget class with a _WebviewPageState inner class. The state class initializes the webview controller and handles navigation requests.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import 'package:flutter/material.

dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebviewPage extends StatefulWidget {


const WebviewPage({Key? key}) : super(key: key);

@override
State<WebviewPage> createState() => _WebviewPageState();
}

class _WebviewPageState extends State<WebviewPage> {


WebViewController? _controller;

@override
void initState() {
super.initState();
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {
// Update loading bar.
},
onPageStarted: (String url) {},
onPageFinished: (String url) {},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('https://www.youtube.com/')) {
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
),
)

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("MYSS - PT Sunthi Sepuri"),
actions: const [],
),
body: WebViewWidget(controller: _controller!));
}
}

You might also like