createPortal method
Create a portal container with optimized properties for portaling
Implementation
Future<String> createPortal(String portalId, {
required String parentViewId,
Map<String, dynamic>? props,
int? index,
}) async {
await isReady;
if (kDebugMode) {
print('🚪 VDom: Creating portal container: $portalId');
}
// Create portal-specific properties
final portalProps = {
'portalId': portalId,
'isPortalContainer': true,
'backgroundColor': 'transparent',
'clipsToBounds': false, // Allow content to overflow if needed
'userInteractionEnabled': true,
...(props ?? {}),
};
try {
// Create the portal container view using regular View type for native compatibility
await _nativeBridge.createView(portalId, 'View', portalProps);
// Attach to parent
await _nativeBridge.attachView(portalId, parentViewId, index ?? 0);
if (kDebugMode) {
print('✅ VDom: Successfully created portal container: $portalId');
}
return portalId;
} catch (e) {
if (kDebugMode) {
print('❌ VDom: Error creating portal container: $e');
}
rethrow;
}
}