-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feedback google forms iframe (#26864)
* google forms * iframe * Fix tests --------- Co-authored-by: darkhan.nausharipov <darkhan.nausharipov@kzn.akvelon.com>
- Loading branch information
1 parent
e1b4ed3
commit 538c7bd
Showing
7 changed files
with
141 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
playground/frontend/playground_components/lib/src/widgets/iframe/iframe.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export 'iframe_non_web.dart' if (dart.library.html) 'iframe_web.dart'; |
41 changes: 41 additions & 0 deletions
41
playground/frontend/playground_components/lib/src/widgets/iframe/iframe_non_web.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// ignore: avoid_web_libraries_in_flutter | ||
|
||
import 'package:flutter/widgets.dart'; | ||
|
||
class IFrameWidget extends StatefulWidget { | ||
final String url; | ||
final String viewType; | ||
|
||
const IFrameWidget({ | ||
required this.url, | ||
required this.viewType, | ||
}); | ||
|
||
@override | ||
State<IFrameWidget> createState() => _IFrameWidgetState(); | ||
} | ||
|
||
class _IFrameWidgetState extends State<IFrameWidget> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return ErrorWidget('This only works in web.'); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
playground/frontend/playground_components/lib/src/widgets/iframe/iframe_web.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// ignore: avoid_web_libraries_in_flutter | ||
import 'dart:html' as html; | ||
import 'dart:ui' as ui; | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
class IFrameWidget extends StatefulWidget { | ||
final String url; | ||
final String viewType; | ||
|
||
const IFrameWidget({ | ||
required this.url, | ||
required this.viewType, | ||
}); | ||
|
||
@override | ||
State<IFrameWidget> createState() => _IFrameWidgetState(); | ||
} | ||
|
||
class _IFrameWidgetState extends State<IFrameWidget> { | ||
final _iFrameElement = html.IFrameElement(); | ||
|
||
@override | ||
void initState() { | ||
// ignore: unsafe_html | ||
_iFrameElement.src = widget.url; | ||
_iFrameElement.style.border = 'none'; | ||
// ignore: undefined_prefixed_name, avoid_dynamic_calls | ||
ui.platformViewRegistry.registerViewFactory( | ||
widget.viewType, | ||
(int viewId) => _iFrameElement, | ||
); | ||
|
||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return HtmlElementView( | ||
viewType: widget.viewType, | ||
); | ||
} | ||
} |