Fixed warranty years

aamir_dev
Faiz Hashmi 1 year ago
parent ee4e7a7c2b
commit 283c0e9d5a

@ -227,6 +227,8 @@ class VehicleDetails extends StatelessWidget {
errorValue: adVM.warrantyError,
keyboardType: TextInputType.number,
hint: LocaleKeys.warrantyAvailableYears.tr(),
numbersOnly: true,
allowOnlyOneDigit: true,
onChanged: (v) => adVM.updateVehicleWarrantyDuration(v),
),
8.height,

@ -284,8 +284,6 @@ class _AdsDetailViewState extends State<AdsDetailView> {
@override
Widget build(BuildContext context) {
log("widget.adDetails: ${widget.adDetails.phoneNo}");
log("widget.adDetails: ${widget.adDetails.whatsAppNo}");
Widget actionWidget = const SizedBox();
if ((widget.adDetails.isMyAd ?? false) && (widget.adDetails.adPostStatus != AdPostStatus.reserved) && (widget.adDetails.adPostStatus != AdPostStatus.active) && (widget.adDetails.adPostStatus != AdPostStatus.pendingForPost)) {
actionWidget = IconButton(

@ -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,

Loading…
Cancel
Save