diff --git a/example/ios/Flutter/.last_build_id b/example/ios/Flutter/.last_build_id new file mode 100644 index 0000000000..491f86c3ff --- /dev/null +++ b/example/ios/Flutter/.last_build_id @@ -0,0 +1 @@ +b3c4eea2dd8d0e9a7588ec1d67cf9bef \ No newline at end of file diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 1f14e61d3d..1ed1292513 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -43,4 +43,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 7fb83752f59ead6285236625b82473f90b1cb932 -COCOAPODS: 1.8.3 +COCOAPODS: 1.9.1 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index fd37a24c78..b08a477ded 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -312,7 +312,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -386,7 +385,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -442,7 +440,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; diff --git a/example/pubspec.lock b/example/pubspec.lock index adbeff69b9..c2d8cd13af 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,20 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" async: dependency: transitive description: @@ -50,6 +36,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0+1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" collection: dependency: transitive description: @@ -64,13 +57,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" css_colors: dependency: transitive description: @@ -92,6 +78,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -128,13 +121,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.14.0+3" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" matcher: dependency: transitive description: @@ -162,7 +148,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.7.0" path_drawing: dependency: transitive description: @@ -184,13 +170,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.4.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" screen: dependency: transitive description: diff --git a/lib/html_parser.dart b/lib/html_parser.dart index eaea326d64..532f226d42 100644 --- a/lib/html_parser.dart +++ b/lib/html_parser.dart @@ -13,12 +13,8 @@ import 'package:html/dom.dart' as dom; import 'package:html/parser.dart' as htmlparser; typedef OnTap = void Function(String url); -typedef CustomRender = Widget Function( - RenderContext context, - Widget parsedChild, - Map attributes, - dom.Element element, -); +typedef CustomRender = dynamic Function(RenderContext context, + Widget parsedChild, Map attributes, dom.Element element); class HtmlParser extends StatelessWidget { final String htmlData; @@ -224,27 +220,30 @@ class HtmlParser extends StatelessWidget { ); if (customRender?.containsKey(tree.name) ?? false) { - return WidgetSpan( - child: ContainerSpan( + final render = customRender[tree.name].call( + newContext, + ContainerSpan( newContext: newContext, style: tree.style, shrinkWrap: context.parser.shrinkWrap, - child: customRender[tree.name].call( - newContext, - ContainerSpan( - newContext: newContext, - style: tree.style, - shrinkWrap: context.parser.shrinkWrap, - children: tree.children - ?.map((tree) => parseTree(newContext, tree)) - ?.toList() ?? - [], - ), - tree.attributes, - tree.element, - ), + children: tree.children + ?.map((tree) => parseTree(newContext, tree)) + ?.toList() ?? + [], ), + tree.attributes, + tree.element, ); + return render is InlineSpan + ? render + : WidgetSpan( + child: ContainerSpan( + newContext: newContext, + style: tree.style, + shrinkWrap: context.parser.shrinkWrap, + child: render, + ), + ); } //Return the correct InlineSpan based on the element type. diff --git a/lib/style.dart b/lib/style.dart index a7c81c33ba..e15b16623c 100644 --- a/lib/style.dart +++ b/lib/style.dart @@ -64,6 +64,12 @@ class Style { /// Inherited: no, /// Default: Unspecified (null), double height; + + /// CSS attribute "`line-height`" + /// + /// Inherited: yes + /// Default: Unspecifed (null), + double lineHeight; /// CSS attribute "`letter-spacing`" /// @@ -170,6 +176,7 @@ class Style { this.fontStyle, this.fontWeight, this.height, + this.lineHeight, this.letterSpacing, this.listStyleType, this.padding, @@ -212,9 +219,9 @@ class Style { letterSpacing: letterSpacing, shadows: textShadow, wordSpacing: wordSpacing, + height: lineHeight, //TODO background //TODO textBaseline - //TODO height ); } @@ -237,6 +244,7 @@ class Style { fontStyle: other.fontStyle, fontWeight: other.fontWeight, height: other.height, + lineHeight: other.lineHeight, letterSpacing: other.letterSpacing, listStyleType: other.listStyleType, padding: other.padding, @@ -280,6 +288,7 @@ class Style { textShadow: child.textShadow ?? textShadow, whiteSpace: child.whiteSpace ?? whiteSpace, wordSpacing: child.wordSpacing ?? wordSpacing, + lineHeight: child.lineHeight ?? lineHeight, ); } @@ -295,6 +304,7 @@ class Style { FontWeight fontWeight, double height, double letterSpacing, + double lineHeight, ListStyleType listStyleType, EdgeInsets padding, EdgeInsets margin, @@ -325,6 +335,7 @@ class Style { fontStyle: fontStyle ?? this.fontStyle, fontWeight: fontWeight ?? this.fontWeight, height: height ?? this.height, + lineHeight: lineHeight ?? this.lineHeight, letterSpacing: letterSpacing ?? this.letterSpacing, listStyleType: listStyleType ?? this.listStyleType, padding: padding ?? this.padding, @@ -361,6 +372,7 @@ class Style { this.fontStyle = textStyle.fontStyle; this.fontWeight = textStyle.fontWeight; this.letterSpacing = textStyle.letterSpacing; + this.lineHeight = textStyle.height; this.textShadow = textStyle.shadows; this.wordSpacing = textStyle.wordSpacing; } diff --git a/pubspec.lock b/pubspec.lock index 38d864d304..0e2ddf0c33 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,20 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" async: dependency: transitive description: @@ -50,6 +36,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0+1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" collection: dependency: transitive description: @@ -64,13 +57,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" css_colors: dependency: "direct main" description: @@ -85,6 +71,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.16.1" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -114,13 +107,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.14.0+3" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" matcher: dependency: transitive description: @@ -148,7 +134,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.7.0" path_drawing: dependency: transitive description: @@ -170,13 +156,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.4.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" screen: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 79d2362932..8adc671ddc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,17 +16,17 @@ dependencies: css_colors: ^1.0.2 # Plugins for rendering the