flutter_otp_kit 3.1.1 copy "flutter_otp_kit: ^3.1.1" to clipboard
flutter_otp_kit: ^3.1.1 copied to clipboard

A comprehensive Flutter OTP verification package with SMS autofill, biometric support, performance monitoring, and extensive customization options.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

3.1.1 - 2025-10-18 #

πŸ› Critical Bug Fixes

  • FIXED: Error widget now properly displays when onVerify returns false
  • FIXED: Custom buttonWidget now correctly triggers onVerify callback instead of bypassing verification
  • FIXED: OTP fields now properly clear after failed verification attempts when clearFieldsOnError is enabled
  • FIXED: Async onVerify operations are now properly handled with correct state management
  • IMPROVED: Enhanced error state management to ensure proper UI feedback
  • IMPROVED: Better field state handling during verification failures

πŸš€ Major New Features

  • ADDED: Complete state management integration with external state parameters
  • ADDED: Real-time field value updates - no more waiting for delete + type to see changes
  • ADDED: Package-managed validation and error states with external synchronization
  • ADDED: Enhanced button styling with full control over border radius, padding, and borders
  • ADDED: External error text and state management for seamless Cubit/BLoC integration
  • ADDED: Comprehensive state management example with live state controls

🎨 Enhanced Customization

  • ADDED: buttonBorderRadius parameter for complete button styling control
  • ADDED: buttonPadding and buttonBorderSide for advanced button customization
  • ADDED: externalErrorText, externalErrorState, externalLoadingState for state management
  • ADDED: onExternalStateChange callback for bidirectional state synchronization
  • IMPROVED: Custom widgets now maintain full functionality without performance impact

πŸ§ͺ Testing & Validation

  • ADDED: Comprehensive bug fix test page demonstrating all critical fixes
  • ADDED: State management integration example with live controls
  • ADDED: Test cases for error widget display, custom button verification, field clearing, and async handling
  • ADDED: Real-time state monitoring and external state control examples
  • VALIDATED: All reported critical issues from v3.1.0 have been resolved

πŸ“‹ Issues Resolved

  • Resolves issue where error widgets were not displayed on verification failure
  • Resolves issue where custom buttons completely bypassed verification logic
  • Resolves issue where OTP fields retained old values after failed verification
  • Resolves issue where async verification operations had incorrect state handling
  • Resolves issue where field values didn't update in real-time
  • Resolves issue where external state management integration was incomplete

πŸ“š Documentation & Examples

  • ADDED: Complete Cubit integration guide with step-by-step migration
  • ADDED: State management best practices and integration patterns
  • ADDED: Comprehensive examples showing all use cases and configurations
  • ADDED: Real-time callback examples and state synchronization patterns

3.1.0 - 2025-10-18 #

πŸ—‘οΈ Complete Removal of Deprecated Widget

  • BREAKING CHANGE: Completely removed deprecated OtpVerificationWidget
  • Migration Required: All users must migrate to OtpKit widget
  • Cleaner API: Simplified package API by removing deprecated code
  • Reduced Package Size: Smaller package size due to removed deprecated code

βœ… Fixed Custom Widget Functionality

  • Custom Widget Support: Fixed buttonWidget and resendWidget parameters to properly override default UI
  • Complete Replacement: Custom widgets now fully replace default buttons instead of being ignored
  • All Custom Widgets: Support for buttonWidget, resendWidget, timerWidget, titleWidget, and subtitleWidget
  • Backward Compatibility: Existing code continues to work with default widgets when custom widgets not provided

3.0.4 - 2025-10-13 #

  • βœ… WASM Compatibility Fully Fixed - Completely resolved dart:io import issues with proper conditional imports
  • βœ… Platform Abstraction - Created proper platform checker abstraction for WASM compatibility
  • βœ… Zero WASM Issues - Package now fully compatible with WebAssembly runtime

3.0.3 - 2025-10-11 #

  • βœ… Logo Display Fixed - Logo now displays properly on pub.flutter-io.cn using GitHub raw URL
  • βœ… Visual Consistency - All images now use consistent GitHub raw URLs for pub.flutter-io.cn compatibility

3.0.2 - 2025-10-11 #

  • βœ… Complete Demo Showcase - Now displaying all 6 demo GIFs in beautiful 2-row table layout
  • βœ… Enhanced Documentation - Added comprehensive CONTRIBUTING.md guide for contributors
  • βœ… Complete API Reference - Added detailed parameter tables for all configuration classes
  • βœ… Professional Presentation - World-class documentation with Flutter-focused examples
  • βœ… No HTML Code Blocks - Eliminated confusing HTML styling examples, pure Flutter code only

3.0.1 - 2025-10-10 #

  • βœ… WASM Compatibility Fixed - Resolved dart:io import issues for WebAssembly compatibility
  • βœ… Platform Utils Added - New PlatformUtils class for cross-platform compatibility
  • βœ… Conditional Imports - Proper conditional imports for web/WASM environments
  • βœ… Static Analysis Improved - Fixed platform detection issues across all service files
  • βœ… Fixed GIF display on pub.flutter-io.cn - Updated demo URLs to use GitHub raw links
  • βœ… Improved documentation - Enhanced README with better formatting and structure
  • βœ… Better demo presentation - Clean table layout for showcasing features
  • βœ… Enhanced accessibility - Improved alt text and descriptions for demo images

3.0.0 - 2025-10-10 #

