-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When used with the window_manager plugin, there is still an issue where the webview area blocks mouse and desktop interaction
Expected Behavior
The webview area does not affect the interaction between the mouse and desktop
Steps with code example to reproduce
Steps with code example to reproduce
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:test_web/window_manager.dart';
import 'package:window_manager/window_manager.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await windowManager.ensureInitialized();
WindowOptions windowOptions = const WindowOptions(
size: Size(800, 600),
center: true,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.hidden,
windowButtonVisibility: false,
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
ThemeMode _themeMode = ThemeMode.light;
InAppWebViewController? webViewController;
String url = "";
double progress = 0;
final urlController = TextEditingController();
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
final virtualWindowFrameBuilder = VirtualWindowFrameInit();
return MaterialApp(
debugShowCheckedModeBanner: false,
themeMode: _themeMode,
builder: (context, child) {
child = virtualWindowFrameBuilder(context, child);
return child;
},
home: Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(40),
child: SizedBox(
width: 1060,
child: Row(
children: [
const Expanded(
child: DragWindow(),
),
/// 右上角按钮
Row(children: [
IconButton(
onPressed: () async {
await windowManager.minimize();
},
icon: const Icon(Icons.remove)),
IconButton(
onPressed: () async {
await windowManager.close();
},
icon: const Icon(Icons.close)),
])
],
),
)),
body: SafeArea(
child: Column(children: <Widget>[
TextField(
decoration: const InputDecoration(prefixIcon: Icon(Icons.search)),
controller: urlController,
keyboardType: TextInputType.url,
onSubmitted: (value) {
var url = WebUri(value);
if (url.scheme.isEmpty) {
url = WebUri("https://www.google.com/search?q=$value");
}
webViewController?.loadUrl(urlRequest: URLRequest(url: url));
},
),
Expanded(
child: Stack(
children: [
InAppWebView(
initialUrlRequest:
URLRequest(url: WebUri("https://inappwebview.dev/")),
onWebViewCreated: (controller) {
webViewController = controller;
},
onLoadStart: (controller, url) {
setState(() {
this.url = url.toString();
urlController.text = this.url;
});
},
),
progress < 1.0
? LinearProgressIndicator(value: progress)
: Container(),
],
),
),
ButtonBar(
alignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
child: const Icon(Icons.arrow_back),
onPressed: () {
webViewController?.goBack();
},
),
ElevatedButton(
child: const Icon(Icons.arrow_forward),
onPressed: () {
webViewController?.goForward();
},
),
ElevatedButton(
child: const Icon(Icons.refresh),
onPressed: () {
webViewController?.reload();
},
),
],
),
])),
));
}
}
//拖动窗口
class DragWindow extends StatelessWidget {
const DragWindow({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
child: Listener(
onPointerDown: (event) async {
await windowManager.startDragging();
},
child: Container(
color: Colors.transparent,
),
),
);
}
}
Stacktrace/Logs
Stacktrace/Logs
<Replace this line by pasting your stacktrace or logs here>
Flutter version
v3.24.3
Operating System, Device-specific and/or Tool
Windows 11
Plugin version
^6.2.0-beta.2
Additional information
window_manager: ^0.4.3
Self grab
- I'm ready to work on this issue!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working