17 lines
454 B
Dart
17 lines
454 B
Dart
import 'package:flutter/services.dart';
|
|
|
|
class NoSpaceFormatter extends TextInputFormatter {
|
|
@override
|
|
TextEditingValue formatEditUpdate(
|
|
TextEditingValue oldValue, TextEditingValue newValue) {
|
|
// Filter out spaces from the input
|
|
String newText = newValue.text.replaceAll(' ', '');
|
|
|
|
// Return the new formatted value without spaces
|
|
return TextEditingValue(
|
|
text: newText,
|
|
selection: newValue.selection,
|
|
);
|
|
}
|
|
}
|