Skip to content

Commit 196d3bd

Browse files
committed
подсветка кода: парсинг и рендеринг с помощью изолята
from: git-touch/highlight.dart#35
1 parent 7edd480 commit 196d3bd

File tree

5 files changed

+496
-150
lines changed

5 files changed

+496
-150
lines changed

lib/presentation/widget/html_view_widget.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,15 @@ abstract class CustomBuildOp {
379379
constraints: BoxConstraints(
380380
minWidth: MediaQuery.of(context).size.width,
381381
),
382-
child: HighlightView(
383-
text,
384-
language: lang,
385-
tabSize: 4,
386-
textStyle: codeTextStyle,
387-
theme: codeTheme,
388-
padding: padding,
382+
child: HighlightBackgroundEnvironment(
383+
child: HighlightView(
384+
text,
385+
language: lang,
386+
tabSize: 4,
387+
textStyle: codeTextStyle,
388+
theme: codeTheme,
389+
padding: padding,
390+
),
389391
),
390392
);
391393
}

packages/flutter_highlight/CHANGELOG.md

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

packages/flutter_highlight/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ class MyWidget extends StatelessWidget {
4444
}
4545
```
4646

47+
### Background processing
48+
49+
Processing large amounts of text can be slow. To perform text processing in the background, add a
50+
`HighlightBackgroundEnvironment` above any `HighlightView`s in your widget tree.
51+
52+
A background isolate will be automatically started in `HighlightBackgroundEnvironment.initState`, and stopped in
53+
`HighlightBackgroundEnvironment.dispose`.
54+
4755
## References
4856

4957
- [All available languages](https://github.com/pd4d10/highlight/tree/master/highlight/lib/languages)
@@ -52,3 +60,12 @@ class MyWidget extends StatelessWidget {
5260
## License
5361

5462
MIT
63+
64+
65+
## Credits
66+
67+
Original author
68+
- [pd4d10](https://github.com/pd4d10)
69+
70+
For improvements (background processing)
71+
- [hacker1024](https://github.com/hacker1024)

0 commit comments

Comments
 (0)