ajustes de inputs com apenas numeros, mascaras, textos

This commit is contained in:
Reginaldo
2024-02-09 16:14:44 -03:00
parent a94bff8ebd
commit 8cf5569840
10 changed files with 176 additions and 79 deletions

View File

@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rkm/widgets/title_input.dart';
import '../config/color_palette.dart';
import '../controllers/format_txt.dart';
import 'error_default.dart';
import 'input_text.dart';
@@ -20,6 +22,8 @@ class InputWithSubtitle extends StatelessWidget {
int maxLines;
Color colorBorder;
String typeInput;
int maxLength;
List<TextInputFormatter> inputFormatters;
InputWithSubtitle({
required this.subtitle,
@@ -36,8 +40,10 @@ class InputWithSubtitle extends StatelessWidget {
this.maxLines = 1,
this.colorBorder = ColorPalette.white,
required this.onChanged,
this.widthError = 0.7
});
this.widthError = 0.7,
this.maxLength = 200,
List<TextInputFormatter>? inputFormatters, // Alteração aqui
}) : inputFormatters = inputFormatters ?? [FormatText()];
@override
Widget build(BuildContext context) {
@@ -57,6 +63,8 @@ class InputWithSubtitle extends StatelessWidget {
maxLines:maxLines,
colorBorder: colorBorder,
onChanged: onChanged,
maxLength: maxLength,
inputFormatters: inputFormatters,
),
typeInput=='normal'&&(enabled&&mandatory) && (labelInput=='Nome' && splited.length<=1) ?ErrorDefault(widthDefault: widthError,error: errorInput,):Container(),
typeInput!='normal'&&(enabled&&mandatory)&& errorInput!=''?ErrorDefault(widthDefault: widthError,error: errorInput,):Container(),