πŸš€ MAJOR RELEASE: Complete Rewrite with Modern Architecture #

πŸ”§ Animation System Overhaul (Latest Updates) #

🎯 Performance-First Defaults

  • BREAKING CHANGE: All animations now disabled by default (enableAnimation: false)
  • Zero Animation Overhead: Default configuration provides maximum performance
  • Instant State Changes: Fields change state immediately without transitions
  • Clean Static UI: Only colors change, no size/shape transformations

πŸ› Critical Animation Fixes

  • Fixed Scaling Bug: Filled fields no longer appear scaled when animations disabled
  • Conditional Transform Logic: Transform.scale, Transform.rotate, Transform.translate only apply when animations enabled
  • Proper Animation Checks: All animation effects now respect enableFieldStateAnimation setting
  • No Visual Artifacts: Eliminated unwanted scaling/rotation effects in static mode

🎨 Enhanced Animation Control

  • Explicit Animation Enabling: Developers must explicitly enable animations when needed
  • Granular Control: Separate controls for main widget, field state, cursor, and decoration animations
  • Performance Transparency: Clear documentation of performance implications
  • Backward Compatibility: Existing code continues to work, but with performance improvements

🎯 New Main Widget: OtpKit

  • Brand New Widget: Completely rewritten OtpKit widget from scratch
  • Deprecated OtpVerificationWidget: Marked as deprecated, use OtpKit for new projects
  • Unified Control: All features controllable from single main widget
  • Modern Architecture: Clean separation of concerns, advanced state management
  • Zero Breaking Changes: Existing OtpVerificationWidget continues to work

πŸ”₯ Smart Auth Integration (SMS Autofill)

  • Complete SMS Service: OtpSmsService with platform-specific implementations
  • SMS Retriever API: Android SMS Retriever API support with app signature
  • SMS User Consent API: Android SMS User Consent API support
  • iOS Native SMS: iOS native SMS autofill integration
  • Advanced Validation: Regex-based SMS validation with custom patterns
  • Error Handling: Comprehensive SMS error handling and timeout management
  • Cross-Platform SMS: Full SMS autofill support across platforms

⚑ Performance Monitoring System

  • Real-time Metrics: OtpPerformanceMonitor for live performance tracking
  • Memory Monitoring: Memory usage tracking and optimization recommendations
  • Animation Performance: FPS tracking for smooth animations
  • Performance Recommendations: Automatic optimization suggestions
  • Background Cleanup: Memory management with configurable cleanup intervals
  • Animation Pooling: Resource optimization for better performance
  • Lazy Loading: Support for large field counts with lazy loading

πŸ”’ Biometric Integration

  • Cross-Platform Biometrics: OtpBiometricService for all platforms
  • iOS Face ID & Touch ID: Complete iOS biometric integration
  • Android Fingerprint: Android fingerprint and face recognition support
  • Biometric Events: Comprehensive event handling and callbacks
  • Security Timeouts: Configurable biometric authentication timeouts
  • Fallback Options: Graceful fallback when biometrics unavailable

🎬 Advanced Animation & Cursor System

  • 🎯 Default: NO ANIMATIONS: All animations disabled by default for maximum performance
    • enableAnimation: false - No main widget animations (fade/scale/slide)
    • enableFieldStateAnimation: false - No field state transitions
    • enableCursorAnimation: false - No cursor blinking/animations
    • enableDecorationAnimation: false - No decoration transitions
    • Performance First: Instant state changes, zero animation overhead
  • 🎨 Opt-in Animations: Explicitly enable animations when needed
    • Field Fill Animations: Scale, rotate, slide (4 directions) for field completion
    • Error Animations: Shake, bounce, rotate, pulse, wiggle, slide variations
    • Cursor Animations: Blink/opacity and focus-scale effects
    • Main Widget Animations: Fade, scale, slide transitions
  • Cursor System (New!): Pluggable caret styles with animation
    • Styles: system, none, bar, block, underline, outline, doubleBar, dashedUnderline, beamCap, beamNotch, wedge, ring, strikethrough, doubleUnderline, gradientBar, glowBar
    • Centered alignment and refined placement for underline variants
    • Visibility fixes for small fields (dynamic min sizes where needed)
  • Animation Configuration: Complete control over all animation parameters
    • Main-level Animation Overrides: OtpKit now exposes top-level animation overrides for fill, error, and cursor that take precedence over OtpFieldConfig
    • One Style Per Case: Exactly one animation style applies per case (fill OR error), simplifying predictability and customization
    • Conditional Animation Logic: Animations only apply when explicitly enabled

🌍 Platform-Specific Features

  • iOS Optimizations: Face ID, Touch ID, iOS-specific animations, VoiceOver
  • Android Optimizations: Fingerprint, SMS APIs, TalkBack support
  • Web Optimizations: Keyboard handling, screen reader support, responsive design
  • Desktop Optimizations: Platform-specific layouts, keyboard navigation
  • Platform Service: OtpPlatformService for platform-specific features
  • Haptic Feedback: Platform-appropriate haptic feedback

πŸ›‘οΈ Enterprise Security Features

  • Rate Limiting: Configurable attempt limits per minute/hour
  • Advanced Validation: Checksum validation and custom patterns
  • Audit Logging: Security event tracking and monitoring
  • Anti-Tampering: Security measures against tampering
  • Session Management: Configurable session timeouts
  • Encryption Support: Optional encryption for secure operations

