55 lines
1.4 KiB
Dart
55 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:prosappco/components/general_input_decoration.dart';
|
|
|
|
class MyTextField extends StatelessWidget {
|
|
final TextEditingController controller;
|
|
final String? labelText;
|
|
final String hintText;
|
|
final bool obscureText;
|
|
final TextInputType keyboardType;
|
|
final Widget? suffixIcon;
|
|
final VoidCallback? onTap;
|
|
final Widget? prefixIcon;
|
|
final String? Function(String?)? validator;
|
|
final FocusNode? focusNode;
|
|
final String? errorMsg;
|
|
final String? Function(String?)? onChanged;
|
|
|
|
const MyTextField(
|
|
{super.key,
|
|
this.labelText,
|
|
required this.controller,
|
|
required this.hintText,
|
|
required this.obscureText,
|
|
required this.keyboardType,
|
|
this.suffixIcon,
|
|
this.onTap,
|
|
this.prefixIcon,
|
|
this.validator,
|
|
this.focusNode,
|
|
this.errorMsg,
|
|
this.onChanged});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextFormField(
|
|
validator: validator,
|
|
controller: controller,
|
|
obscureText: obscureText,
|
|
keyboardType: keyboardType,
|
|
focusNode: focusNode,
|
|
onTap: onTap,
|
|
textInputAction: TextInputAction.next,
|
|
onChanged: onChanged,
|
|
decoration: GeneralInputDecoration.getCustomDecoration(
|
|
labelText: labelText,
|
|
context: context,
|
|
hintText: hintText,
|
|
prefixIcon: prefixIcon,
|
|
errorMsg: errorMsg,
|
|
suffixIcon: suffixIcon,
|
|
),
|
|
);
|
|
}
|
|
}
|