Skip to content

Commit ce7d979

Browse files
committed
Remove Block and block_element.dart in favor of Style
1 parent aca4bc3 commit ce7d979

File tree

6 files changed

+173
-202
lines changed

6 files changed

+173
-202
lines changed

lib/html_parser.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ class HtmlParser extends StatelessWidget {
8989
return parseStyledElement(node, children);
9090
} else if (INTERACTABLE_ELEMENTS.contains(node.localName)) {
9191
return parseInteractableElement(node, children);
92-
} else if (BLOCK_ELEMENTS.contains(node.localName)) {
93-
return parseBlockElement(node, children);
9492
} else if (REPLACED_ELEMENTS.contains(node.localName)) {
9593
return parseReplacedElement(node);
9694
} else if (LAYOUT_ELEMENTS.contains(node.localName)) {
@@ -324,14 +322,14 @@ class ContainerSpan extends StatelessWidget {
324322
Widget build(BuildContext _) {
325323
return Container(
326324
decoration: BoxDecoration(
327-
border: style?.block?.border,
325+
border: style?.border,
328326
color: style?.backgroundColor,
329327
),
330-
height: style?.block?.height,
331-
width: style?.block?.width,
328+
height: style?.height,
329+
width: style?.width,
332330
padding: style?.padding,
333331
margin: style?.margin,
334-
alignment: style?.block?.alignment,
332+
alignment: style?.alignment,
335333
child: child ??
336334
RichText(
337335
text: TextSpan(

lib/src/block_element.dart

Lines changed: 0 additions & 180 deletions
This file was deleted.

lib/src/html_elements.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export 'styled_element.dart';
22
export 'interactable_element.dart';
3-
export 'package:flutter_html/src/block_element.dart';
43
export 'replaced_element.dart';
54

65
const STYLED_ELEMENTS = [
@@ -39,13 +38,8 @@ const STYLED_ELEMENTS = [
3938
"u",
4039
"var",
4140
"wbr",
42-
];
43-
44-
const INTERACTABLE_ELEMENTS = [
45-
"a",
46-
];
4741

48-
const BLOCK_ELEMENTS = [
42+
//BLOCK ELEMENTS
4943
"article",
5044
"aside",
5145
"blockquote",
@@ -82,6 +76,10 @@ const BLOCK_ELEMENTS = [
8276
"ul",
8377
];
8478

79+
const INTERACTABLE_ELEMENTS = [
80+
"a",
81+
];
82+
8583
const REPLACED_ELEMENTS = [
8684
"audio",
8785
"br",

lib/src/replaced_element.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class AudioContentElement extends ReplacedElement {
138138
@override
139139
Widget toWidget(RenderContext context) {
140140
return Container(
141-
width: context.style.block?.width ?? 300,
141+
width: context.style.width ?? 300,
142142
child: ChewieAudio(
143143
controller: ChewieAudioController(
144144
videoPlayerController: VideoPlayerController.network(

0 commit comments

Comments
 (0)