Skip to content

A demo to demonstrate highlight on Flutter [Update Flutter Version to 3.3.4]

Notifications You must be signed in to change notification settings

gcoderbh/highlight_text_demo

 
 

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 [Update Flutter Version to 3.3.4]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 68.4%
  • C++ 15.0%
  • CMake 13.4%
  • HTML 1.3%
  • C 1.0%
  • Swift 0.8%
  • Other 0.1%