Skip to content

Commit a62449a

Browse files
committed
fix: Change CSSBoxWidget to CssBoxWidget
1 parent 0f3e3a4 commit a62449a

File tree

9 files changed

+18
-21
lines changed

9 files changed

+18
-21
lines changed

lib/custom_render.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ CustomRender blockElementRender({Style? style, List<InlineSpan>? children}) =>
131131
return WidgetSpan(
132132
alignment: PlaceholderAlignment.baseline,
133133
baseline: TextBaseline.alphabetic,
134-
child: CSSBoxWidget.withInlineSpanChildren(
134+
child: CssBoxWidget.withInlineSpanChildren(
135135
key: context.key,
136136
style: style ?? context.tree.style,
137137
shrinkWrap: context.parser.shrinkWrap,
@@ -157,7 +157,7 @@ CustomRender listElementRender(
157157
{Style? style, Widget? child, List<InlineSpan>? children}) =>
158158
CustomRender.inlineSpan(
159159
inlineSpan: (context, buildChildren) => WidgetSpan(
160-
child: CSSBoxWidget(
160+
child: CssBoxWidget(
161161
key: context.key,
162162
style: style ?? context.tree.style,
163163
shrinkWrap: context.parser.shrinkWrap,
@@ -206,7 +206,7 @@ CustomRender listElementRender(
206206
? 10.0
207207
: 0.0)
208208
: EdgeInsets.zero,
209-
child: CSSBoxWidget.withInlineSpanChildren(
209+
child: CssBoxWidget.withInlineSpanChildren(
210210
children: _getListElementChildren(
211211
style?.listStylePosition ??
212212
context.tree.style.listStylePosition,
@@ -472,7 +472,7 @@ CustomRender verticalAlignRender(
472472
key: context.key,
473473
offset: Offset(
474474
0, verticalOffset ?? _getVerticalOffset(context.tree)),
475-
child: CSSBoxWidget.withInlineSpanChildren(
475+
child: CssBoxWidget.withInlineSpanChildren(
476476
children: children ?? buildChildren.call(),
477477
style: context.style,
478478
),

lib/html_parser.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class HtmlParser extends StatelessWidget {
101101
processedTree,
102102
);
103103

104-
return CSSBoxWidget.withInlineSpanChildren(
104+
return CssBoxWidget.withInlineSpanChildren(
105105
style: processedTree.style,
106106
children: [parsedTree],
107107
selectable: selectable,
@@ -364,7 +364,7 @@ class HtmlParser extends StatelessWidget {
364364
.call(newContext, buildChildren);
365365
}
366366
return WidgetSpan(
367-
child: CSSBoxWidget(
367+
child: CssBoxWidget(
368368
style: tree.style,
369369
shrinkWrap: newContext.parser.shrinkWrap,
370370
child:

lib/src/css_box_widget.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
44
import 'package:flutter/rendering.dart';
55
import 'package:flutter_html/flutter_html.dart';
66

7-
class CSSBoxWidget extends StatelessWidget {
8-
CSSBoxWidget({
7+
class CssBoxWidget extends StatelessWidget {
8+
CssBoxWidget({
99
this.key,
1010
required this.child,
1111
required this.style,
@@ -15,7 +15,7 @@ class CSSBoxWidget extends StatelessWidget {
1515
}) : super(key: key);
1616

1717
/// Generates a CSSBoxWidget that contains a list of InlineSpan children.
18-
CSSBoxWidget.withInlineSpanChildren({
18+
CssBoxWidget.withInlineSpanChildren({
1919
this.key,
2020
required List<InlineSpan> children,
2121
required this.style,
@@ -696,7 +696,6 @@ extension Normalize on Dimension {
696696
}
697697

698698
double _calculateEmValue(Style style, BuildContext buildContext) {
699-
//TODO is there a better value for this?
700699
return (style.fontSize?.emValue ?? 16) *
701700
MediaQuery.textScaleFactorOf(buildContext) *
702701
MediaQuery.of(buildContext).devicePixelRatio;

lib/src/layout_element.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ class DetailsContentElement extends LayoutElement {
154154
expandedAlignment: Alignment.centerLeft,
155155
title: elementList.isNotEmpty == true &&
156156
elementList.first.localName == "summary"
157-
? CSSBoxWidget.withInlineSpanChildren(
157+
? CssBoxWidget.withInlineSpanChildren(
158158
children: firstChild == null ? [] : [firstChild],
159159
style: style,
160160
)
161161
: Text("Details"),
162162
children: [
163-
CSSBoxWidget.withInlineSpanChildren(
163+
CssBoxWidget.withInlineSpanChildren(
164164
children: getChildren(
165165
childrenList,
166166
context,

lib/src/replaced_element.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ class RubyElement extends ReplacedElement {
112112
child: Center(
113113
child: Transform(
114114
transform: Matrix4.translationValues(0, -(rubyYPos), 0),
115-
child: CSSBoxWidget(
115+
child: CssBoxWidget(
116116
style: c.style,
117-
//TODO do any other attributes apply?
118117
child: Text(
119118
c.element!.innerHtml,
120119
style: c.style
@@ -125,8 +124,7 @@ class RubyElement extends ReplacedElement {
125124
),
126125
),
127126
),
128-
CSSBoxWidget(
129-
//TODO do any other styles apply? Does ruby still work?
127+
CssBoxWidget(
130128
style: context.style,
131129
child: node is TextContentElement
132130
? Text(

packages/flutter_html_audio/lib/flutter_html_audio.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class _AudioWidgetState extends State<AudioWidget> {
8181
return Container(height: 0, width: 0);
8282
}
8383

84-
return CSSBoxWidget(
84+
return CssBoxWidget(
8585
key: widget.context.key,
8686
style: widget.context.style,
8787
child: ChewieAudio(

packages/flutter_html_iframe/lib/iframe_mobile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CustomRender iframeRender({NavigationDelegate? navigationDelegate}) =>
1515
return Container(
1616
width: givenWidth ?? (givenHeight ?? 150) * 2,
1717
height: givenHeight ?? (givenWidth ?? 300) / 2,
18-
child: CSSBoxWidget(
18+
child: CssBoxWidget(
1919
style: context.style,
2020
childIsReplaced: true,
2121
child: WebView(

packages/flutter_html_iframe/lib/iframe_web.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ CustomRender iframeRender({NavigationDelegate? navigationDelegate}) =>
3535
(double.tryParse(context.tree.element?.attributes['width'] ?? "") ??
3636
300) /
3737
2,
38-
child: CSSBoxWidget(
38+
child: CssBoxWidget(
3939
style: context.style,
4040
childIsReplaced: true,
4141
child: Directionality(

packages/flutter_html_table/lib/flutter_html_table.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ Widget _layoutCells(RenderContext context, BoxConstraints constraints) {
116116
columnColspanOffset[columni].clamp(1, columnMax - columni - 1);
117117
}
118118
cells.add(GridPlacement(
119-
child: CSSBoxWidget(
119+
child: CssBoxWidget(
120120
style: child.style
121121
.merge(row.style), //TODO padding/decoration(color/border)
122122
child: SizedBox.expand(
123123
child: Container(
124124
alignment: child.style.alignment ??
125125
context.style.alignment ??
126126
Alignment.centerLeft,
127-
child: CSSBoxWidget.withInlineSpanChildren(
127+
child: CssBoxWidget.withInlineSpanChildren(
128128
children: [context.parser.parseTree(context, child)],
129129
style: child.style, //TODO updated this. Does it work?
130130
),

0 commit comments

Comments
 (0)