Skip to content

Commit 574205f

Browse files
authored
Merge pull request Sub6Resources#906 from tneotia/bugfix/iframe-styling
Allow iframes to be styled (Sub6Resources#836)
2 parents c07a0e3 + 9265e1f commit 574205f

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

lib/src/widgets/iframe_mobile.dart

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,20 @@ class IframeContentElement extends ReplacedElement {
3030
return Container(
3131
width: width ?? (height ?? 150) * 2,
3232
height: height ?? (width ?? 300) / 2,
33-
child: WebView(
34-
initialUrl: src,
35-
key: key,
36-
javascriptMode: sandboxMode == null || sandboxMode == "allow-scripts"
37-
? JavascriptMode.unrestricted
38-
: JavascriptMode.disabled,
39-
navigationDelegate: navigationDelegate,
40-
gestureRecognizers: {
41-
Factory<VerticalDragGestureRecognizer>(() => VerticalDragGestureRecognizer())
42-
},
33+
child: ContainerSpan(
34+
style: context.style,
35+
newContext: context,
36+
child: WebView(
37+
initialUrl: src,
38+
key: key,
39+
javascriptMode: sandboxMode == null || sandboxMode == "allow-scripts"
40+
? JavascriptMode.unrestricted
41+
: JavascriptMode.disabled,
42+
navigationDelegate: navigationDelegate,
43+
gestureRecognizers: {
44+
Factory<VerticalDragGestureRecognizer>(() => VerticalDragGestureRecognizer())
45+
},
46+
),
4347
),
4448
);
4549
}

lib/src/widgets/iframe_web.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ class IframeContentElement extends ReplacedElement {
3939
return Container(
4040
width: width ?? (height ?? 150) * 2,
4141
height: height ?? (width ?? 300) / 2,
42-
child: Directionality(
43-
textDirection: TextDirection.ltr,
44-
child: HtmlElementView(
45-
viewType: createdViewId,
46-
)
42+
child: ContainerSpan(
43+
style: context.style,
44+
newContext: context,
45+
child: Directionality(
46+
textDirection: TextDirection.ltr,
47+
child: HtmlElementView(
48+
viewType: createdViewId,
49+
)
50+
),
4751
)
4852
);
4953
}

0 commit comments

Comments
 (0)