|
|
|
|
@ -36,6 +36,7 @@ class TxtField extends StatelessWidget {
|
|
|
|
|
Widget? postfixWidget;
|
|
|
|
|
Widget? preFixWidget;
|
|
|
|
|
bool numbersOnly;
|
|
|
|
|
bool allowOnlyOneDigit;
|
|
|
|
|
|
|
|
|
|
TxtField({
|
|
|
|
|
Key? key,
|
|
|
|
|
@ -65,6 +66,7 @@ class TxtField extends StatelessWidget {
|
|
|
|
|
this.preFixWidget,
|
|
|
|
|
this.onPostFixPressed,
|
|
|
|
|
this.numbersOnly = false,
|
|
|
|
|
this.allowOnlyOneDigit = false,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -101,7 +103,11 @@ class TxtField extends StatelessWidget {
|
|
|
|
|
obscureText: isPasswordEnabled ?? false,
|
|
|
|
|
onChanged: onChanged,
|
|
|
|
|
onSubmitted: onSubmitted,
|
|
|
|
|
inputFormatters: numbersOnly ? <TextInputFormatter>[FilteringTextInputFormatter.allow(RegExp('[0-9]'))] : [],
|
|
|
|
|
inputFormatters: allowOnlyOneDigit && numbersOnly
|
|
|
|
|
? <TextInputFormatter>[FilteringTextInputFormatter.allow(RegExp('[0-9]')), LengthLimitingTextInputFormatter(1)]
|
|
|
|
|
: numbersOnly
|
|
|
|
|
? <TextInputFormatter>[FilteringTextInputFormatter.allow(RegExp('[0-9]'))]
|
|
|
|
|
: [],
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
labelText: lable,
|
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
|
|