m3_lightmeter/lib/screens/shared/text_field/widget_text_field.dart

34 lines
876 B
Dart
Raw Normal View History

2024-10-22 16:34:23 +00:00
import 'package:flutter/material.dart';
class LightmeterTextField extends TextFormField {
LightmeterTextField({
super.controller,
2024-10-31 14:13:06 +00:00
super.autofocus,
2024-10-22 16:34:23 +00:00
super.initialValue,
super.inputFormatters,
super.maxLength,
2024-10-22 16:34:23 +00:00
super.onChanged,
super.style,
super.textAlign,
Widget? leading,
String? hintText,
2024-10-22 16:34:23 +00:00
}) : super(
autovalidateMode: AutovalidateMode.onUserInteraction,
maxLines: 1,
decoration: InputDecoration(
counter: const SizedBox(),
2024-10-22 16:34:23 +00:00
contentPadding: EdgeInsets.zero,
errorStyle: const TextStyle(fontSize: 0),
icon: leading,
hintText: hintText,
2024-10-22 16:34:23 +00:00
),
validator: (value) {
if (value == null || value.isEmpty) {
return '';
} else {
return null;
}
},
);
}