πŸ“š Comprehensive Documentation

  • Complete README: Comprehensive documentation with examples
  • Service Documentation: Detailed guides for all new services
  • Migration Guides: Easy migration from Pinput and Smart Auth
  • Troubleshooting: Common issues and solutions
  • Platform Guides: Platform-specific implementation guides

🎨 Enhanced Examples

  • 8 Example Tabs: Basic, Modern, Rounded, Underlined, Animated, Custom, Advanced, Cursors
  • Cursors Tab: Demonstrates every caret style, including global override and "no cursor"
  • Enterprise Example: Complete enterprise-level configuration showcase
  • All Features Demonstrated: Every new feature showcased with examples
  • Contact Info Masking: Phone and email masking examples
  • Validation Examples: Success and failure scenario demonstrations

πŸ”§ New Configuration Classes

  • OtpSmsConfig: Complete SMS autofill configuration
  • OtpPerformanceConfig: Performance monitoring and optimization settings
  • OtpSecurityConfig: Security and biometric configuration
  • Enhanced OtpAnimationConfig: Extended with cursor and decoration animations
  • Enhanced OtpErrorConfig: Advanced error handling configuration

πŸš€ Service Architecture

  • Modular Services: Independent, optional services for different features
  • Zero Backend Impact: All services are optional and don't affect backend integration
  • Backward Compatibility: Existing code continues to work without changes
  • Gradual Adoption: Add features incrementally as needed
  • Performance Optimized: Services only initialize when needed

πŸ“± Complete Platform Support

  • iOS: Face ID, Touch ID, native SMS, VoiceOver, iOS-specific optimizations
  • Android: Fingerprint, SMS Retriever API, User Consent API, TalkBack
  • Web: Optimized keyboard handling, screen reader support, responsive design
  • Desktop: Platform-specific layouts, keyboard navigation, accessibility

🧭 Highlights

  • Complete solution with timer, validation, masking, and SMS autofill
  • Cross-platform support with advanced UI and customization
  • Rich animation system for errors, fill, and cursor
  • Enterprise-ready options (rate limiting, audit logging, biometrics)
  • Real-time performance monitoring and memory optimization

πŸ”„ Migration Guide #

  • From OtpVerificationWidget: change widget name to OtpKit
  • Zero breaking changes: existing code continues to work

πŸ“¦ Dependencies #

  • No New Dependencies: All features built with existing Flutter APIs
  • Platform Channels: Uses method channels for platform-specific features
  • Optional Services: Services only load when features are enabled

2.2.0 - 2025-09-25 #

πŸš€ Complete Field Configuration Control & Platform Adaptation #

🎨 Complete Field Configuration Control

  • New fieldConfig Parameter: Added complete field configuration control to OtpVerificationWidget
  • Full Customization: Users can now pass a complete OtpFieldConfig object for unlimited field styling control
  • Fallback System: Individual field parameters still work as fallback when fieldConfig is not provided
  • Advanced Field Shapes: Complete control over field shapes including custom shapes with OtpFieldShapeConfig
  • Custom Border Styles: Support for solid, dashed, dotted, bottomOnly, topOnly, leftOnly, rightOnly borders
  • Complete Styling Control: Control over dimensions, colors, effects, typography, cursor, shadows, and animations

🎯 Field Configuration Features

  • Field Dimensions: Complete control over fieldWidth, fieldHeight, borderRadius, borderWidth
  • Field Shapes: Support for rectangle, roundedRectangle, circle, stadium, underlined, outlined, custom
  • Custom Shapes: OtpFieldShapeConfig with OtpBorderStyle for unlimited border customization
  • Colors: Full control over primaryColor, backgroundColor, shadowColor, cursorColor
  • Effects: Control over enableShadow, focusEffect, completedEffect, focusGlowRadius, focusGlowIntensity
  • Typography: Control over fieldFontSize, fieldFontWeight, letterSpacing
  • Cursor: Control over cursorColor, cursorWidth

πŸ“± Platform Adaptation & Compatibility

  • Cross-Platform Support: Optimized for iOS, Android, Web, Desktop, and macOS
  • Platform-Specific Optimizations: Enhanced performance and behavior for each platform
  • Responsive Design: Automatic adaptation to different screen sizes and orientations
  • Platform-Specific Styling: Optimized styling for each platform's design guidelines
  • Accessibility: Enhanced accessibility support across all platforms
  • Performance: Optimized rendering and state management for all platforms

🎨 Advanced Field Styling Examples

  • Dashed Borders: Custom dashed borders with configurable dash patterns
  • Gradient Effects: Support for gradient backgrounds and effects
  • Shadow Effects: Customizable shadows with color, blur, spread, and offset control
  • Focus Effects: Glow effects, color transitions, and focus animations
  • Completed Effects: Fill and border effects for completed fields
  • Custom Decorations: Complete control over field decorations and appearance

πŸ“š Comprehensive Documentation

  • Complete API Reference: Comprehensive documentation of all parameters and methods
  • Field Configuration Guide: Detailed guide for using fieldConfig parameter
  • Platform Adaptation Guide: Guide for platform-specific optimizations
  • Advanced Examples: Multiple examples showing different field configurations
  • Best Practices: Best practices for field styling and platform adaptation
  • Migration Guide: Guide for upgrading from previous versions

