tag_highlight_text 1.0.0
tag_highlight_text: ^1.0.0 copied to clipboard
This library will support highlight text by tags with specific styles and tap actions.
Tag Highlight Text Library #
This library will support highlight text by tags with specific styles and tap actions.
Usage #
To use this package, add tag_highlight_text as a dependency in your pubspec.yaml file.
Example #
Import the library
import 'package:tag_highlight_text/tag_highlight_text.dart';
You need use tags to mark highlight texts
final text = 'This is <highlight>Highlight <bold>Text</bold></highlight>';
After, call the TagHighlightText widget and define highlightMaps to set style and tap actions for each tags.
TagHighlightText(
text: text,
highlightMaps: {
'highlight': HighlightData(
style: TextStyle(
color: Colors.red,
),
),
'bold': HighlightData(
style: TextStyle(
fontWeight: FontWeight.bold,
),
onTap: () {
print('Click');
},
)
},
textStyle: TextStyle(
color: Colors.black,
fontSize: 18,
),
),