Skip to content

Commit e323a19

Browse files
authored
Merge pull request flutter#10 from mit-mit/master
Make image links work
2 parents a47b4e9 + 2d13ae9 commit e323a19

4 files changed

Lines changed: 47 additions & 6 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## 0.1.0
2+
3+
* Roll the dependency on `markdown` to 1.0.0
4+
* Add a test and example for image links
5+
* Fix the `onTap` callback on hyperlinks
6+
7+
## 0.0.9
8+
9+
* First published version

packages/flutter_markdown/example/demo.dart

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import 'package:flutter/material.dart';
66
import 'package:flutter_markdown/flutter_markdown.dart';
77

8-
const String _kMarkdownData = """# Markdown Example
8+
const String _markdownData = """# Markdown Example
99
Markdown allows you to easily include formatted text, images, and even formatted Dart code in your app.
1010
1111
## Styling
@@ -18,11 +18,31 @@ Style text as _italic_, __bold__, or `inline code`.
1818
## Links
1919
You can use [hyperlinks](hyperlink) in markdown
2020
21-
## Code blocks
22-
Formatted Dart code looks really pretty too. This is an example of how to create your own Markdown widget:
21+
## Images
22+
23+
You can include images:
24+
25+
![Flutter logo](https://flutter.io/images/flutter-mark-square-100.png#100x100)
26+
27+
## Markdown widget
28+
29+
This is an example of how to create your own Markdown widget:
2330
2431
new Markdown(data: 'Hello _world_!');
2532
33+
## Code blocks
34+
Formatted Dart code looks really pretty too:
35+
36+
```
37+
void main() {
38+
runApp(new MaterialApp(
39+
home: new Scaffold(
40+
body: new Markdown(data: markdownData)
41+
)
42+
));
43+
}
44+
```
45+
2646
Enjoy!
2747
""";
2848

@@ -31,7 +51,7 @@ void main() {
3151
title: "Markdown Demo",
3252
home: new Scaffold(
3353
appBar: new AppBar(title: const Text('Markdown Demo')),
34-
body: const Markdown(data: _kMarkdownData)
54+
body: const Markdown(data: _markdownData)
3555
)
3656
));
3757
}

packages/flutter_markdown/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: flutter_markdown
22
author: Flutter Authors <flutter-dev@googlegroups.com>
33
description: A markdown renderer for Flutter.
44
homepage: https://github.com/flutter/flutter_markdown
5-
version: 0.0.10
5+
version: 0.1.0
66

77
dependencies:
88
flutter:
99
sdk: flutter
10-
markdown: ^0.11.0
10+
markdown: ^1.0.0
1111
meta: ^1.0.5
1212
string_scanner: ^1.0.0
1313

packages/flutter_markdown/test/flutter_markdown_test.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,18 @@ void main() {
163163
expect(tapResults, orderedEquals(['firstHref', 'secondHref']));
164164
});
165165
});
166+
167+
testWidgets('Image links', (WidgetTester tester) async {
168+
await tester
169+
.pumpWidget(_boilerplate(const Markdown(data: '![alt](img#50x50)')));
170+
171+
final Image image =
172+
tester.allWidgets.firstWhere((Widget widget) => widget is Image);
173+
final NetworkImage networkImage = image.image;
174+
expect(networkImage.url, 'img');
175+
expect(image.width, 50);
176+
expect(image.height, 50);
177+
});
166178

167179
testWidgets('HTML tag ignored ', (WidgetTester tester) async {
168180
final List<String> mdData = <String>[

0 commit comments

Comments
 (0)