πŸ”§ Enhanced Public API

  • Field Configuration Methods: New methods for managing field configurations
  • Platform Detection: Methods for detecting and adapting to different platforms
  • Style Management: Enhanced style management with platform-specific optimizations
  • Configuration Validation: Automatic validation of field configurations
  • Error Handling: Improved error handling for invalid configurations

🎯 Usage Examples

  • Basic Field Configuration: Simple field styling with individual parameters
  • Advanced Field Configuration: Complete field styling with fieldConfig parameter
  • Custom Field Shapes: Examples of custom field shapes and border styles
  • Platform-Specific Styling: Examples optimized for different platforms
  • Responsive Design: Examples showing responsive behavior across devices

πŸ§ͺ Testing & Quality Assurance

  • Cross-Platform Testing: Comprehensive testing across all supported platforms
  • Performance Testing: Performance optimization and testing for all platforms
  • Accessibility Testing: Accessibility testing and improvements
  • UI Testing: Comprehensive UI testing across different screen sizes and orientations
  • Integration Testing: Testing integration with different Flutter versions and dependencies

πŸ› Bug Fixes & Improvements

  • Field Configuration Fixes: Fixed issues with field configuration parameter handling
  • Platform-Specific Fixes: Fixed platform-specific issues and optimizations
  • Performance Improvements: Enhanced performance across all platforms
  • Memory Management: Improved memory management and resource cleanup
  • State Management: Enhanced state management and synchronization

πŸ“± Platform-Specific Enhancements

  • iOS: Enhanced iOS-specific optimizations and styling
  • Android: Enhanced Android-specific optimizations and Material Design compliance
  • Web: Enhanced web-specific optimizations and responsive behavior
  • Desktop: Enhanced desktop-specific optimizations and keyboard navigation
  • macOS: Enhanced macOS-specific optimizations and styling

2.1.1 - 2025-09-15 #

πŸ› Bug Fixes #

πŸ”§ Documentation & README Updates

  • Enhanced Package Logo: Increased logo size from 200px to 300px in README for better visibility
  • Improved README Header: Added subtitle "Flutter OTP Kit - Professional OTP Verification Package" below logo
  • Better Visual Presentation: Enhanced package branding and visual appeal in documentation

πŸ“š Minor Documentation Improvements

  • README Enhancement: Improved logo presentation and package description
  • Visual Consistency: Better alignment and spacing in README header section
  • Professional Appearance: Enhanced overall package presentation on pub.flutter-io.cn

2.1.0 - 2025-09-15 #

🌍 RTL/LTR Support & Directionality #

πŸ”„ Complete Directionality Support

  • Automatic Direction Detection: Package automatically detects text direction based on app locale
  • Manual Direction Override: Option to manually specify textDirection (RTL/LTR)
  • RTL Language Support: Full support for Arabic, Hebrew, Persian, Urdu, and other RTL languages
  • Seamless Integration: RTL functionality works identically to LTR with proper text flow
  • Locale-Based Detection: Supports 10+ RTL languages with automatic detection

🎨 RTL Visual Design

  • Proper Text Flow: Text flows correctly from right-to-left in RTL mode
  • Field Arrangement: OTP fields arrange properly in RTL layout
  • Button Positioning: Verify and resend buttons position correctly for RTL
  • Icon Alignment: All icons and visual elements align properly in RTL
  • Arabic Validation Messages: Beautiful Arabic validation messages with proper styling

🎯 Tap Outside Unfocus & Focus Management #

πŸ“± Global Tap Outside Functionality

  • Built-in Tap Outside: Package handles tap outside unfocus automatically
  • Global Coverage: Tap anywhere on screen to unfocus fields (not just within widget)
  • External Handler Priority: External handlers take priority over built-in functionality
  • Configurable Behavior: unfocusOnTapOutside parameter to enable/disable
  • External Handler Support: externalTapOutsideHandler for custom tap outside logic

⚑ Real-time Focus Synchronization

  • Zero Delay Transitions: Focus state updates with zero delay
  • Cursor-Border Sync: Cursor position always matches focused field border
  • Immediate Visual Feedback: Focus borders appear instantly when fields are focused
  • Smooth Transitions: Smooth focus transitions between fields
  • Accurate Focus State: Focus state accurately reflects actual cursor position

πŸ”§ Validation State Isolation & Improvements #

🎯 Complete State Isolation

  • Validation vs Error Separation: Complete isolation between validation and error states
  • Independent State Management: Validation and error states managed independently
  • Persistent Validation Borders: Validation borders reappear correctly on subsequent triggers
  • Smart State Clearing: Validation states clear appropriately on user input
  • Mutual Exclusivity: Validation and error states are mutually exclusive

πŸ”„ Enhanced Validation Logic

  • Real-time Border Updates: Validation borders update in real-time
  • Proper State Hierarchy: Correct visual hierarchy: Error > Focused > Completed > Filled > Empty
  • Instant Error Clearing: Validation errors clear immediately when user types
  • State Refresh: Proper state refresh when validation is triggered
  • Focus Listener Setup: Enhanced focus listeners for immediate state updates

πŸ› Critical Bug Fixes #

πŸ”§ Focus State Management

  • Fixed Focus Mismatch: Cursor position now always matches focused field border
  • Eliminated Delays: Removed delays in focus transitions
  • Immediate Updates: Focus state updates immediately when fields change
  • Proper Listener Setup: Enhanced focus listener setup for real-time updates

