import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:get/get.dart'; import 'controller.dart'; class WebViewPage extends GetView { const WebViewPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { Get.put(WebController()); return Scaffold( appBar: AppBar( title: Text(controller.title), centerTitle: true, bottom: PreferredSize( preferredSize: const Size.fromHeight(2.0), child: Obx( () => controller.progress.value < 1.0 ? LinearProgressIndicator( value: controller.progress.value, backgroundColor: Colors.transparent, valueColor: AlwaysStoppedAnimation( Theme.of(context).primaryColor, ), minHeight: 2.0, ) : const SizedBox(height: 2.0), ), ), ), body: InAppWebView( initialUrlRequest: URLRequest(url: WebUri(controller.url)), initialSettings: InAppWebViewSettings( isInspectable: true, javaScriptEnabled: true, javaScriptCanOpenWindowsAutomatically: true, useShouldOverrideUrlLoading: true, mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW, mediaPlaybackRequiresUserGesture: false, allowsInlineMediaPlayback: true, ), onWebViewCreated: controller.onWebViewCreated, onProgressChanged: controller.onProgressChanged, ), ); } }