feat : unit_text_field

This commit is contained in:
2025-07-14 12:23:59 +03:30
parent 2feb2d9ee4
commit d2de07e5de

View File

@@ -8,7 +8,7 @@ class UnitTextField extends StatefulWidget {
super.key, super.key,
required this.hint, required this.hint,
required this.unit, required this.unit,
required this.onChanged, this.onChanged,
this.initialValue, this.initialValue,
this.controller, this.controller,
this.keyboardType, this.keyboardType,
@@ -20,6 +20,7 @@ class UnitTextField extends StatefulWidget {
this.textStyle, this.textStyle,
this.textColor, this.textColor,
this.inputFormatters, this.inputFormatters,
this.validator
}); });
final String hint; final String hint;
@@ -32,6 +33,7 @@ class UnitTextField extends StatefulWidget {
final TextInputType? keyboardType; final TextInputType? keyboardType;
final TextInputAction? textInputAction; final TextInputAction? textInputAction;
final List<TextInputFormatter>? inputFormatters; final List<TextInputFormatter>? inputFormatters;
final FormFieldValidator<String>? validator;
final bool? enabled; final bool? enabled;
final bool? readOnly; final bool? readOnly;
final int? maxLines; final int? maxLines;
@@ -81,7 +83,7 @@ class _UnitTextFieldState extends State<UnitTextField> {
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: TextField( child: TextFormField(
controller: tmpController, controller: tmpController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
textInputAction: widget.textInputAction, textInputAction: widget.textInputAction,
@@ -92,6 +94,7 @@ class _UnitTextFieldState extends State<UnitTextField> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
inputFormatters: widget.inputFormatters, inputFormatters: widget.inputFormatters,
validator: widget.validator,
style: AppFonts.yekan18.copyWith(color: AppColor.darkGreyNormalActive), style: AppFonts.yekan18.copyWith(color: AppColor.darkGreyNormalActive),
decoration: const InputDecoration( decoration: const InputDecoration(
isDense: true, isDense: true,