🎯 Validation State Fixes

  • Fixed Border Persistence: Validation borders now persist and reappear correctly
  • State Isolation: Complete isolation between validation and error states
  • Proper Clearing: Validation states clear appropriately on user interaction
  • Real-time Updates: All state updates happen in real-time

πŸ“± Tap Outside Fixes

  • Global Coverage: Tap outside now works globally across the entire screen
  • External Handler Priority: External handlers properly take priority over built-in functionality
  • Layout Exception Fix: Fixed RenderBox layout exceptions in tap outside implementation
  • Gesture Detection: Proper gesture detection with HitTestBehavior.translucent

🧹 Code Quality & Maintenance #

🧽 Cleanup & Optimization

  • Removed Debug Statements: Removed all print() and log() statements from package
  • Code Cleanup: Cleaned up unused variables and methods
  • Performance Optimization: Optimized focus listener setup and state updates
  • Memory Management: Improved memory management in state updates

πŸ“š Documentation Updates

  • Updated README: Comprehensive documentation of new features
  • RTL Examples: Added RTL/LTR usage examples
  • Tap Outside Examples: Added tap outside functionality examples
  • API Reference: Updated API reference with new parameters
  • Package Logo: Added official package logo to README

🎨 Visual Improvements #

πŸ–ΌοΈ Package Branding

  • Official Logo: Added flutter_otp_kit_logo.png as package logo
  • README Enhancement: Updated README with package logo and branding
  • Visual Consistency: Consistent visual design across documentation

🎯 Enhanced Examples

  • RTL Example: Complete Arabic RTL example with proper styling
  • Auto Direction Example: Automatic direction detection example
  • Tap Outside Test: Interactive tap outside functionality test
  • External Handler Test: External tap outside handler example

2.0.0 - 2025-01-13 #

πŸš€ Complete Backend Integration & Real-time State Management (Current Version) #

πŸ”₯ Backend Integration Ready

  • Cubit/Bloc Integration: Perfect integration with Cubit/Bloc patterns
  • Automatic State Management: Package handles all error/validation states automatically
  • handleVerificationResult(): New method for automatic success/error handling
  • handleBackendState(): Comprehensive backend state management method
  • Minimal User Responsibility: Package handles maximum possible states internally

⚑ Real-time State Callbacks

  • onTimerChanged: Real-time timer state changes for custom widgets
  • onErrorStateChangedCallback: Real-time error state changes for custom widgets
  • onValidationStateChanged: Real-time validation state changes for custom widgets
  • onCompletionStateChanged: Real-time completion state changes for custom widgets
  • Instant Custom Widget Updates: Custom widgets update immediately when states change

🎯 Enhanced Public API

  • triggerResend(): Public method to trigger resend functionality programmatically
  • remainingResendTime: Getter for current remaining resend time
  • canResend: Getter to check if resend is currently available
  • Comprehensive Error Clearing: All error states clear automatically on user input
  • Smart State Synchronization: Custom widgets stay perfectly synchronized with package

🎨 Complete Widget Customization

  • Optional Text Parameters: All text parameters now optional with sensible defaults
  • Widget-based Everything: Complete widget-based customization for all UI elements
  • Custom Validation Messages: Widget-based validation messages with animations
  • Immediate Custom Resend: Custom resend widgets update instantly with package timer
  • Perfect State Sync: Custom widgets automatically sync with package internal states

🧠 Intelligent State Management

  • Mutual Exclusivity: Error and validation states are mutually exclusive
  • Automatic Clearing: All error states clear comprehensively on any user input
  • Smart Validation: Default validation message widget when auto-validation enabled
  • Backend Ready: Perfect for any backend architecture (REST, GraphQL, etc.)
  • State Callbacks: Real-time notifications for all state changes

🎯 Latest Validation & Error Handling Enhancements #

βœ… Smart Validation System

  • Incomplete Field Prevention: Verify button now prevents submission with missing fields when enableAutoValidation: true
  • User-Friendly Messages: Shows "Please enter all digits" (or custom message) when fields are incomplete
  • Validation Message Display: Fixed validation messages not appearing when verify pressed with incomplete OTP
  • Custom Validation Messages: Support for custom validation messages via validationMessage parameter

πŸ”„ Instant Error Clearing

  • Immediate Error Clearing: Validation errors and red borders clear instantly when user starts typing
  • Smart Error State Management: Error text clears automatically on any user input (typing or deleting)
  • Field State Updates: All field states update properly when errors are cleared
  • Smooth UX: No more persistent validation errors - they disappear as soon as user interacts

πŸ§ͺ Enhanced Test Button Functionality

  • Functional Test Buttons: All test buttons now actually control the OTP widget state
  • GlobalKey Integration: Added GlobalKeys to access OtpVerificationWidget state programmatically
  • Smart Button Detection: Test buttons automatically work with currently selected example (basic or widget-based)
  • Complete Control: Set errors, clear errors, clear all fields, and fill test OTP programmatically

⏰ Resend Timer Improvements

  • Working Timer Countdown: Fixed resend timer to show proper countdown "Resend in 00:59", "00:58", etc.
  • Default Timer Functionality: Removed custom resend widget to enable default timer with countdown
  • Timer State Management: Timer properly resets and shows countdown in widget-based example

πŸ› Critical Bug Fixes

  • Validation Logic: Fixed verify button logic to check OTP completion before form validation
  • Error Text Clearing: Added proper error text clearing in onDigitChanged method
  • Method Availability: Verified all required methods exist (setErrorState, clearErrorState, clearOtp, setOtp)
  • State Synchronization: Fixed field state updates when validation errors are cleared

