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