desconexo / highlight_text

A flutter plugin to highlight words from a text
MIT License
30 stars 22 forks source link

Background and backgroundColor does not work as expected #11

Closed cenkingunlugu closed 3 years ago

cenkingunlugu commented 3 years ago

Problematic Widget: HighlightedWord

If I use a text:

"I had some aggression then In the airport someone was there"

If I give a map of HighlightedWord with TextStyle including:

backgroundColor: Colors.red or background: Paint() ..strokeWidth = 10.0 ..color = Colors.red ..style = PaintingStyle.stroke ..strokeJoin = StrokeJoin.round

What I expect to see is the only the background of my keys should be red.

But my background starts from the first key, ends at the end of the text.

desconexo commented 3 years ago

Hi, I'm reworking this package but I couldn't fix this problem yet. I don't know why, but you need to revert this background in TextHighlight's textStyle.

Something like: TextHighlight( text: text, words: words, textStyle: TextStyle( fontSize: 20.0, color: Colors.black, background: Paint() ..strokeWidth = 0 ..color = Colors.transparent, ), textAlign: TextAlign.justify, ),