mirror of
https://github.com/haorendashu/nowser.git
synced 2025-12-17 09:54:19 +01:00
try to add linux webview support
This commit is contained in:
70
lib/component/webview/webview_linux_controller.dart
Normal file
70
lib/component/webview/webview_linux_controller.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
|
||||
import 'package:webview_cef/webview_cef.dart';
|
||||
|
||||
import 'webview_controller_interface.dart';
|
||||
|
||||
class WebviewLinuxController extends WebviewControllerInterface {
|
||||
|
||||
WebViewController controller;
|
||||
|
||||
WebviewLinuxController(this.controller);
|
||||
|
||||
@override
|
||||
Future<void> reload() async {
|
||||
await controller.reload();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> goBack() async {
|
||||
await controller.goBack();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> canGoBack() async {
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> goForward() async {
|
||||
await controller.goForward();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Uri?> getUrl() async {
|
||||
try {
|
||||
if (url != null) {
|
||||
return Uri.parse(url!);
|
||||
}
|
||||
} catch (e) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String?> getFavicon() async {
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> loadUrl(String url) async {
|
||||
await controller.loadUrl(url);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String?> getTitle() async {
|
||||
return title;
|
||||
}
|
||||
|
||||
String? title;
|
||||
|
||||
String? url;
|
||||
|
||||
void setTitle(String title) {
|
||||
title = title;
|
||||
}
|
||||
|
||||
void setUrl(String url) {
|
||||
url = url;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user