πŸ“š Documentation Updates

  • README Enhancement: Added comprehensive validation and error handling documentation
  • Usage Examples: Updated examples to show validation features and best practices
  • API Documentation: Enhanced documentation for validation parameters and methods

🎯 Complete Validation Flow #

  1. Enter partial OTP (e.g., "455_") β†’ Press "Verify" β†’ Shows "Please enter all digits" + red borders
  2. Start typing in any field β†’ Error message + red borders disappear immediately
  3. Complete the OTP β†’ Press "Verify" β†’ Works normally
  4. Test buttons work perfectly β†’ Set Error, Clear Error, Clear All, Fill Test all functional
  5. Resend timer works β†’ Shows countdown and functions properly when timer expires

🎨 Complete Visual Hierarchy & State Management Overhaul #

🎯 Perfect Visual State Management

  • Comprehensive Visual Hierarchy: Implemented strict visual hierarchy: Error > Focused > Completed > Filled > Empty
  • Generic Color System: All colors (including error colors) are completely generic and customizable
  • Smooth State Transitions: Enhanced smooth transitions between all field states with Curves.easeInOut
  • Focus State Precision: Fixed focus state management to show focused border only on actually focused fields
  • Error State Clearing: Aggressive error clearing on any user input (typing or deleting) for immediate feedback
  • Field Deletion Handling: Proper handling of field deletion with correct state transitions and focus management

πŸ”§ Enhanced Input Handling & Validation

  • Consecutive Digit Support: Fixed issue preventing consecutive identical digits (e.g., "2244" now works)
  • Clipboard Paste Enhancement: Robust paste functionality with debounce mechanism and intelligent full OTP vs single-digit handling
  • Input Validation: Enhanced validation using OtpValidator.isValidOtp for paste operations
  • Focus Management: Improved focus handling with WidgetsBinding.instance.addPostFrameCallback for proper timing

⏰ Timer & Resend Improvements

  • Automatic Timer Start: Timer now starts automatically on widget initialization
  • Timer Reset on Resend: Timer properly resets to full duration every time resend is triggered
  • Consistent Timer Behavior: Fixed timer behavior to work consistently across all scenarios

🎨 Widget-Based Customization Revolution

  • Complete Widget-Based Example: Transformed example into fully widget-based OTP screen with:
    • Custom gradient containers with shadows and borders
    • Multiple icons throughout the interface (security, phone, verified user, message, clock, keyboard, info)
    • Rich text with styled phone number display
    • Custom header with gradient icon containers
    • Enhanced subtitle with icons and rich text
    • Custom OTP fields container with keyboard icon
    • Informative footer with help text
  • Responsive Design: Fixed pixel overflow issues with Flexible widgets and proper text wrapping
  • Visual Polish: Added gradients, shadows, rounded corners, and professional styling throughout

πŸ› Critical Bug Fixes

  • RenderBox Layout Error: Fixed RenderBox was not laid out error by simplifying nested Column structure
  • Pixel Overflow Issues: Resolved all "RIGHT OVERFLOWED" warnings with responsive layout design
  • State Synchronization: Fixed timing issues with WidgetsBinding.instance.addPostFrameCallback
  • Focus State Accuracy: Ensured focus borders only appear on actually focused fields
  • Error State Persistence: Fixed error state not clearing properly on field deletion

🧩 Architecture Improvements

  • State Manager Enhancements: Added debugPrint statements (wrapped in kDebugMode) for better debugging
  • Style Manager Refactoring: Enhanced getFieldColors with strict visual hierarchy implementation
  • Field State Logic: Improved updateFieldState to correctly determine field error states
  • Animation Smoothing: Changed all animation curves to Curves.easeInOut for smoother transitions

πŸ—οΈ Complete Architecture Refactoring #

🧩 Widget-Based Architecture

  • Modular Design: Completely refactored into a widget-based architecture for better maintainability
  • Separation of Concerns: Clear separation between UI widgets, state management, and styling
  • Reusable Widgets: Created reusable widgets that can be used independently
  • Improved Testability: Widgets designed for better testability
  • Reduced Complexity: Main widget reduced from 1800+ lines to manageable, focused widgets

🧠 Enhanced State Management

  • Dedicated State Manager: Extracted state management into a dedicated OtpStateManager class
  • Centralized State Logic: All state transitions and management handled in one place
  • Cleaner State Transitions: More predictable and manageable state transitions
  • Improved Error Handling: Better error state management with clear responsibilities

🎨 Improved Styling System

  • Style Manager: Dedicated OtpStyleManager for handling all styling logic
  • Consistent Theming: More consistent application of themes and styles
  • Field Colors: Extracted FieldColors class for better color management
  • Dynamic Styling: Improved dynamic styling based on field states

βš™οΈ Configuration System

  • Modular Configuration: Split configuration into logical modules
  • Field Configuration: Dedicated OtpFieldConfig for field appearance
  • Error Configuration: Dedicated OtpErrorConfig for error handling
  • Animation Configuration: Dedicated OtpAnimationConfig for animations

πŸ› οΈ Utility Functions

  • OTP Masking: Extracted OtpMasker for contact information masking
  • OTP Validation: Extracted OtpValidator for input validation
  • OTP Formatting: Extracted OtpFormatter for input formatting

