feat: app text form field done
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class AppTextFormField extends StatelessWidget {
|
||||
AppTextFormField({
|
||||
super.key,
|
||||
this.maxLines,
|
||||
this.minLines,
|
||||
this.textStyle,
|
||||
this.onTap,
|
||||
this.textAlign,
|
||||
this.onChanged,
|
||||
this.inputFormatters,
|
||||
this.keyBoardType,
|
||||
this.fillColor,
|
||||
this.hintText,
|
||||
this.hintTextStyle,
|
||||
this.obscureText = false,
|
||||
required this.controller,
|
||||
this.prefixIcon,
|
||||
this.prefixSvgPath,
|
||||
});
|
||||
|
||||
final int? maxLines;
|
||||
final int? minLines;
|
||||
final TextStyle? textStyle;
|
||||
final VoidCallback? onTap;
|
||||
final TextAlign? textAlign;
|
||||
final TextEditingController controller;
|
||||
final Function(String? value)? onChanged;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final TextInputType? keyBoardType;
|
||||
FormFieldValidator<String>? validator;
|
||||
final bool obscureText;
|
||||
final Color? fillColor;
|
||||
final String? hintText;
|
||||
final TextStyle? hintTextStyle;
|
||||
late final Widget? prefixIcon;
|
||||
final String? prefixSvgPath;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
enabled: true,
|
||||
autofocus: true,
|
||||
maxLines: maxLines ?? 1,
|
||||
minLines: minLines ?? 1,
|
||||
onChanged: onChanged,
|
||||
inputFormatters: inputFormatters,
|
||||
keyboardType: keyBoardType,
|
||||
style: textStyle ?? AppTextStyles.size16Regular,
|
||||
onTap: onTap,
|
||||
textAlign: textAlign ?? TextAlign.start,
|
||||
controller: controller,
|
||||
validator: validator,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
decoration: InputDecoration(
|
||||
enabled: true,
|
||||
filled: true,
|
||||
fillColor: fillColor ?? AppColors.cEEEEEE,
|
||||
hintText: hintText,
|
||||
hintStyle: hintTextStyle,
|
||||
prefixIconConstraints: BoxConstraints(
|
||||
minHeight: 0,
|
||||
maxHeight: 24,
|
||||
maxWidth: 34,
|
||||
minWidth: 0,
|
||||
),
|
||||
prefixIcon: prefixIcon?.paddingOnly(left: 10).paddingAll(3),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user