Files
controle_acesso_educa/lib/widgets/input_text.dart
2023-08-08 09:35:23 -03:00

92 lines
2.8 KiB
Dart

import 'package:educa_controle_acesso/utils/colors.dart';
import 'package:educa_controle_acesso/widgets/text_custom.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class InputText extends StatelessWidget {
bool obscure;
var controller;
double fontSize;
String title;
String hint;
double width;
TextInputType textInputType;
int maxLines;
Color colorBorder;
Color colorBackground;
var onChanged;
bool enable;
List<TextInputFormatter> inputFormatters;
InputText({
required this.controller,
required this.width,
this.obscure = false,
this.fontSize = 15.0,
this.title = '',
this.hint = '',
this.textInputType = TextInputType.text,
this.maxLines = 1,
this.colorBorder = PaletteColors.grey,
this.colorBackground = PaletteColors.greyInput,
this.onChanged = null,
this.enable = true,
required this.inputFormatters
});
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextCustom(text: title,size: 10),
Container(
color:colorBackground,
width: width,
height: 35,
margin: EdgeInsets.only(bottom: 0),
child: TextFormField(
inputFormatters: inputFormatters,
keyboardType: textInputType,
maxLines: maxLines,
onChanged: onChanged,
obscureText: this.obscure,
controller: this.controller,
enabled: enable,
textAlignVertical: TextAlignVertical.bottom,
style: TextStyle(
color: Colors.black,
fontSize: this.fontSize,
fontFamily: 'Nunito'
),
decoration: InputDecoration(
// fillColor: PaletteColors.primaryColor,
// labelText: title,
border: OutlineInputBorder(
borderSide: BorderSide(width: 1,color: colorBorder)
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: colorBorder),
borderRadius: BorderRadius.circular(3),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: colorBorder),
borderRadius: BorderRadius.circular(3),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: colorBorder),
borderRadius: BorderRadius.circular(3),
),
hintText: hint,
hintStyle: TextStyle(
color: PaletteColors.grey,
fontSize: this.fontSize,
)
)
),
),
],
);
}
}