|
| 1 | +import 'package:basic/classes/size_units_class.dart'; |
| 2 | +import 'package:basic/constants/color_constants.dart'; |
| 3 | +import 'package:basic/constants/textstyle_constants.dart'; |
| 4 | +import 'package:flutter/material.dart'; |
| 5 | + |
| 6 | +class TextFormFieldWidget extends StatelessWidget { |
| 7 | + final String Function(String?) validator; |
| 8 | + final String hintText; |
| 9 | + final Color hintTextColor; |
| 10 | + final TextInputType keyboardType; |
| 11 | + final int minLines; |
| 12 | + final int maxLines; |
| 13 | + final String initialValue; |
| 14 | + final TextEditingController controller; |
| 15 | + final FocusNode focusNode; |
| 16 | + const TextFormFieldWidget({ |
| 17 | + required this.controller, |
| 18 | + required this.initialValue, |
| 19 | + required this.focusNode, |
| 20 | + required this.hintText, |
| 21 | + required this.hintTextColor, |
| 22 | + required this.keyboardType, |
| 23 | + required this.maxLines, |
| 24 | + required this.minLines, |
| 25 | + required this.validator, |
| 26 | + Key? key, |
| 27 | + }) : super(key: key); |
| 28 | + |
| 29 | + @override |
| 30 | + Widget build(BuildContext context) { |
| 31 | + return Container( |
| 32 | + padding: EdgeInsets.symmetric( |
| 33 | + vertical: SizeUnitsClass.big, |
| 34 | + horizontal: SizeUnitsClass.big, |
| 35 | + ), |
| 36 | + decoration: BoxDecoration( |
| 37 | + color: whiteColor, |
| 38 | + borderRadius: BorderRadius.all( |
| 39 | + Radius.circular(SizeUnitsClass.big), |
| 40 | + ), |
| 41 | + ), |
| 42 | + child: TextFormField( |
| 43 | + controller: controller, |
| 44 | + focusNode: focusNode, |
| 45 | + keyboardType: keyboardType, |
| 46 | + validator: validator, |
| 47 | + minLines: minLines, |
| 48 | + maxLines: maxLines, |
| 49 | + initialValue: initialValue, |
| 50 | + decoration: InputDecoration( |
| 51 | + hintText: hintText, |
| 52 | + hintStyle: bodyTextStyle.merge(TextStyle(color: hintTextColor)), |
| 53 | + contentPadding: EdgeInsets.symmetric(vertical: SizeUnitsClass.medium), |
| 54 | + enabledBorder: InputBorder.none, |
| 55 | + ), |
| 56 | + ), |
| 57 | + ); |
| 58 | + } |
| 59 | +} |
0 commit comments