passo_mobile_app/lib/utils/formatters.dart

25 lines
786 B
Dart
Raw Permalink Normal View History

2023-06-06 06:54:51 +00:00
import 'package:flutter/services.dart';
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
var mobileFormatter = MaskTextInputFormatter(
mask: "+63 (###) ###-####",
filter: {"#": RegExp(r'^[0-9][0-9]*$')
},
type: MaskAutoCompletionType.lazy,
initialText: "0");
var landLineFormatter = MaskTextInputFormatter(
mask: "(###) ###-###",
filter: {"#": RegExp(r"^[0-9]")},
type: MaskAutoCompletionType.lazy,
2023-06-06 06:54:51 +00:00
initialText: "0");
class UpperCaseTextFormatter extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
return TextEditingValue(
text: newValue.text.toUpperCase(),
selection: newValue.selection,
);
}
}