πŸ“± UI Widgets

  • OTP Field: Extracted individual field widget
  • OTP Fields Row: Container for OTP fields
  • OTP Header: Title and subtitle widget
  • OTP Footer: Verify button, resend, and timer widget
  • OTP Error Display: Error message widget

πŸ“š Documentation & Examples

  • Updated README: Comprehensive documentation of the new architecture
  • Architecture Section: Added dedicated section explaining the widget architecture
  • Screenshots & Demo: Added section for screenshots and video demonstration
  • Example App: Updated with an "Architecture Demo" showing widget usage
  • Code Comments: Improved code documentation

πŸ§ͺ Other Improvements

  • Reduced Code Duplication: Eliminated redundant code through proper abstraction
  • Better Type Safety: Improved type definitions and null safety
  • Performance Optimizations: More efficient rendering and state updates
  • Accessibility Improvements: Better semantic labeling and screen reader support

πŸ”§ Enhanced Public API & Flexible Methods #

🎯 Enhanced Public Methods

  • clearOtp(): Now supports configurable options for refocus, error clearing, and callbacks
  • setOtp(): Now supports configurable options for focus clearing, error handling, and callbacks
  • resetFields(): Now supports preserving focus and error state
  • isOtpValid(): New method to check if OTP is valid (complete and passes validation)

πŸ”₯ Improved Error State Management

  • Enhanced Error Priority System: Comprehensive error state priority handling based on configuration
  • Flexible Error Clearing: More control over when and how error states are cleared
  • Error Persistence Options: Better configuration for error state persistence
  • Error State Transitions: Smoother transitions between error states

🌟 Focus Management Improvements

  • Preserved Focus Option: Option to preserve focus when resetting fields
  • Focus Transitions: Better focus handling during field clearing and deletion
  • Focus State Management: More consistent focus state across all operations
  • Edge Case Handling: Better handling of focus edge cases

🎨 Field State Improvements

  • Priority-Based Field States: Enhanced field state priority system
  • State Transitions: Smoother transitions between field states
  • Empty Field Handling: Better handling of empty fields
  • Deletion Behavior: Improved behavior when deleting field values

πŸ“± User Experience Enhancements

  • Flexible API: More flexibility in how methods are called
  • Configurable Behavior: More control over widget behavior
  • Consistent States: More consistent state management
  • Predictable Behavior: More predictable behavior in all scenarios

πŸ“š Example Updates

  • Enhanced Edge Cases Demo: Updated with new method options
  • Interactive Testing: More comprehensive testing options
  • Method Options: Demonstrations of all method options
  • State Management: Better visualization of state management

🚨 Critical Bug Fixes & Professional Error State Management #

πŸ› Field Styling Priority Fixes

  • Fixed Completed Fields Override: Fixed issue where completed fields would override error styling
  • Proper Priority Order: Implemented correct priority order: Error > Focused > Completed > Filled > Empty
  • Empty Field Styling: Fixed inconsistent styling for empty fields with proper default border color
  • Border Color Transitions: Smoother transitions between border colors during state changes

πŸ”„ Enhanced Error State Management

  • Error State Persistence: Fixed issues with error state not persisting when needed
  • Error State Clearing: Improved error state clearing logic to be less aggressive
  • Error State Priority: Fixed issues with error state priority not being respected
  • Error State Feedback: Better visual feedback for error states

πŸ”§ Field Clearing & Deletion Fixes

  • Proper Field Clearing: Fixed issues with field clearing not properly resetting field states
  • Deletion Focus Handling: Improved focus handling during character deletion
  • Empty Field Styling: Fixed styling inconsistencies for empty fields after deletion
  • Border Color Transitions: Smoother transitions between border colors during deletion

πŸ§ͺ Edge Case Handling

  • Empty Input: Better handling of empty input
  • Partial Input: Improved handling of partial input
  • Deletion Edge Cases: Fixed edge cases with deletion at field boundaries
  • Focus Edge Cases: Better handling of focus edge cases

🎨 Widget-Based Customization #

πŸ–ΌοΈ Custom Widgets

  • Custom Title: Added titleWidget parameter for custom title widget
  • Custom Subtitle: Added subtitleWidget parameter for custom subtitle widget
  • Custom Error: Added errorWidget parameter for custom error message widget
  • Custom Button: Added verifyButtonWidget parameter for custom verify button
  • Custom Resend: Added resendWidget parameter for custom resend widget
  • Custom Timer: Added timerWidget parameter for custom timer widget

πŸ”„ Backward Compatibility

  • String Fallbacks: All widget parameters have string fallbacks for backward compatibility
  • Graceful Degradation: Widget falls back to string-based rendering when custom widgets are not provided
  • Consistent Styling: Consistent styling between string-based and widget-based customization
  • Seamless Integration: Custom widgets integrate seamlessly with the rest of the widget

1.4.0 - 2025-09-11 #

πŸš€ Automatic Error State Management & Widget-Based Customization #

πŸ”₯ Automatic Error State Management

  • External Error Control: Added hasError parameter to control error state externally
  • Error State Callback: Added onErrorStateChanged callback for error state changes
  • Auto-Clear Options: Added autoClearErrorOnInput and autoClearErrorOnResend parameters
  • Timed Error States: Added errorStateDuration for auto-clearing error states after a delay
  • Dynamic Styling: Fields now dynamically update styling based on error state
  • Error Persistence: Error state can persist until explicitly cleared or auto-cleared

