From 60ba52f00fe7e57bc2b10285dd0832341b76d33b Mon Sep 17 00:00:00 2001 From: U2yyy Date: Mon, 17 Nov 2025 19:05:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9A=B4=E9=9C=B2=E7=94=A8=E4=BA=8EPlatfor?= =?UTF-8?q?mView=E5=88=9B=E5=BB=BA=E5=AE=8C=E6=88=90=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/flutter_vap_view.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/flutter_vap_view.dart b/lib/flutter_vap_view.dart index c279646..1ed66f1 100644 --- a/lib/flutter_vap_view.dart +++ b/lib/flutter_vap_view.dart @@ -1,4 +1,5 @@ import 'dart:io'; +import 'dart:nativewrappers/_internal/vm/lib/ffi_allocation_patch.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -19,6 +20,7 @@ class FlutterVapView extends StatefulWidget { this.onVideoRender, this.onFailed, this.scaleType = VapScaleType.fitXY, + this.onCreateView, }); /// 外部控制器,必填 @@ -43,6 +45,9 @@ class FlutterVapView extends StatefulWidget { /// Video scaling type, default is fitXY final VapScaleType scaleType; + // 用于PlatformView创建完成后的回调 + final Function? onCreateView; + @override State createState() => _FlutterVapViewState(); } @@ -60,6 +65,7 @@ class _FlutterVapViewState extends State { _channel = MethodChannel('flutter_vap_plugin_$id'); _channel?.setMethodCallHandler(_handleMethodCall); widget.controller.bindChannel(_channel!); + widget.onCreateView.call(); } Future _handleMethodCall(MethodCall call) async { From 1f5dde7abd2fc38acda10561ce23b72040462b7a Mon Sep 17 00:00:00 2001 From: U2yyy Date: Mon, 17 Nov 2025 19:10:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.zh.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.zh.md b/README.zh.md index 7964ff9..5bc0bf8 100644 --- a/README.zh.md +++ b/README.zh.md @@ -81,6 +81,9 @@ class MyApp extends StatelessWidget { child: FlutterVapView( controller: vapController, scaleType: VapScaleType.fitXY, + onCreateView: () { + // 现在可以在这里播放 + }, onVideoStart: () { debugPrint('VAP - 视频开始播放'); }, From 1010ba3fd0f990afddba194b076fd6a0e79e1eff Mon Sep 17 00:00:00 2001 From: U2yyy Date: Mon, 17 Nov 2025 19:16:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=94=A8=E6=9B=B4=E5=8A=A0=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=9B=BF=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/flutter_vap_view.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/flutter_vap_view.dart b/lib/flutter_vap_view.dart index 1ed66f1..5188640 100644 --- a/lib/flutter_vap_view.dart +++ b/lib/flutter_vap_view.dart @@ -46,7 +46,7 @@ class FlutterVapView extends StatefulWidget { final VapScaleType scaleType; // 用于PlatformView创建完成后的回调 - final Function? onCreateView; + final VoidCallback? onCreateView; @override State createState() => _FlutterVapViewState();