Skip to content

Commit

Permalink
Replace the webviewx package with webview_flutter_web. (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
timbotimbo committed Mar 27, 2023
1 parent 8b38743 commit ff73bc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
16 changes: 7 additions & 9 deletions lib/src/web/web_unity_widget_view.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:webviewx/webviewx.dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebUnityWidgetView extends StatefulWidget {
const WebUnityWidgetView({
Expand All @@ -16,6 +16,11 @@ class WebUnityWidgetView extends StatefulWidget {
}

class _WebUnityWidgetViewState extends State<WebUnityWidgetView> {
final WebViewController _controller = WebViewController()
..loadRequest(
Uri.parse('${Uri.base.origin}/UnityLibrary/index.html'),
);

@override
void initState() {
super.initState();
Expand All @@ -29,13 +34,6 @@ class _WebUnityWidgetViewState extends State<WebUnityWidgetView> {

@override
Widget build(BuildContext context) {
return WebViewX(
initialContent: '${Uri.base.origin}/UnityLibrary/index.html',
initialSourceType: SourceType.url,
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (_) {},
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
);
return WebViewWidget(controller: _controller);
}
}
3 changes: 2 additions & 1 deletion pubspec.yaml
Expand Up @@ -19,7 +19,8 @@ dependencies:
flutter_plugin_android_lifecycle: ^2.0.7
stream_transform: ^2.0.0
plugin_platform_interface: ^2.1.2
webviewx: ^0.2.1
webview_flutter: ^4.0.0
webview_flutter_web: ^0.2.2
# ffi: ^1.2.1 // required for windows support

dev_dependencies:
Expand Down

0 comments on commit ff73bc1

Please sign in to comment.