🎨 Widget-Based Customization

  • Custom Title: Added titleWidget parameter for custom title widget
  • Custom Subtitle: Added subtitleWidget parameter for custom subtitle widget
  • Custom Error: Added errorWidget parameter for custom error message widget
  • Custom Button: Added verifyButtonWidget parameter for custom verify button
  • Custom Resend: Added resendWidget parameter for custom resend widget
  • Custom Timer: Added timerWidget parameter for custom timer widget
  • Backward Compatibility: All widget parameters have string fallbacks for backward compatibility

πŸ”§ Enhanced API

  • getCurrentOtp(): Added method to get the current OTP value
  • Error State Access: Added hasErrorState getter for checking current error state
  • Error State Control: Added setErrorState() and clearErrorState() methods
  • Improved Validation: Enhanced validation system with more options

πŸ“± User Experience Improvements

  • Better Error Feedback: Improved visual feedback for error states
  • Smoother Transitions: Enhanced transitions between states
  • More Customization: Greater flexibility for UI customization
  • Accessibility Improvements: Better screen reader support

πŸ“š Documentation & Examples

  • Updated README: Comprehensive documentation of new features
  • Error State Examples: Added examples for error state management
  • Widget Customization Examples: Added examples for widget-based customization
  • API Reference: Updated API reference with new methods and parameters

1.3.1 - 2025-09-10 #

πŸ› Bug Fixes & Minor Improvements #

πŸ”§ Bug Fixes

  • Focus Handling: Fixed issue with focus not properly moving to next field on input
  • Empty Field Styling: Fixed inconsistent styling for empty fields
  • Validation Timing: Fixed validation timing issues with auto-validation
  • Timer Reset: Fixed timer not properly resetting on resend

✨ Improvements

  • Performance Optimization: Reduced unnecessary rebuilds
  • Memory Usage: Improved memory management
  • Accessibility: Enhanced screen reader support
  • Documentation: Improved code documentation and examples

1.3.0 - 2025-09-09 #

πŸš€ Enhanced Styling & Animations #

🎨 Styling Enhancements

  • Progressive Highlighting: Added option to highlight fields as they are completed
  • Custom Field Shapes: Added support for different field shapes
  • Gradient Support: Added support for gradient backgrounds
  • Shadow Effects: Enhanced shadow customization options

🎬 Animation Improvements

  • Field-to-Field Animations: Added animations when moving between fields
  • State Transition Animations: Smoother transitions between field states
  • Customizable Animation Curves: Added support for custom animation curves
  • Animation Speed Control: Added parameters to control animation speed

πŸ”§ Other Improvements

  • Better Focus Management: Improved focus handling across fields
  • Enhanced Validation: More validation options and better error handling
  • Accessibility Enhancements: Better screen reader support and keyboard navigation
  • Documentation: Updated documentation with new features and examples

1.2.0 - 2025-09-08 #

πŸš€ Responsive Layout & Advanced Customization #

πŸ“± Responsive Layout

  • Adaptive Field Sizing: Fields now adapt to available width
  • Layout Types: Added different layout types (fixed, responsive, wrap)
  • Overflow Protection: Better handling of overflow scenarios
  • Cross-Platform Optimization: Improved layout on different platforms

🎨 Advanced Customization

  • Custom Field Styling: More options for field appearance
  • Button Customization: Enhanced button styling options
  • Typography Control: Better control over text styles
  • Theme Integration: Improved integration with app themes

πŸ”§ Other Improvements

  • Performance Optimization: Reduced rebuild frequency
  • Memory Management: Better resource cleanup
  • Accessibility: Enhanced accessibility features
  • Documentation: Comprehensive documentation update

1.1.0 - 2025-09-07 #

πŸš€ Enhanced Functionality & Customization #

πŸ”§ New Features

  • Multiple Input Types: Added support for numeric, alphabetic, and alphanumeric input
  • Custom Validation: Added support for custom validation rules
  • Auto-Submit: Option to automatically submit when OTP is complete
  • Paste Support: Added clipboard paste detection

🎨 Customization Options

  • Color Customization: More options for customizing colors
  • Dimension Control: Better control over field dimensions
  • Spacing Options: Customizable spacing between elements
  • Typography: Enhanced text styling options

πŸ“± User Experience

  • Focus Management: Improved focus handling
  • Error Handling: Better error state management
  • Feedback: Enhanced visual feedback
  • Accessibility: Improved screen reader support

1.0.0 - 2025-09-06 #

πŸš€ Initial Release #

πŸ”§ Core Features

  • OTP Input: Basic OTP input functionality
  • Verification: OTP verification with callback
  • Resend: Resend functionality with timer
  • Validation: Basic input validation

🎨 Customization

  • Colors: Basic color customization
  • Dimensions: Field size and spacing customization
  • Text: Customizable text elements
  • Styling: Basic styling options

πŸ“± User Experience

  • Focus Management: Automatic focus movement
  • Error States: Basic error state handling
  • Animation: Simple animations
  • Accessibility: Basic accessibility support
33
likes
160
points
227
downloads

Publisher

unverified uploader

Weekly Downloads

A comprehensive Flutter OTP verification package with SMS autofill, biometric support, performance monitoring, and extensive customization options.

Repository (GitHub)
View/report issues
Contributing

Topics

#flutter #otp #verification #sms-autofill #biometric

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_otp_kit