From 16ca0a012ce989ba8d7b1fd939d077d299c90479 Mon Sep 17 00:00:00 2001 From: liyi Date: Thu, 12 Dec 2024 16:05:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=B0=83=E6=95=B4=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/login/login/JMuxerApp.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/login/login/JMuxerApp.dart b/lib/login/login/JMuxerApp.dart index 05ba059f..ad481c6e 100644 --- a/lib/login/login/JMuxerApp.dart +++ b/lib/login/login/JMuxerApp.dart @@ -13,6 +13,7 @@ class LocalHtmlPage extends StatefulWidget { class _LocalHtmlPageState extends State { late final WebViewController _controller; + Timer? timer; @override void initState() { @@ -45,7 +46,7 @@ class _LocalHtmlPageState extends State { int start = 0; int end = 0; List buffer = []; // 用于累积帧数据的缓冲区 - Timer? timer; + // 创建一个定时器,每800毫秒触发一次 timer ??= Timer.periodic(Duration(milliseconds: 800), (timer) async { @@ -216,4 +217,11 @@ class _LocalHtmlPageState extends State { return result; } + + @override + void dispose() { + timer?.cancel(); + timer=null; + super.dispose(); + } }