39 lines
873 B
Dart
39 lines
873 B
Dart
|
|
import 'dart:html';
|
|
|
|
import 'dart:ui' as ui;
|
|
import 'package:flutter/material.dart';
|
|
|
|
class IFrameWeb extends StatefulWidget {
|
|
final String width;
|
|
final String height;
|
|
final String src;
|
|
|
|
const IFrameWeb({this.width, this.height, this.src});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() {
|
|
return IFrameWebState();
|
|
}
|
|
}
|
|
|
|
class IFrameWebState extends State<IFrameWeb> {
|
|
final IFrameElement _iframeElement = IFrameElement();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
_iframeElement.height = widget.height;
|
|
_iframeElement.width = widget.width;
|
|
_iframeElement.src = widget.src;
|
|
_iframeElement.style.border = 'none';
|
|
ui.platformViewRegistry.registerViewFactory(
|
|
'iframeElement',
|
|
(int viewId) => _iframeElement,
|
|
);
|
|
return HtmlElementView(
|
|
key: UniqueKey(),
|
|
viewType: 'iframeElement',
|
|
);
|
|
}
|
|
|
|
} |