Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow srcdoc and point packages to uptech repo #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ environment:

dependencies:
flutter_html:
path: ..
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_html_all:
path: ../packages/flutter_html_all
git:
url: https://github.com/uptech/flutter_html.git
path: packages/flutter_html_all
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter:
sdk: flutter

Expand Down
42 changes: 35 additions & 7 deletions packages/flutter_html_all/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: flutter_html_all
description: All optional flutter_html widgets, bundled into a single package.
version: 3.0.0-beta.2
homepage: https://github.com/Sub6Resources/flutter_html
publish_to: none # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.12.0 <4.0.0"
Expand All @@ -11,13 +12,40 @@ dependencies:
flutter:
sdk: flutter
html: '>=0.15.0 <1.0.0'
flutter_html: ^3.0.0-beta.2
flutter_html_audio: ^3.0.0-beta.2
flutter_html_iframe: ^3.0.0-beta.2
flutter_html_math: ^3.0.0-beta.2
flutter_html_svg: ^3.0.0-beta.2
flutter_html_table: ^3.0.0-beta.2
flutter_html_video: ^3.0.0-beta.2
flutter_html:
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_html_audio:
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
path: packages/flutter_html_audio
flutter_html_iframe:
git:
url: https://github.com/uptech/flutter_html.git
path: packages/flutter_html_iframe
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_html_math:
git:
url: https://github.com/uptech/flutter_html.git
path: packages/flutter_html_math
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_html_svg:
git:
url: https://github.com/uptech/flutter_html.git
path: packages/flutter_html_svg
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_html_table:
git:
url: https://github.com/uptech/flutter_html.git
path: packages/flutter_html_table
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_html_video:
git:
url: https://github.com/uptech/flutter_html.git
path: packages/flutter_html_video
ref: allow-srcdoc-and-point-packages-to-uptech-repo

dev_dependencies:
flutter_test:
Expand Down
6 changes: 5 additions & 1 deletion packages/flutter_html_audio/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: flutter_html_audio
description: This extension package allows the <audio> tag to be rendered using the flutter_html package
version: 3.0.0-beta.2
homepage: https://github.com/Sub6Resources/flutter_html
publish_to: none # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.12.0 <4.0.0"
Expand All @@ -11,7 +12,10 @@ dependencies:
flutter:
sdk: flutter
html: '>=0.15.0 <1.0.0'
flutter_html: ^3.0.0-beta.2
flutter_html:
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
video_player: '>=2.2.8 <3.0.0'
chewie_audio: ^1.5.0

Expand Down
19 changes: 15 additions & 4 deletions packages/flutter_html_iframe/lib/iframe_mobile.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -34,17 +36,26 @@ class IframeWidget extends StatelessWidget {
final givenHeight =
double.tryParse(extensionContext.attributes['height'] ?? "");

Uri? srcUri;

if (extensionContext.attributes['srcdoc'] != null) {
srcUri = Uri.dataFromString(
extensionContext.attributes['srcdoc'] ?? '',
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8'),
);
} else {
srcUri = Uri.tryParse(extensionContext.attributes['src'] ?? "") ?? Uri();
}

return SizedBox(
width: givenWidth ?? (givenHeight ?? 150) * 2,
height: givenHeight ?? (givenWidth ?? 300) / 2,
child: CssBoxWidget(
style: extensionContext.styledElement!.style,
childIsReplaced: true,
child: WebViewWidget(
controller: controller
..loadRequest(
Uri.tryParse(extensionContext.attributes['src'] ?? "") ??
Uri()),
controller: controller..loadRequest(srcUri),
key: key,
gestureRecognizers: {Factory(() => VerticalDragGestureRecognizer())},
),
Expand Down
6 changes: 5 additions & 1 deletion packages/flutter_html_iframe/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: flutter_html_iframe
description: This extension package allows the <iframe> tag to be rendered using the flutter_html package
version: 3.0.0-beta.2
homepage: https://github.com/Sub6Resources/flutter_html
publish_to: none # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.12.0 <4.0.0"
Expand All @@ -11,7 +12,10 @@ dependencies:
flutter:
sdk: flutter
html: '>=0.15.0 <1.0.0'
flutter_html: ^3.0.0-beta.2
flutter_html:
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
webview_flutter: '>=4.0.0 <5.0.0'

dev_dependencies:
Expand Down
6 changes: 5 additions & 1 deletion packages/flutter_html_math/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: flutter_html_math
description: This extension package allows the <math> tag to be rendered using the flutter_html package
version: 3.0.0-beta.2
homepage: https://github.com/Sub6Resources/flutter_html
publish_to: none # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.12.0 <4.0.0"
Expand All @@ -11,7 +12,10 @@ dependencies:
flutter:
sdk: flutter
html: '>=0.15.0 <1.0.0'
flutter_html: ^3.0.0-beta.2
flutter_html:
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_math_fork: '>=0.6.0 <1.0.0'

dev_dependencies:
Expand Down
6 changes: 5 additions & 1 deletion packages/flutter_html_svg/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: flutter_html_svg
description: This extension package allows the <svg> tag and svg-based img sources to be rendered using the flutter_html package
version: 3.0.0-beta.2
homepage: https://github.com/Sub6Resources/flutter_html
publish_to: none # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.17.0 <4.0.0"
Expand All @@ -11,7 +12,10 @@ dependencies:
flutter:
sdk: flutter
html: '>=0.15.0 <1.0.0'
flutter_html: ^3.0.0-beta.2
flutter_html:
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_svg: '>=1.0.0 <3.0.0'

dev_dependencies:
Expand Down
6 changes: 5 additions & 1 deletion packages/flutter_html_table/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description: This extension package allows the <table> tag to be rendered using

version: 3.0.0-beta.2
homepage: https://github.com/Sub6Resources/flutter_html
publish_to: none # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.17.0 <4.0.0"
Expand All @@ -12,7 +13,10 @@ dependencies:
flutter:
sdk: flutter
html: '>=0.15.0 <1.0.0'
flutter_html: ^3.0.0-beta.2
flutter_html:
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
flutter_layout_grid: '>=1.0.1 <3.0.0'

dev_dependencies:
Expand Down
6 changes: 5 additions & 1 deletion packages/flutter_html_video/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: flutter_html_video
description: This extension package allows the <video> tag to be rendered using the flutter_html package
version: 3.0.0-beta.2
homepage: https://github.com/Sub6Resources/flutter_html
publish_to: none # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.12.0 <4.0.0"
Expand All @@ -11,7 +12,10 @@ dependencies:
flutter:
sdk: flutter
html: '>=0.15.0 <1.0.0'
flutter_html: ^3.0.0-beta.2
flutter_html:
git:
url: https://github.com/uptech/flutter_html.git
ref: allow-srcdoc-and-point-packages-to-uptech-repo
video_player: '>=2.2.8 <3.0.0'
chewie: '>=1.1.0 <2.0.0'

Expand Down