2024-03-30 20:14:00 +08:00
|
|
|
import 'package:flutter/material.dart';
|
2024-04-03 14:36:36 +08:00
|
|
|
import 'package:web_synchronization_tool/windows/socket_tool.dart';
|
2024-04-02 20:29:52 +08:00
|
|
|
import 'package:web_synchronization_tool/windows/web_grid_view.dart';
|
2024-03-30 20:14:00 +08:00
|
|
|
import 'package:webview_windows/webview_windows.dart';
|
|
|
|
|
|
|
|
|
|
class WindowsPage extends StatefulWidget {
|
|
|
|
|
const WindowsPage({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<WindowsPage> createState() => _WindowsPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _WindowsPageState extends State<WindowsPage> {
|
2024-04-02 20:29:52 +08:00
|
|
|
Widget? windowsWebWidget;
|
|
|
|
|
WebviewController mainController = WebviewController();
|
|
|
|
|
final gridController = WebGridController();
|
2024-03-30 20:14:00 +08:00
|
|
|
|
|
|
|
|
bool initDone = false;
|
|
|
|
|
|
2024-04-02 20:29:52 +08:00
|
|
|
String clickId = '';
|
|
|
|
|
String zoomId = '';
|
|
|
|
|
|
2024-03-30 20:14:00 +08:00
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
|
2024-04-03 17:45:52 +08:00
|
|
|
SocketUtils.getInstance().connect();
|
|
|
|
|
SocketUtils.getInstance().heartbeat();
|
2024-04-03 21:53:27 +08:00
|
|
|
|
2024-03-30 20:14:00 +08:00
|
|
|
controllerInit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future controllerInit() async {
|
|
|
|
|
await mainController.initialize();
|
|
|
|
|
|
|
|
|
|
mainController.loadUrl('http://www.df6831.com/');
|
|
|
|
|
|
2024-04-02 20:29:52 +08:00
|
|
|
gridController.addWebController(mainController);
|
2024-03-30 20:14:00 +08:00
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
initDone = true;
|
|
|
|
|
});
|
2024-04-01 21:41:42 +08:00
|
|
|
}
|
2024-03-30 20:14:00 +08:00
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2024-04-03 10:37:41 +08:00
|
|
|
|
2024-03-30 20:14:00 +08:00
|
|
|
if (initDone == false) return Container();
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
2024-04-03 12:54:07 +08:00
|
|
|
body: WebGridWidget(
|
|
|
|
|
controller: gridController,
|
2024-03-30 20:14:00 +08:00
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|