mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
@ -297,9 +297,8 @@ class MarkdownBuilder implements md.NodeVisitor {
|
|||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
} else if (tag == 'hr') {
|
} else if (tag == 'hr') {
|
||||||
child = DecoratedBox(
|
child = Container(
|
||||||
decoration: styleSheet.horizontalRuleDecoration,
|
decoration: styleSheet.horizontalRuleDecoration
|
||||||
child: child,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,11 +148,87 @@ void main() {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Horizontal Rule', (WidgetTester tester) async {
|
testWidgets('Horizontal Rule - 3 hyphen', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(_boilerplate(const MarkdownBody(data: '-----')));
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
_boilerplate(MarkdownBody(
|
||||||
|
data: '---'))
|
||||||
|
);
|
||||||
|
|
||||||
final Iterable<Widget> widgets = tester.allWidgets;
|
final Iterable<Widget> widgets = tester.allWidgets;
|
||||||
_expectWidgetTypes(widgets, <Type>[Directionality, MarkdownBody, DecoratedBox, SizedBox]);
|
_expectWidgetTypes(widgets, <Type>[
|
||||||
|
Directionality,
|
||||||
|
MarkdownBody,
|
||||||
|
Container,
|
||||||
|
DecoratedBox,
|
||||||
|
Padding,
|
||||||
|
LimitedBox,
|
||||||
|
ConstrainedBox
|
||||||
|
]);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('Horizontal Rule - 5 hyphen', (WidgetTester tester) async {
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
_boilerplate(MarkdownBody(
|
||||||
|
data: '-----'))
|
||||||
|
);
|
||||||
|
|
||||||
|
final Iterable<Widget> widgets = tester.allWidgets;
|
||||||
|
_expectWidgetTypes(widgets, <Type>[
|
||||||
|
Directionality,
|
||||||
|
MarkdownBody,
|
||||||
|
Container,
|
||||||
|
DecoratedBox,
|
||||||
|
Padding,
|
||||||
|
LimitedBox,
|
||||||
|
ConstrainedBox
|
||||||
|
]);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('Horizontal Rule - 3 asterisk', (WidgetTester tester) async {
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
_boilerplate(MarkdownBody(
|
||||||
|
data: '* * *'))
|
||||||
|
);
|
||||||
|
|
||||||
|
final Iterable<Widget> widgets = tester.allWidgets;
|
||||||
|
_expectWidgetTypes(widgets, <Type>[
|
||||||
|
Directionality,
|
||||||
|
MarkdownBody,
|
||||||
|
Container,
|
||||||
|
DecoratedBox,
|
||||||
|
Padding,
|
||||||
|
LimitedBox,
|
||||||
|
ConstrainedBox
|
||||||
|
]);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('Horizontal Rule * * * alongside text Markdown', (WidgetTester tester) async {
|
||||||
|
await tester.pumpWidget(_boilerplate(
|
||||||
|
MarkdownBody(data: '# h1\n ## h2\n* * *')));
|
||||||
|
final Iterable<Widget> widgets = tester.allWidgets;
|
||||||
|
_expectWidgetTypes(widgets, <Type>[
|
||||||
|
Directionality,
|
||||||
|
MarkdownBody,
|
||||||
|
Column,
|
||||||
|
Column,
|
||||||
|
Wrap,
|
||||||
|
RichText,
|
||||||
|
SizedBox,
|
||||||
|
Column,
|
||||||
|
Wrap,
|
||||||
|
RichText,
|
||||||
|
SizedBox,
|
||||||
|
Container,
|
||||||
|
DecoratedBox,
|
||||||
|
Padding,
|
||||||
|
LimitedBox,
|
||||||
|
ConstrainedBox]);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Scrollable wrapping', (WidgetTester tester) async {
|
testWidgets('Scrollable wrapping', (WidgetTester tester) async {
|
||||||
|
Reference in New Issue
Block a user