quiz redirecionado aos videos | redesing da notificação
This commit is contained in:
19
lib/widgets/name_input_formatter.dart
Normal file
19
lib/widgets/name_input_formatter.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
/// Capitaliza automaticamente a primeira letra à medida que o utilizador
|
||||
/// escreve — usado nos campos de nome (criança e conta) para não depender
|
||||
/// só da sugestão do teclado (que o utilizador pode ignorar ou que pode
|
||||
/// não existir em todos os teclados).
|
||||
class CapitalizeFirstLetterFormatter extends TextInputFormatter {
|
||||
@override
|
||||
TextEditingValue formatEditUpdate(
|
||||
TextEditingValue oldValue,
|
||||
TextEditingValue newValue,
|
||||
) {
|
||||
final text = newValue.text;
|
||||
if (text.isEmpty) return newValue;
|
||||
final capitalized = text[0].toUpperCase() + text.substring(1);
|
||||
if (capitalized == text) return newValue;
|
||||
return newValue.copyWith(text: capitalized, selection: newValue.selection);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user