diff --git a/lib/src/app/auth/screens/codigoverifica.dart b/lib/src/app/auth/screens/codigoverifica.dart index 1e89152..e39e174 100644 --- a/lib/src/app/auth/screens/codigoverifica.dart +++ b/lib/src/app/auth/screens/codigoverifica.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; import 'package:recomendagro/assets/theme/colors.dart'; import 'package:recomendagro/src/shared/utils/responsive/responsive_metrics.dart'; import 'package:recomendagro/src/shared/widgets/buttons/simple_button.dart'; +import 'package:recomendagro/src/shared/widgets/inputs/code_input.dart'; import '../../../shared/widgets/inputs/simple_input.dart'; class CodigoVerificacaoScreen extends ConsumerStatefulWidget { @@ -84,17 +86,34 @@ class _CodigoVerificacaoScreenState extends ConsumerState? onCompleted; + const CodeInputController({super.key, this.onCompleted, required this.controller}); + + @override + State createState() => _CodeInputControllerState(); +} + +class _CodeInputControllerState extends State { + + @override + Widget build(BuildContext context) { + final focusedBorderColor = Theme.of(context).primaryColor; + final defaultPinTheme = PinTheme( + width: 56, + height: 56, + textStyle: TextStyle( + fontSize: 22, + color: AppColorLight.text01Color, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(50), + border: Border.all(width: 2, color: AppColorLight.text04Color), + ), + ); + + + return SizedBox( + child: Directionality( + textDirection: TextDirection.ltr, + child: Pinput( + controller: widget.controller, + keyboardType: TextInputType.none, + length: 5, + androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsUserConsentApi, + listenForMultipleSmsOnAndroid: true, + defaultPinTheme: defaultPinTheme, + onClipboardFound: (value) { + widget.controller.setText(value); + }, + hapticFeedbackType: HapticFeedbackType.lightImpact, + onCompleted: widget.onCompleted, + cursor: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + margin: const EdgeInsets.only(bottom: 9), + width: 22, + height: 1, + color: focusedBorderColor, + ) + ] + ), + focusedPinTheme: defaultPinTheme.copyWith( + decoration: defaultPinTheme.decoration!.copyWith( + border: Border.all(color: focusedBorderColor), + ), + ), + submittedPinTheme: defaultPinTheme.copyWith( + decoration: defaultPinTheme.decoration!.copyWith( + // color: fillColor, + border: Border.all(color: focusedBorderColor), + ), + ), + errorPinTheme: defaultPinTheme.copyBorderWith( + border: Border.all(color: Colors.redAccent), + ) + ) + ) + ); + } +} \ No newline at end of file diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index e71a16d..13ceb2a 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) smart_auth_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "SmartAuthPlugin"); + smart_auth_plugin_register_with_registrar(smart_auth_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2e1de87..9cadb0a 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + smart_auth ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 89c03e6..8555cb4 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,11 +8,13 @@ import Foundation import device_info_plus import flutter_image_compress_macos import path_provider_foundation +import smart_auth import sqflite func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SmartAuthPlugin.register(with: registry.registrar(forPlugin: "SmartAuthPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 839e665..42e5a7e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -431,6 +431,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.1" + pinput: + dependency: "direct main" + description: + name: pinput + sha256: a92b55ecf9c25d1b9e100af45905385d5bc34fc9b6b04177a9e82cb88fe4d805 + url: "https://pub.dev" + source: hosted + version: "3.0.1" platform: dependency: transitive description: @@ -485,6 +493,14 @@ packages: description: flutter source: sdk version: "0.0.99" + smart_auth: + dependency: transitive + description: + name: smart_auth + sha256: a25229b38c02f733d0a4e98d941b42bed91a976cb589e934895e60ccfa674cf6 + url: "https://pub.dev" + source: hosted + version: "1.1.1" source_span: dependency: transitive description: @@ -597,6 +613,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.2" + universal_platform: + dependency: transitive + description: + name: universal_platform + sha256: d315be0f6641898b280ffa34e2ddb14f3d12b1a37882557869646e0cc363d0cc + url: "https://pub.dev" + source: hosted + version: "1.0.0+1" uuid: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 899c215..592f8a9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,6 +22,7 @@ dependencies: flutter_dotenv: ^5.0.2 cupertino_icons: ^1.0.2 flutter_riverpod: ^2.4.9 + pinput: ^3.0.1 bestapp_package: git: url: https://steeve:d442ff0fd7fca09c078f858362b2231b0123d708@repo.besoft.com.br/BeSoft/bestapp_package.git @@ -31,7 +32,7 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.0 - + flutter: uses-material-design: true assets: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..1e90c87 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + SmartAuthPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SmartAuthPlugin")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..ffb020c 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + smart_auth ) list(APPEND FLUTTER_FFI_PLUGIN_LIST