diff --git a/CHANGELOG.md b/CHANGELOG.md index 41cc7d8..b921a46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ ## 0.0.1 -* TODO: Describe initial release. +* Initial release with basic features diff --git a/README.md b/README.md index 4d5e766..4ac580b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ✨ rich_editor -[![pub package](https://img.shields.io/pub/v/badge.svg)](https://pub.dartlang.org/packages/rich_editor) +[![pub package](https://img.shields.io/pub/v/rich_editor.svg)](https://pub.dartlang.org/packages/rich_editor) [![pub points](https://badges.bar/rich_editor/pub%20points)](https://pub.dev/packages/rich_editor/score) WYSIWYG editor for Android and JavaFX with a rich set of supported formatting options. @@ -25,8 +25,24 @@ Based on https://github.com/dankito/RichTextEditor, but for Flutter. - [ ] Search ## 📸 Screenshots + + - +## Usage +```dart + RichEditor( + key: keyEditor, + value: 'initial html here', + // You can return a Link (maybe you need to upload the image to your + // storage before displaying in the editor or you can also use base64 + getImageUrl: (image) { + String link = 'https://avatars.githubusercontent.com/u/24323581?v=4'; + String base64 = base64Encode(image.readAsBytesSync()); + String base64String = 'data:image/png;base64, $base64'; + return base64String; + }, + ) +``` ## License diff --git a/example/lib/main.dart b/example/lib/main.dart index 3e7d066..6985a23 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -86,7 +86,14 @@ class _MyHomePageState extends State { ), body: RichEditor( key: keyEditor, - value: '

init html val

', + value: ''' +

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
Heading 6
+ ''', // You can return a Link (maybe you need to upload the image to your // storage before displaying in the editor or you can also use base64 getImageUrl: (image) { diff --git a/lib/src/utils/font_list_parser.dart b/lib/src/utils/font_list_parser.dart index fa83f2d..df61e74 100644 --- a/lib/src/utils/font_list_parser.dart +++ b/lib/src/utils/font_list_parser.dart @@ -38,11 +38,13 @@ class FontListParser { break; } } - SystemFont systemFont = new SystemFont(family.name!, font.t ?? ''); - if (fonts.contains(systemFont)) { - continue; + if( font.t != null) { + SystemFont systemFont = new SystemFont(family.name!, font.t!); + if (fonts.contains(systemFont)) { + continue; + } + fonts.add(new SystemFont(family.name!, font.t!)); } - fonts.add(new SystemFont(family.name!, font.t ?? '')); } } diff --git a/res/1.png b/res/1.png new file mode 100644 index 0000000..a1a4f4c Binary files /dev/null and b/res/1.png differ diff --git a/res/2.png b/res/2.png new file mode 100644 index 0000000..a72873d Binary files /dev/null and b/res/2.png differ