Skip to content

renntbenrennt/highlight_text_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter highlight text demo

This demo is based on @Jaime's selection example with my modification on his rendering text logic.

Demo:

highlight_text_demo

I know there might be a better way to achieve such feature considering mine's operate the text on a character level...

and convert each single character into TextSpan, which might cause space waste? I guess?

But in my investigation, I found that Flutter engine is actually turning all the TextSpan into the String text of the EditableText on rendering...

So... that space waste might not actually happen?

I need to dig deeper into the source code...

So far, there's two known issues I think it's due to the fact that the Flutter still has room to improve

  1. TextSelection is inaccurate(baseOffset and extentOffset) when there's emoji involved
  2. Selection background's height will be inconsistent between Chinese and English, which I have opened an issue for that, I hope I will have the energy to open PR for it, I'm so depressed by my life right now😢...

About

A demo to demonstrate highlight on Flutter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages