Files
rkmmobile/lib/widgets/input_text.dart

81 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rkm/config/color_palette.dart';
import '../controllers/format_txt.dart';
class InputText extends StatelessWidget {
bool obscure;
var controller;
double fontSize;
String hint;
double width;
String label;
bool enable;
TextInputType textInputType;
int maxLines;
Color colorBorder;
var onChanged;
InputText({
required this.controller,
required this.width,
this.obscure = false,
this.fontSize = 15.0,
this.hint = '',
this.label = '',
this.enable = true,
this.textInputType = TextInputType.text,
this.maxLines = 1,
this.colorBorder = ColorPalette.black54,
this.onChanged = null,
});
@override
Widget build(BuildContext context) {
return Container(
color: ColorPalette.white,
margin: EdgeInsets.only(top: 5),
width: width,
child: TextFormField(
keyboardType: textInputType,
maxLines: maxLines,
onChanged: onChanged,
inputFormatters: [
FormatText()
],
obscureText: this.obscure,
controller: this.controller,
style: TextStyle(
color: Colors.black,
fontSize: this.fontSize,
),
decoration: InputDecoration(
fillColor: ColorPalette.appBar,
labelText: label,
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: this.hint,
enabled: enable,
hintStyle: TextStyle(
color: ColorPalette.gray,
fontSize: this.fontSize,
)
)
),
);
}
}