onLineCountChanged property
Called when the number of rendered text lines changes.
The callback receives the current line count after layout. This is
the rendered line count (accounting for text wrapping), not the
number of \n characters in the text.
Fires on initial build and on every subsequent change. Does NOT fire when the line count stays the same.
Useful for animating the surrounding container’s height or shape
(e.g. reducing borderRadius as lines increase):
GlassTextField(
maxLines: 6,
onLineCountChanged: (lines) {
setState(() => _lines = lines);
},
)
Implementation
final ValueChanged<int>? onLineCountChanged;