Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the webviewx package with webview_flutter_web. #761

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions lib/src/web/web_unity_widget_view.dart
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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