66 lines
1.5 KiB
Dart
66 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rkm/utils/color_palette.dart';
|
|
import '../utils/const_variable.dart';
|
|
|
|
class InputText extends StatelessWidget {
|
|
bool obscure;
|
|
var controller;
|
|
double fontSize;
|
|
String hint;
|
|
double width;
|
|
String label;
|
|
String error;
|
|
bool enable;
|
|
TextInputType textInputType;
|
|
int maxLines;
|
|
|
|
InputText({
|
|
required this.controller,
|
|
required this.width,
|
|
this.obscure = false,
|
|
this.fontSize = 15.0,
|
|
this.hint = '',
|
|
this.label = '',
|
|
this.error = '',
|
|
this.enable = true,
|
|
this.textInputType = TextInputType.text,
|
|
this.maxLines = 1,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
color: ColorPalette.white,
|
|
margin: ConstVariable().marginHightInput,
|
|
width: width,
|
|
child: TextFormField(
|
|
keyboardType: textInputType,
|
|
maxLines: maxLines,
|
|
validator: (value) {
|
|
if (value!=null && value!.length==0) {
|
|
return error;
|
|
}
|
|
return null;
|
|
},
|
|
obscureText: this.obscure,
|
|
controller: this.controller,
|
|
style: TextStyle(
|
|
color: ColorPalette.gray,
|
|
fontSize: this.fontSize,
|
|
),
|
|
decoration: InputDecoration(
|
|
fillColor: ColorPalette.appBar,
|
|
labelText: label,
|
|
border: OutlineInputBorder(),
|
|
hintText: this.hint,
|
|
enabled: enable,
|
|
hintStyle: TextStyle(
|
|
color: ColorPalette.gray,
|
|
fontSize: this.fontSize,
|
|
)
|
|
)
|
|
),
|
|
);
|
|
}
|
|
}
|