import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:rasadyar_auth/presentation/widget/clear_button.dart'; import 'package:rasadyar_core/core.dart'; import 'logic.dart'; class CaptchaWidget extends GetView { CaptchaWidget({super.key}); final CaptchaWidgetLogic logic = Get.put(CaptchaWidgetLogic()); @override Widget build(BuildContext context) { return Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 135, height: 48, clipBehavior: Clip.antiAliasWithSaveLayer, decoration: BoxDecoration( color: AppColor.whiteNormalHover, border: Border.all(color: Colors.grey.shade300), borderRadius: BorderRadius.circular(8), ), child: Expanded(child:controller.obx((state) { return Container(color: Colors.blue,); }, onLoading: const Center( child: CircularProgressIndicator( color: AppColor.blueNormal, strokeWidth: 2, ), ), )), ), const SizedBox(height: 20), IconButton( padding: EdgeInsets.zero, onPressed: controller.getCaptcha, icon: Icon(CupertinoIcons.refresh, size: 16), ), Expanded( child: Form( key: controller.formKey, autovalidateMode: AutovalidateMode.onUserInteraction, child: TextFormField( controller: controller.textController, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), gapPadding: 11, ), labelText: 'کد امنیتی', labelStyle: AppFonts.yekan13, errorStyle: AppFonts.yekan10.copyWith( color: AppColor.redNormal, fontSize: 8, ), suffixIconConstraints: BoxConstraints( maxHeight: 24, minHeight: 24, maxWidth: 24, minWidth: 24, ), suffix: controller.textController.text .trim() .isNotEmpty ? clearButton(() => controller.textController.clear()) : null, counterText: '', ), keyboardType: TextInputType.numberWithOptions( decimal: false, signed: false, ), maxLines: 1, maxLength: 6, onChanged: (value) {}, validator: (value) { if (value == null || value.isEmpty) { return 'کد امنیتی را وارد کنید'; } /*if (value != controller.captchaCode.toString()) { return '⚠️کد امنیتی وارد شده اشتباه است'; }*/ return null; }, style: AppFonts.yekan13, ), ), ), ], ); } }