formatEditUpdate method
Formats the text edit update by capitalizing the first character.
Parameters:
oldValue: The previous text editing valuenewValue: The new text editing value after user input
Returns a TextEditingValue with the first character capitalized.
If the new text is empty, returns the new value unchanged.
Implementation
@override
TextEditingValue formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) {
if (newValue.text.isEmpty) {
return newValue;
}
String text = newValue.text;
String capitalizedText = text[0].toUpperCase() + text.substring(1);
return newValue.copyWith(
text: capitalizedText,
selection: newValue.selection,
);
}