A sample of a text field with line numbers in Flutter
This sample shows off the following:
- creating line numbers on the fly via
ListView.builder
- re-calculating line number heights as text changes based on wrapping
- re-calculating line number heights when the
TextField
size changes - automatically showing scrollbars when there's a enough text to scroll
You can give it a try live online here.