<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aung Ye Zaw on Medium]]></title>
        <description><![CDATA[Stories by Aung Ye Zaw on Medium]]></description>
        <link>https://medium.com/@aungyezaw.dev?source=rss-70a677476c88------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*v9yFenKWJxfPD95hvAvtrA.png</url>
            <title>Stories by Aung Ye Zaw on Medium</title>
            <link>https://medium.com/@aungyezaw.dev?source=rss-70a677476c88------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 13:37:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aungyezaw.dev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The silent team member that improves your Flutter codebase automatically.]]></title>
            <link>https://medium.com/@aungyezaw.dev/the-silent-team-member-that-improves-your-flutter-codebase-automatically-c1eb82ce235a?source=rss-70a677476c88------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1eb82ce235a</guid>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Aung Ye Zaw]]></dc:creator>
            <pubDate>Mon, 08 Dec 2025 07:24:57 GMT</pubDate>
            <atom:updated>2025-12-08T07:24:57.560Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YvvRjGxqw7TYpCcScn5-jA.png" /></figure><p>Are you still manually reviewing Flutter code for missing const modifiers or stray print() statements? You are wasting valuable time.</p><p>There is a “hidden” feature in Flutter that acts as an automated senior developer, constantly reviewing your code as you type.</p><p>It’s the <strong>analysis_options.yaml</strong> file.</p><p>Most developers leave it at the default settings. Big mistake. By customizing this file, you unlock the full power of the Dart analyzer.</p><p>copy and paste to analysis_options.yaml following code</p><pre>include: package:flutter_lints/flutter.yaml<br><br>analyzer:<br>  exclude:<br>    - &quot;**/*.g.dart&quot;<br>    - &quot;**/*.freezed.dart&quot;<br>    - &quot;**/*.gr.dart&quot;<br>    - &quot;**/generated/**&quot;<br>    - &quot;build/**&quot;<br>    - &quot;lib/generated_plugin_registrant.dart&quot;<br>  <br>  strong-mode:<br>    implicit-casts: true<br>    implicit-dynamic: true<br>  <br>  language:<br>    strict-casts: true<br>    strict-inference: true<br>    strict-raw-types: true<br><br>linter:<br>  rules:<br>    # Error Rules<br>    always_use_package_imports: true<br>    avoid_dynamic_calls: true<br>    avoid_empty_else: true<br>    avoid_print: true<br>    avoid_relative_lib_imports: true<br>    avoid_slow_async_io: true<br>    avoid_type_to_string: true<br>    avoid_types_as_parameter_names: true<br>    cancel_subscriptions: true<br>    close_sinks: true<br>    comment_references: true<br>    control_flow_in_finally: true<br>    diagnostic_describe_all_properties: true<br>    empty_statements: true<br>    hash_and_equals: true<br>    invariant_booleans: true<br>    iterable_contains_unrelated_type: true<br>    list_remove_unrelated_type: true<br>    literal_only_boolean_expressions: true<br>    no_adjacent_strings_in_list: true<br>    no_duplicate_case_values: true<br>    no_logic_in_create_state: true<br>    prefer_void_to_null: true<br>    test_types_in_equals: true<br>    throw_in_finally: true<br>    unnecessary_statements: true<br>    unrelated_type_equality_checks: true<br>    use_build_context_synchronously: true<br>    use_key_in_widget_constructors: true<br>    valid_regexps: true<br><br>    # Style Rules<br>    always_declare_return_types: true<br>    always_put_control_body_on_new_line: true<br>    always_put_required_named_parameters_first: true<br>    always_specify_types: true<br>    annotate_overrides: true<br>    avoid_annotating_with_dynamic: true<br>    avoid_bool_literals_in_conditional_expressions: true<br>    avoid_catches_without_on_clauses: true<br>    avoid_catching_errors: true<br>    avoid_classes_with_only_static_members: true<br>    avoid_double_and_int_checks: true<br>    avoid_equals_and_hash_code_on_mutable_classes: true<br>    avoid_escaping_inner_quotes: true<br>    avoid_field_initializers_in_const_classes: true<br>    avoid_function_literals_in_foreach_calls: true<br>    avoid_implementing_value_types: true<br>    avoid_init_to_null: true<br>    avoid_js_rounded_ints: true<br>    avoid_multiple_declarations_per_line: true<br>    avoid_null_checks_in_equality_operators: true<br>    avoid_positional_boolean_parameters: true<br>    avoid_private_typedef_functions: true<br>    avoid_redundant_argument_values: true<br>    avoid_renaming_method_parameters: true<br>    avoid_return_types_on_setters: true<br>    avoid_returning_null_for_void: true<br>    avoid_returning_this: true<br>    avoid_setters_without_getters: true<br>    avoid_shadowing_type_parameters: true<br>    avoid_single_cascade_in_expression_statements: true<br>    avoid_unnecessary_containers: true<br>    avoid_unused_constructor_parameters: true<br>    avoid_void_async: true<br>    avoid_web_libraries_in_flutter: true<br>    await_only_futures: true<br>    camel_case_extensions: true<br>    camel_case_types: true<br>    cascade_invocations: true<br>    cast_nullable_to_non_nullable: true<br>    conditional_uri_does_not_exist: true<br>    constant_identifier_names: true<br>    curly_braces_in_flow_control_structures: true<br>    depend_on_referenced_packages: true<br>    deprecated_consistency: true<br>    directives_ordering: true<br>    do_not_use_environment: true<br>    eol_at_end_of_file: true<br>    exhaustive_cases: true<br>    file_names: true<br>    flutter_style_todos: true<br>    implementation_imports: true<br>    join_return_with_assignment: true<br>    leading_newlines_in_multiline_strings: true<br>    library_names: true<br>    library_prefixes: true<br>    library_private_types_in_public_api: true<br>    lines_longer_than_80_chars: true<br>    missing_whitespace_between_adjacent_strings: true<br>    no_default_cases: true<br>    no_runtimeType_toString: true<br>    non_constant_identifier_names: true<br>    noop_primitive_operations: true<br>    null_check_on_nullable_type_parameter: true<br>    null_closures: true<br>    one_member_abstracts: true<br>    only_throw_errors: true<br>    overridden_fields: true<br>    package_names: true<br>    package_prefixed_library_names: true<br>    parameter_assignments: true<br>    prefer_adjacent_string_concatenation: true<br>    prefer_asserts_in_initializer_lists: true<br>    prefer_asserts_with_message: true<br>    prefer_collection_literals: true<br>    prefer_conditional_assignment: true<br>    prefer_const_constructors: true<br>    prefer_const_constructors_in_immutables: true<br>    prefer_const_declarations: true<br>    prefer_const_literals_to_create_immutables: true<br>    prefer_constructors_over_static_methods: true<br>    prefer_contains: true<br>    prefer_equal_for_default_values: true<br>    prefer_expression_function_bodies: true<br>    prefer_final_fields: true<br>    prefer_final_in_for_each: true<br>    prefer_final_locals: true<br>    prefer_for_elements_to_map_fromIterable: true<br>    prefer_foreach: true<br>    prefer_function_declarations_over_variables: true<br>    prefer_generic_function_type_aliases: true<br>    prefer_if_elements_to_conditional_expressions: true<br>    prefer_if_null_operators: true<br>    prefer_initializing_formals: true<br>    prefer_inlined_adds: true<br>    prefer_int_literals: true<br>    prefer_interpolation_to_compose_strings: true<br>    prefer_is_empty: true<br>    prefer_is_not_empty: true<br>    prefer_is_not_operator: true<br>    prefer_iterable_whereType: true<br>    prefer_mixin: true<br>    prefer_null_aware_method_calls: true<br>    prefer_null_aware_operators: true<br>    prefer_single_quotes: true<br>    prefer_spread_collections: true<br>    prefer_typing_uninitialized_variables: true<br>    provide_deprecation_message: true<br>    public_member_api_docs: true<br>    recursive_getters: true<br>    require_trailing_commas: true<br>    sized_box_for_whitespace: true<br>    sized_box_shrink_expand: true<br>    slash_for_doc_comments: true<br>    sort_child_properties_last: true<br>    sort_constructors_first: true<br>    sort_pub_dependencies: true<br>    sort_unnamed_constructors_first: true<br>    tighten_type_of_initializing_formals: true<br>    type_annotate_public_apis: true<br>    type_init_formals: true<br>    unawaited_futures: true<br>    unnecessary_await_in_return: true<br>    unnecessary_brace_in_string_interps: true<br>    unnecessary_const: true<br>    unnecessary_constructor_name: true<br>    unnecessary_getters_setters: true<br>    unnecessary_lambdas: true<br>    unnecessary_late: true<br>    unnecessary_new: true<br>    unnecessary_null_aware_assignments: true<br>    unnecessary_null_checks: true<br>    unnecessary_null_in_if_null_operators: true<br>    unnecessary_nullable_for_final_variable_declarations: true<br>    unnecessary_overrides: true<br>    unnecessary_parenthesis: true<br>    unnecessary_raw_strings: true<br>    unnecessary_string_escapes: true<br>    unnecessary_string_interpolations: true<br>    unnecessary_this: true<br>    unnecessary_to_list_in_spreads: true<br>    unreachable_from_main: true<br>    use_colored_box: true<br>    use_decorated_box: true<br>    use_enums: true<br>    use_full_hex_values_for_flutter_colors: true<br>    use_function_type_syntax_for_parameters: true<br>    use_if_null_to_convert_nulls_to_bools: true<br>    use_is_even_rather_than_modulo: true<br>    use_late_for_private_fields_and_variables: true<br>    use_named_constants: true<br>    use_raw_strings: true<br>    use_rethrow_when_possible: true<br>    use_setters_to_change_properties: true<br>    use_string_buffers: true<br>    use_test_throws_matchers: true<br>    use_to_and_as_if_applicable: true<br>    void_checks: true</pre><p><strong>Why you need to configure this today:<br>Consistency:</strong> Enforce the same coding style across your entire team, regardless of experience level.</p><p><strong>Catch Bugs Early:</strong> Detect issues like incorrect async implementations before you even run the app.</p><p><strong>Performance:</strong> Force habits that lead to better performance (like enforcing const).</p><p><strong>Cleaner Diffs:</strong> Stop arguing about formatting in Pull Requests.<br>What is your absolute must-have rule in your analysis_options.yaml? Let me know in the comments!</p><p>You can see the huge changes when run</p><pre>dart fix --apply;dart format .;</pre><p>#FlutterDev #MobileDevelopment #CodeQuality #DartLang #SoftwareEngineering</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1eb82ce235a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open Source Release: 16KB Page Size Compatibility Checker for Android Apps]]></title>
            <link>https://medium.com/@aungyezaw.dev/open-source-release-16kb-page-size-compatibility-checker-for-android-apps-c50e95dc3fca?source=rss-70a677476c88------2</link>
            <guid isPermaLink="false">https://medium.com/p/c50e95dc3fca</guid>
            <category><![CDATA[16-kb-page-size]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[google-play-store]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Aung Ye Zaw]]></dc:creator>
            <pubDate>Thu, 04 Dec 2025 02:59:20 GMT</pubDate>
            <atom:updated>2025-12-04T02:59:20.360Z</atom:updated>
            <content:encoded><![CDATA[<p>Google Play Store now requires all apps to support 16KB page sizes in 2025. To help Android developers ensure compliance, I’ve built and open-sourced a production-grade validation tool.</p><p>✅ Validates AAB and APK files for 16KB page size compatibility</p><p>✅ Auto-discovers build artifacts in your project</p><p>✅ Integrates with bundletool for official Google validation</p><p>✅ Generates detailed reports with actionable recommendations</p><p>✅ CI/CD ready with JSON output support</p><p>• Self-contained Bash script with embedded Python analysis</p><p>• Beautiful terminal output with progress indicators</p><p>• Graceful degradation when optional dependencies are missing</p><p>• Comprehensive error handling and recovery</p><p>• Zero external dependencies for core functionality</p><p>Many developers are unaware their apps might fail on newer Android devices with 16KB page sizes. This tool catches these issues before Google Play rejection, saving hours of debugging and re-submission delays.</p><pre>chmod +x check_16kb_compatibility.sh<br>./check_16kb_compatibility.sh</pre><p>• Flutter developers</p><p>• Android native developers</p><p>• DevOps teams managing CI/CD pipelines</p><p>• QA teams validating releases</p><p>GitHub: <a href="https://github.com/THANLAR/check_16kb_compatibility">https://github.com/THANLAR/check_16kb_compatibility</a></p><p>Drop a comment or email: admin@thanlar.com</p><p>#Android #OpenSource #DevTools #Flutter #AndroidDevelopment #MobileDev #GooglePlay #SoftwareEngineering #DevOps #CICD</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c50e95dc3fca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Gradle: The Backbone of Efficient Android Development]]></title>
            <link>https://medium.com/@aungyezaw.dev/mastering-gradle-the-backbone-of-efficient-android-development-97e21eca71ea?source=rss-70a677476c88------2</link>
            <guid isPermaLink="false">https://medium.com/p/97e21eca71ea</guid>
            <category><![CDATA[gradle-kotlin-dsl]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[gradlew]]></category>
            <dc:creator><![CDATA[Aung Ye Zaw]]></dc:creator>
            <pubDate>Mon, 19 Feb 2024 10:35:12 GMT</pubDate>
            <atom:updated>2024-02-19T10:35:12.201Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of Android development, Gradle stands as a powerful yet often misunderstood tool. It serves as the backbone of building, testing, and deploying Android applications efficiently. In this article, we’ll delve into the fundamentals of Gradle, exploring its architecture, key concepts, and best practices. By mastering Gradle, you’ll streamline your development workflow and optimize your Android projects for success.</p><p><strong>Understanding Gradle:</strong></p><p>At its core, Gradle is a build automation tool that orchestrates the entire build process of an Android project. It utilizes a Groovy or Kotlin-based DSL (Domain Specific Language) to define project configurations and tasks. Gradle operates on the principle of convention over configuration, allowing developers to focus on their application logic while it handles the build intricacies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*89FxNOfLuZC4ZxjNbx0Rkg.png" /><figcaption><a href="https://gradle.org/">https://gradle.org/</a></figcaption></figure><p><strong>Key Concepts:</strong></p><p><strong>Build Scripts:</strong> Gradle build scripts, typically named build.gradle, define project configurations such as dependencies, plugins, and tasks. These scripts are written using the Groovy or Kotlin DSL and serve as the blueprint for building the application.</p><p><strong>Tasks:</strong> Tasks represent individual units of work within the build process. Gradle provides a wide range of predefined tasks for common operations like compiling code, running tests, and generating APKs. Additionally, developers can define custom tasks to automate specific project workflows.</p><p><strong>Plugins:</strong> Gradle plugins extend the build process by providing additional functionality and tasks. Android projects leverage the Android Gradle Plugin (com.android.application) and various other plugins for tasks like code quality checks, code coverage, and dependency management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJF1Ts7_XnODKffp9482Iw.png" /><figcaption><a href="https://gradle.org/guides/">https://gradle.org/guides/</a></figcaption></figure><p><strong>Gradle Configuration:</strong></p><p>Let’s take a closer look at a basic build.gradle file for an Android project:</p><pre>plugins {<br>    id &#39;com.android.application&#39;<br>}<br><br>android {<br>    compileSdkVersion 31<br>    defaultConfig {<br>        applicationId &quot;com.example.myapp&quot;<br>        minSdkVersion 21<br>        targetSdkVersion 31<br>        versionCode 1<br>        versionName &quot;1.0&quot;<br>    }<br>    buildTypes {<br>        release {<br>            minifyEnabled false<br>            proguardFiles getDefaultProguardFile(&#39;proguard-android-optimize.txt&#39;), &#39;proguard-rules.pro&#39;<br>        }<br>    }<br>}<br><br>dependencies {<br>    implementation &#39;androidx.appcompat:appcompat:1.4.0&#39;<br>    implementation &#39;com.google.android.material:material:1.5.0&#39;<br>}</pre><p>This <strong>build.gradle</strong> file configures an Android application with essential parameters such as compile SDK version, application ID, and dependencies. The <strong>android </strong>block specifies Android-specific configurations, while the <strong>dependencies </strong>block lists the external libraries required by the application.</p><p><strong>Conclusion:</strong></p><p>In this article, we’ve only scratched the surface of what Gradle has to offer in Android development. By mastering Gradle, developers can automate build processes, manage dependencies efficiently, and customize project workflows to meet their specific requirements. As you continue your journey in Android development, delve deeper into Gradle’s documentation and explore advanced features to unlock its full potential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*frQNaWYLvfo_dLm785yR0w.jpeg" /><figcaption><a href="https://gradle.org/features/">https://gradle.org/features/</a></figcaption></figure><p><strong>Sample Codes:</strong></p><p>To further solidify your understanding, here are a few sample Gradle commands commonly used in Android development:</p><p><strong>Build the Project:</strong></p><pre>./gradlew build</pre><p><strong>Run Tests:</strong></p><pre>./gradlew test</pre><p><strong>Generate APK:</strong></p><pre>./gradlew assembleDebug</pre><p>Experiment with these commands in your Android projects to experience Gradle’s power firsthand.</p><p><strong>Gradle stands as the cornerstone of Android development, serving as a versatile and powerful build automation tool. Its Groovy or Kotlin-based DSL empowers developers to define project configurations, tasks, and dependencies with ease. Embracing Gradle allows for seamless integration with various libraries, plugins, and CI/CD platforms, streamlining the development workflow and enabling efficient build processes. By mastering Gradle’s key concepts, configuring project settings, and adopting advanced techniques, developers can optimize performance, enhance productivity, and elevate their Android development skills to new heights. Whether you’re a novice or an experienced developer, understanding and harnessing the capabilities of Gradle is essential for building high-quality Android applications effectively.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/119/1*9eDTqcIcdwYSVWmAcgLa5w.png" /></figure><p><a href="https://gradle.org/">Gradle Build Tool</a></p><p><a href="https://www.linkedin.com/in/aungyezawdev/">https://www.linkedin.com/in/aungyezawdev/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97e21eca71ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Power of Slider CAPTCHA in Flutter: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@aungyezaw.dev/unlocking-the-power-of-slider-captcha-in-flutter-a-step-by-step-guide-ecafc7740a6c?source=rss-70a677476c88------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecafc7740a6c</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[slider-recaptcha]]></category>
            <category><![CDATA[recaptcha]]></category>
            <dc:creator><![CDATA[Aung Ye Zaw]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 09:45:06 GMT</pubDate>
            <atom:updated>2024-01-29T10:06:49.069Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s digital age, ensuring the security of our online platforms is paramount. From e-commerce websites to social media applications, protecting user data and preventing unauthorized access are top priorities for developers worldwide. One of the most effective tools in this endeavor is CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart). CAPTCHA systems are designed to distinguish between human users and automated bots, thus safeguarding online platforms against spam, fraud, and other malicious activities.</p><p>In the realm of mobile application development, implementing CAPTCHA functionality poses unique challenges and opportunities. Flutter, Google’s open-source UI toolkit for building natively compiled applications across mobile, web, and desktop, offers developers a versatile framework for creating robust and secure mobile apps. Leveraging Flutter’s capabilities, developers can integrate various CAPTCHA solutions seamlessly into their applications to enhance security and user experience.</p><p>In this comprehensive guide, we will delve into the world of CAPTCHA and explore the implementation of a Slider CAPTCHA widget in Flutter. Slider CAPTCHA, a popular variation of CAPTCHA challenges, presents users with a dynamic slider interface that they must interact with to verify their identity as human users. We will walk through the step-by-step process of creating and integrating a Slider CAPTCHA widget into a Flutter application, highlighting key concepts, code snippets, and best practices along the way.</p><h4>main.dart</h4><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:slider_recaptcha/slider_lib.dart&#39;;<br><br>void main() {<br>  runApp(const MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  const MyApp({super.key});<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      title: &#39;Slider reCAPTCHA&#39;,<br>      debugShowCheckedModeBanner: false,<br>      theme: ThemeData(<br>        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),<br>        useMaterial3: true,<br>      ),<br>      home: const MyHomePage(),<br>    );<br>  }<br>}<br><br>class MyHomePage extends StatefulWidget {<br>  const MyHomePage({super.key});<br><br>  @override<br>  State&lt;MyHomePage&gt; createState() =&gt; _MyHomePageState();<br>}<br><br>class _MyHomePageState extends State&lt;MyHomePage&gt; {<br>  void _showRecaptcha() {<br>    showDialog(<br>      context: context,<br>      barrierDismissible: false,<br>      builder: (BuildContext context) {<br>        return Dialog(<br>          backgroundColor: Colors.transparent,<br>          child: SizedBox(<br>            width: double.infinity,<br>            height: 275,<br>            child: SliderCaptcha(<br>              image: Image.asset(<br>                &#39;assets/images/flutter_logo.jpeg&#39;,<br>                fit: BoxFit.fitWidth,<br>              ),<br>              colorBar: Colors.blueAccent,<br>              colorCaptChar: Colors.blueGrey,<br>              title: &quot;Slide to Captcha&quot;,<br>              onConfirm: (value) async {<br>                if (value) {<br>                  Navigator.of(context).pop();<br>                  _showSuccessSnackBar(context);<br>                }<br>              },<br>            ),<br>          ),<br>        );<br>      },<br>    );<br>  }<br><br>  void _showSuccessSnackBar(BuildContext context) {<br>    ScaffoldMessenger.of(context).showSnackBar(<br>      SnackBar(<br>        content: const Text(&quot;Success!&quot;),<br>        behavior: SnackBarBehavior.floating, // Ensure the SnackBar is floating<br>        shape: RoundedRectangleBorder(<br>          borderRadius:<br>              BorderRadius.circular(10), // Optional: Add border radius<br>        ),<br>      ),<br>    );<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: Center(<br>        child: ElevatedButton(<br>            onPressed: () =&gt; _showRecaptcha(), child: const Text(&quot;reCAPTCHA&quot;)),<br>      ),<br>    );<br>  }<br>}</pre><p>The main.dart file serves as the entry point for the Flutter application. It defines the MyApp widget, which initializes the MaterialApp with a customized theme and sets MyHomePage as the initial screen.</p><p>MyHomePage presents a button labeled &quot;reCAPTCHA&quot; to initiate the CAPTCHA verification process. Upon pressing this button, the _showRecaptcha method is invoked, displaying a dialog box with the SliderCaptcha widget. This widget presents users with an interactive slider mechanism to verify their identity.</p><p>Upon successful verification, the _showSuccessSnackBar method displays a SnackBar notification with the message &quot;Success!&quot;. The application&#39;s theme is tailored with specific color schemes, while the debug banner is omitted for a polished user interface.</p><p>The SliderCaptcha widget, imported from slider_lib.dart, is crucial to the CAPTCHA verification process. It integrates seamlessly into the dialog box, providing users with an intuitive slider interface for confirming their identity.</p><p>Overall, main.dart orchestrates the application&#39;s flow, seamlessly integrating CAPTCHA functionality to enhance security and user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*QdmeGe1sooIh9dM5TPis8g.jpeg" /></figure><pre><br>class PuzzlePiecePainter extends CustomPainter {<br>  PuzzlePiecePainter(<br>    this.width,<br>    this.height,<br>    this.offsetX,<br>    this.offsetY, {<br>    this.paintingStyle = PaintingStyle.stroke,<br>  });<br>  final double width;<br>  final double height;<br>  final double offsetX;<br>  final double offsetY;<br>  final PaintingStyle paintingStyle;<br><br>  @override<br>  Future&lt;void&gt; paint(Canvas canvas, Size size) async {<br>    final Paint paint = Paint()<br>      ..color = Colors.blue<br>      ..style = paintingStyle<br>      ..strokeWidth = 3.0;<br><br>    canvas.drawPath(getPiecePathCustom(size, offsetX, offsetY, width), paint);<br>  }<br><br>  @override<br>  bool shouldRepaint(CustomPainter oldDelegate) =&gt; false;<br>}<br><br>Path getPiecePathCustom(<br>    Size size, double offsetX, double offsetY, double sizePart) {<br>  final double bumpSize = sizePart / 4;<br>  Path path = Path();<br>  path.moveTo(offsetX, offsetY);<br>  path.lineTo(offsetX + sizePart / 3, offsetY);<br>  path.cubicTo(<br>    offsetX + sizePart / 6,<br>    offsetY + bumpSize,<br>    offsetX + sizePart / 6 * 5,<br>    offsetY + bumpSize,<br>    offsetX + sizePart / 3 * 2,<br>    offsetY,<br>  );<br>  path.lineTo(offsetX + sizePart, offsetY);<br>  path.lineTo(offsetX + sizePart, offsetY + sizePart / 3);<br>  path.cubicTo(<br>      offsetX + sizePart + bumpSize,<br>      offsetY + sizePart / 6,<br>      offsetX + sizePart + bumpSize,<br>      offsetY + sizePart / 6 * 5,<br>      offsetX + sizePart,<br>      offsetY + sizePart / 3 * 2);<br>  path.lineTo(offsetX + sizePart, offsetY + sizePart);<br>  path.lineTo(offsetX + sizePart / 3 * 2, offsetY + sizePart);<br>  path.lineTo(offsetX, offsetY + sizePart);<br>  path.lineTo(offsetX, offsetY + sizePart / 3 * 2);<br>  path.cubicTo(<br>      offsetX + bumpSize,<br>      offsetY + sizePart / 6 * 5,<br>      offsetX + bumpSize,<br>      offsetY + sizePart / 6,<br>      offsetX,<br>      offsetY + sizePart / 3);<br>  path.close();<br>  return path;<br>}</pre><p>This section of the code defines a custom CustomPainter named PuzzlePiecePainter in Flutter. It&#39;s responsible for painting a puzzle piece on the canvas using parameters like width, height, offsetX, offsetY, and paintingStyle. The paint method draws the puzzle piece using a custom path generated by the getPiecePathCustom function, which calculates the shape of the puzzle piece based on the provided parameters. The shouldRepaint method determines whether the painting needs to be updated, and in this case, it always returns false. Overall, this code segment encapsulates the logic for painting a custom puzzle piece within a Flutter application using the CustomPainter class.</p><pre>class SliderController {<br>  late Offset? Function() create;<br>}<br><br>double answerX = 0;<br><br>class SliderCaptcha extends StatefulWidget {<br>  const SliderCaptcha({<br>    required this.image,<br>    required this.onConfirm,<br>    this.title = &#39;Slide to authenticate&#39;,<br>    this.titleStyle,<br>    this.captchaSize = 30,<br>    this.colorBar = Colors.red,<br>    this.colorCaptChar = Colors.blue,<br>    this.controller,<br>    this.borderImager = 0,<br>    this.imageToBarPadding = 3,<br>    this.slideContainerDecoration,<br>    this.icon,<br>    Key? key,<br>  })  : assert(0 &lt;= borderImager &amp;&amp; borderImager &lt;= 5),<br>        super(key: key);<br>  final Widget image;<br>  final Future&lt;void&gt; Function(bool value)? onConfirm;<br>  final String title;<br>  final TextStyle? titleStyle;<br>  final Color colorBar;<br>  final Color colorCaptChar;<br>  final double captchaSize;<br>  final Widget? icon;<br>  final Decoration? slideContainerDecoration;<br>  final SliderController? controller;<br>  final double imageToBarPadding;<br>  final double borderImager;<br><br>  @override<br>  State&lt;SliderCaptcha&gt; createState() =&gt; _SliderCaptchaState();<br>}<br><br>class _SliderCaptchaState extends State&lt;SliderCaptcha&gt;<br>    with SingleTickerProviderStateMixin {<br>  double heightSliderBar = 50;<br>  double _offsetMove = 0;<br>  double answerY = 0;<br>  bool isLock = false;<br>  SliderController controller = SliderController();<br>  SliderController unController = SliderController();<br>  late Animation&lt;double&gt; animation;<br>  late AnimationController animationController;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return ConstrainedBox(<br>      constraints: const BoxConstraints(maxWidth: 500),<br>      child: Column(<br>        mainAxisAlignment: MainAxisAlignment.start,<br>        crossAxisAlignment: CrossAxisAlignment.center,<br>        mainAxisSize: MainAxisSize.min,<br>        children: [<br>          Flexible(<br>            child: ClipRRect(<br>              borderRadius: BorderRadius.circular(widget.borderImager),<br>              child: SliderCaptCha(<br>                image: widget.image,<br>                offsetX: _offsetMove,<br>                offsetY: answerX,<br>                colorCaptChar: widget.colorCaptChar,<br>                sliderController: unController,<br>              ),<br>            ),<br>          ),<br>          SizedBox(height: widget.imageToBarPadding),<br>          Container(<br>            height: heightSliderBar,<br>            width: double.infinity,<br>            decoration: BoxDecoration(<br>              color: widget.colorBar,<br>              boxShadow: const &lt;BoxShadow&gt;[<br>                BoxShadow(<br>                  offset: Offset(0, 0),<br>                  blurRadius: 2,<br>                  color: Colors.grey,<br>                )<br>              ],<br>            ),<br>            child: Stack(<br>              children: &lt;Widget&gt;[<br>                Center(<br>                  child: Text(<br>                    widget.title,<br>                    style: widget.titleStyle,<br>                    textAlign: TextAlign.center,<br>                  ),<br>                ),<br>                Positioned(<br>                  left: _offsetMove,<br>                  top: 0,<br>                  height: 50,<br>                  width: 50,<br>                  child: GestureDetector(<br>                    onHorizontalDragStart: (detail) =&gt;<br>                        _onDragStart(context, detail),<br>                    onHorizontalDragUpdate: (DragUpdateDetails detail) {<br>                      _onDragUpdate(context, detail);<br>                    },<br>                    onHorizontalDragEnd: (DragEndDetails detail) {<br>                      checkAnswer();<br>                    },<br>                    child: Container(<br>                      height: heightSliderBar,<br>                      width: heightSliderBar,<br>                      margin: const EdgeInsets.all(4),<br>                      decoration: widget.slideContainerDecoration ??<br>                          BoxDecoration(<br>                            borderRadius: BorderRadius.circular(5),<br>                            color: Colors.white,<br>                          ),<br>                      child: widget.icon ??<br>                          const Icon(Icons.arrow_forward_rounded),<br>                    ),<br>                  ),<br>                ),<br>              ],<br>            ),<br>          )<br>        ],<br>      ),<br>    );<br>  }<br><br>  void _onDragStart(BuildContext context, DragStartDetails start) {<br>    if (isLock) {<br>      return;<br>    }<br>    setState(() {<br>      RenderBox getBox = context.findRenderObject() as RenderBox;<br>      var local = getBox.globalToLocal(start.globalPosition);<br>      _offsetMove = local.dx - heightSliderBar / 2;<br>    });<br>  }<br><br>  _onDragUpdate(BuildContext context, DragUpdateDetails update) {<br>    if (isLock) {<br>      return;<br>    }<br>    RenderBox getBox = context.findRenderObject() as RenderBox;<br>    var local = getBox.globalToLocal(update.globalPosition);<br><br>    if (local.dx &lt; 0) {<br>      setState(() {<br>        _offsetMove = 0;<br>      });<br>      return;<br>    }<br><br>    if (local.dx &gt; getBox.size.width) {<br>      setState(() {<br>        _offsetMove = getBox.size.width - heightSliderBar;<br>      });<br>      return;<br>    }<br><br>    setState(() {<br>      _offsetMove = local.dx - heightSliderBar / 2;<br>    });<br>  }<br><br>  @override<br>  void initState() {<br>    super.initState();<br>    if (widget.controller == null) {<br>      controller = SliderController();<br>    } else {<br>      controller = widget.controller!;<br>    }<br><br>    controller.create = create;<br><br>    animationController = AnimationController(<br>      duration: const Duration(milliseconds: 500),<br>      vsync: this,<br>    );<br><br>    animation = Tween&lt;double&gt;(begin: 1, end: 0).animate(animationController)<br>      ..addListener(() {<br>        setState(() {<br>          _offsetMove = _offsetMove * animation.value;<br>        });<br>      })<br>      ..addStatusListener((status) {<br>        if (status == AnimationStatus.completed) {<br>          animationController.reset();<br>        }<br>      });<br>  }<br><br>  @override<br>  void dispose() {<br>    animationController.dispose();<br>    super.dispose();<br>  }<br><br>  @override<br>  void didChangeDependencies() {<br>    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {<br>      setState(() {<br>        controller.create.call();<br>      });<br>    });<br>    super.didChangeDependencies();<br>  }<br><br>  void onUpdate(double d) {<br>    setState(() {<br>      _offsetMove = d;<br>    });<br>  }<br><br>  Future&lt;void&gt; checkAnswer() async {<br>    if (isLock) {<br>      return;<br>    }<br>    isLock = true;<br><br>    if (_offsetMove &lt; answerX + 10 &amp;&amp; _offsetMove &gt; answerX - 10) {<br>      await widget.onConfirm?.call(true);<br>    } else {<br>      await widget.onConfirm?.call(false);<br>    }<br>    isLock = false;<br>  }<br><br>  Offset? create() {<br>    animationController.forward().then((value) {<br>      setState(() {<br>        Offset? offset = unController.create.call();<br>        answerX = offset?.dx ?? 0;<br>        answerY = offset?.dy ?? 0;<br>      });<br>    });<br>    return null;<br>  }<br>}</pre><p>SliderCaptcha Class:</p><ul><li>This class extends StatefulWidget, indicating that it can hold mutable state.</li><li>It has several properties defined in its constructor, including:</li><li>image: The image used in the CAPTCHA interface.</li><li>onConfirm: A callback function invoked when the user confirms their action.</li><li>title: The title text displayed in the CAPTCHA interface.</li><li>colorBar: The color of the slider bar.</li><li>colorCaptChar: The color of the CAPTCHA characters.</li><li>controller: A controller for managing the CAPTCHA animation.</li><li>Other properties for customization such as captchaSize, titleStyle, icon, etc.</li></ul><p>_SliderCaptchaState Class:</p><ul><li>This class extends State&lt;_SliderCaptchaState&gt; and implements the state for the SliderCaptcha widget.</li><li>It manages the state of the widget, including the position of the slider (_offsetMove), animation controllers, and other variables used in the CAPTCHA logic.</li></ul><p>build Method:</p><ul><li>This method overrides the build method from the State class and returns the widget hierarchy to be rendered.</li><li>It constructs the UI of the CAPTCHA interface, including the image, slider bar, title text, and slider button.</li></ul><p>Event Handlers:</p><ul><li>_onDragStart, _onDragUpdate, and checkAnswer methods handle user interactions with the slider button, such as drag start, drag update, and drag end.</li><li>These methods update the _offsetMove variable to reflect the position of the slider button and verify the user&#39;s action against the correct answer.</li></ul><p>Animation:</p><ul><li>The widget uses animation controllers (animationController) and animations (animation) to animate the slider button.</li><li>The create method triggers the animation when the widget is created, animating the slider button to its initial position.</li></ul><p>Lifecycle Methods:</p><ul><li>initState initializes the widget state, including animation controllers and listeners.</li><li>dispose disposes of resources when the widget is removed from the widget tree.</li><li>didChangeDependencies is called when the dependencies of the widget change.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*qxlAaHCE9ZHb_33hO0KhRA.gif" /></figure><pre><br>typedef SliderCreate = Offset? Function();<br><br>class SliderCaptCha extends SingleChildRenderObjectWidget {<br>  final Widget image;<br>  final double offsetX;<br>  final double offsetY;<br>  final Color colorCaptChar;<br>  final double sizeCaptChar;<br>  final SliderController sliderController;<br><br>  const SliderCaptCha({<br>    required this.image,<br>    required this.offsetX,<br>    required this.offsetY,<br>    this.sizeCaptChar = 40,<br>    this.colorCaptChar = Colors.blue,<br>    required this.sliderController,<br>    Key? key,<br>  }) : super(key: key, child: image);<br><br>  @override<br>  RenderObject createRenderObject(BuildContext context) {<br>    final renderObject = RenderTestSliderCaptChar();<br>    sliderController.create = renderObject.create;<br>    renderObject.offsetX = offsetX;<br>    renderObject.offsetY = offsetY;<br>    renderObject.colorCaptChar = colorCaptChar;<br>    renderObject.sizeCaptChar = sizeCaptChar;<br>    renderObject.colorCaptChar = colorCaptChar;<br>    return renderObject;<br>  }<br><br>  @override<br>  void updateRenderObject(context, RenderTestSliderCaptChar renderObject) {<br>    renderObject.offsetX = offsetX;<br>    renderObject.offsetY = offsetY;<br>    renderObject.colorCaptChar = colorCaptChar;<br>    renderObject.sizeCaptChar = sizeCaptChar;<br>    renderObject.colorCaptChar = colorCaptChar;<br>    super.updateRenderObject(context, renderObject);<br>  }<br>}<br><br>class RenderTestSliderCaptChar extends RenderProxyBox {<br>  double sizeCaptChar = 40;<br>  double strokeWidth = 3;<br>  double offsetX = 0;<br>  double offsetY = 0;<br>  double createX = 0;<br>  double createY = 0;<br>  Color colorCaptChar = Colors.black;<br><br>  @override<br>  void paint(PaintingContext context, Offset offset) {<br>    if (child == null) {<br>      return;<br>    }<br>    context.paintChild(child!, offset);<br>    if (!(child!.size.width &gt; 0 &amp;&amp; child!.size.height &gt; 0)) {<br>      return;<br>    }<br><br>    Paint paint = Paint()<br>      ..color = colorCaptChar<br>      ..strokeWidth = strokeWidth;<br><br>    if (createX == 0 &amp;&amp; createY == 0) {<br>      return;<br>    }<br><br>    context.canvas.drawPath(<br>      getPiecePathCustom(<br>        size,<br>        strokeWidth + offset.dx + createX.toDouble(),<br>        offset.dy + createY.toDouble(),<br>        sizeCaptChar,<br>      ),<br>      paint..style = PaintingStyle.fill,<br>    );<br><br>    context.canvas.drawPath(<br>      getPiecePathCustom(<br>        Size(size.width - strokeWidth, size.height - strokeWidth),<br>        strokeWidth + offset.dx + offsetX,<br>        offset.dy + createY,<br>        sizeCaptChar,<br>      ),<br>      paint..style = PaintingStyle.stroke,<br>    );<br><br>    layer = context.pushClipPath(<br>      needsCompositing,<br>      Offset(-createX + offsetX + offset.dx + strokeWidth, offset.dy),<br>      Offset.zero &amp; size,<br>      getPiecePathCustom(<br>        size,<br>        createX,<br>        createY.toDouble(),<br>        sizeCaptChar,<br>      ),<br>      (context, offset) {<br>        context.paintChild(child!, offset);<br>      },<br>      oldLayer: layer as ClipPathLayer?,<br>    );<br>  }<br><br>  @override<br>  void performLayout() {<br>    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {<br>      /// tam fix<br>      if (createX != 0 &amp;&amp; createY != 0) {<br>        return;<br>      }<br>      create();<br>      markNeedsPaint();<br>    });<br><br>    super.performLayout();<br>  }<br><br>  Offset? create() {<br>    if (size == Size.zero) {<br>      return null;<br>    }<br>    createX = sizeCaptChar +<br>        Random().nextInt((size.width - 2.5 * sizeCaptChar).toInt());<br>    answerX = createX;<br>    createY = 0.0 + Random().nextInt((size.height - sizeCaptChar).toInt());<br>    markNeedsPaint();<br>    return Offset(createX, createY);<br>  }<br>}</pre><p>SliderCaptCha Class:</p><ul><li>This class is a custom widget that extends SingleChildRenderObjectWidget, indicating that it has a single child rendered by a custom render object.</li><li>It takes parameters such as image, offsetX, offsetY, sizeCaptChar, colorCaptChar, and sliderController.</li><li>The createRenderObject method creates and returns an instance of RenderTestSliderCaptChar, setting its properties based on the provided parameters.</li><li>The updateRenderObject method updates the properties of the RenderTestSliderCaptChar object when the widget is updated.</li></ul><p>RenderTestSliderCaptChar Class:</p><ul><li>This class extends RenderProxyBox, which is a base class for render objects that have a single child render object.</li><li>It defines properties like sizeCaptChar, strokeWidth, offsetX, offsetY, createX, createY, and colorCaptChar to manage the rendering of the slider CAPTCHA.</li><li>The paint method is responsible for painting the CAPTCHA on the canvas. It draws the slider button and the CAPTCHA characters using custom paths.</li><li>The performLayout method is called to perform layout calculations and is overridden here to initialize the CAPTCHA rendering when the widget is first laid out.</li><li>The create method generates random coordinates for the CAPTCHA characters and marks the widget as needing to be repainted.</li></ul><h3>Summary</h3><p>In this Flutter code segment, two classes, SliderCaptCha and RenderTestSliderCaptChar, collaborate to create a custom slider-based CAPTCHA widget.</p><ul><li>SliderCaptCha is a custom widget that extends SingleChildRenderObjectWidget. It handles parameters like the image, offsets, size, colors, and controller. This class manages the creation and update of the render object responsible for rendering the CAPTCHA.</li><li>RenderTestSliderCaptChar extends RenderProxyBox and manages the rendering logic for the slider CAPTCHA. It defines properties for size, offsets, stroke width, and color. The paint method draws the slider button and CAPTCHA characters on the canvas, and the performLayout method initializes CAPTCHA rendering during layout. Additionally, the create method generates random coordinates for the CAPTCHA characters.</li></ul><h4>Full Source Code</h4><pre>import &#39;dart:math&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter/rendering.dart&#39;;<br><br>class SliderController {<br>  late Offset? Function() create;<br>}<br><br>double answerX = 0;<br><br>class SliderCaptcha extends StatefulWidget {<br>  const SliderCaptcha({<br>    required this.image,<br>    required this.onConfirm,<br>    this.title = &#39;Slide to authenticate&#39;,<br>    this.titleStyle,<br>    this.captchaSize = 30,<br>    this.colorBar = Colors.red,<br>    this.colorCaptChar = Colors.blue,<br>    this.controller,<br>    this.borderImager = 0,<br>    this.imageToBarPadding = 3,<br>    this.slideContainerDecoration,<br>    this.icon,<br>    Key? key,<br>  })  : assert(0 &lt;= borderImager &amp;&amp; borderImager &lt;= 5),<br>        super(key: key);<br>  final Widget image;<br>  final Future&lt;void&gt; Function(bool value)? onConfirm;<br>  final String title;<br>  final TextStyle? titleStyle;<br>  final Color colorBar;<br>  final Color colorCaptChar;<br>  final double captchaSize;<br>  final Widget? icon;<br>  final Decoration? slideContainerDecoration;<br>  final SliderController? controller;<br>  final double imageToBarPadding;<br>  final double borderImager;<br><br>  @override<br>  State&lt;SliderCaptcha&gt; createState() =&gt; _SliderCaptchaState();<br>}<br><br>class _SliderCaptchaState extends State&lt;SliderCaptcha&gt;<br>    with SingleTickerProviderStateMixin {<br>  double heightSliderBar = 50;<br>  double _offsetMove = 0;<br>  double answerY = 0;<br>  bool isLock = false;<br>  SliderController controller = SliderController();<br>  SliderController unController = SliderController();<br>  late Animation&lt;double&gt; animation;<br>  late AnimationController animationController;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return ConstrainedBox(<br>      constraints: const BoxConstraints(maxWidth: 500),<br>      child: Column(<br>        mainAxisAlignment: MainAxisAlignment.start,<br>        crossAxisAlignment: CrossAxisAlignment.center,<br>        mainAxisSize: MainAxisSize.min,<br>        children: [<br>          Flexible(<br>            child: ClipRRect(<br>              borderRadius: BorderRadius.circular(widget.borderImager),<br>              child: SliderCaptCha(<br>                image: widget.image,<br>                offsetX: _offsetMove,<br>                offsetY: answerX,<br>                colorCaptChar: widget.colorCaptChar,<br>                sliderController: unController,<br>              ),<br>            ),<br>          ),<br>          SizedBox(height: widget.imageToBarPadding),<br>          Container(<br>            height: heightSliderBar,<br>            width: double.infinity,<br>            decoration: BoxDecoration(<br>              color: widget.colorBar,<br>              boxShadow: const &lt;BoxShadow&gt;[<br>                BoxShadow(<br>                  offset: Offset(0, 0),<br>                  blurRadius: 2,<br>                  color: Colors.grey,<br>                )<br>              ],<br>            ),<br>            child: Stack(<br>              children: &lt;Widget&gt;[<br>                Center(<br>                  child: Text(<br>                    widget.title,<br>                    style: widget.titleStyle,<br>                    textAlign: TextAlign.center,<br>                  ),<br>                ),<br>                Positioned(<br>                  left: _offsetMove,<br>                  top: 0,<br>                  height: 50,<br>                  width: 50,<br>                  child: GestureDetector(<br>                    onHorizontalDragStart: (detail) =&gt;<br>                        _onDragStart(context, detail),<br>                    onHorizontalDragUpdate: (DragUpdateDetails detail) {<br>                      _onDragUpdate(context, detail);<br>                    },<br>                    onHorizontalDragEnd: (DragEndDetails detail) {<br>                      checkAnswer();<br>                    },<br>                    child: Container(<br>                      height: heightSliderBar,<br>                      width: heightSliderBar,<br>                      margin: const EdgeInsets.all(4),<br>                      decoration: widget.slideContainerDecoration ??<br>                          BoxDecoration(<br>                            borderRadius: BorderRadius.circular(5),<br>                            color: Colors.white,<br>                          ),<br>                      child: widget.icon ??<br>                          const Icon(Icons.arrow_forward_rounded),<br>                    ),<br>                  ),<br>                ),<br>              ],<br>            ),<br>          )<br>        ],<br>      ),<br>    );<br>  }<br><br>  void _onDragStart(BuildContext context, DragStartDetails start) {<br>    if (isLock) {<br>      return;<br>    }<br>    setState(() {<br>      RenderBox getBox = context.findRenderObject() as RenderBox;<br>      var local = getBox.globalToLocal(start.globalPosition);<br>      _offsetMove = local.dx - heightSliderBar / 2;<br>    });<br>  }<br><br>  _onDragUpdate(BuildContext context, DragUpdateDetails update) {<br>    if (isLock) {<br>      return;<br>    }<br>    RenderBox getBox = context.findRenderObject() as RenderBox;<br>    var local = getBox.globalToLocal(update.globalPosition);<br><br>    if (local.dx &lt; 0) {<br>      setState(() {<br>        _offsetMove = 0;<br>      });<br>      return;<br>    }<br><br>    if (local.dx &gt; getBox.size.width) {<br>      setState(() {<br>        _offsetMove = getBox.size.width - heightSliderBar;<br>      });<br>      return;<br>    }<br><br>    setState(() {<br>      _offsetMove = local.dx - heightSliderBar / 2;<br>    });<br>  }<br><br>  @override<br>  void initState() {<br>    super.initState();<br>    if (widget.controller == null) {<br>      controller = SliderController();<br>    } else {<br>      controller = widget.controller!;<br>    }<br><br>    controller.create = create;<br><br>    animationController = AnimationController(<br>      duration: const Duration(milliseconds: 500),<br>      vsync: this,<br>    );<br><br>    animation = Tween&lt;double&gt;(begin: 1, end: 0).animate(animationController)<br>      ..addListener(() {<br>        setState(() {<br>          _offsetMove = _offsetMove * animation.value;<br>        });<br>      })<br>      ..addStatusListener((status) {<br>        if (status == AnimationStatus.completed) {<br>          animationController.reset();<br>        }<br>      });<br>  }<br><br>  @override<br>  void dispose() {<br>    animationController.dispose();<br>    super.dispose();<br>  }<br><br>  @override<br>  void didChangeDependencies() {<br>    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {<br>      setState(() {<br>        controller.create.call();<br>      });<br>    });<br>    super.didChangeDependencies();<br>  }<br><br>  void onUpdate(double d) {<br>    setState(() {<br>      _offsetMove = d;<br>    });<br>  }<br><br>  Future&lt;void&gt; checkAnswer() async {<br>    if (isLock) {<br>      return;<br>    }<br>    isLock = true;<br><br>    if (_offsetMove &lt; answerX + 10 &amp;&amp; _offsetMove &gt; answerX - 10) {<br>      await widget.onConfirm?.call(true);<br>    } else {<br>      await widget.onConfirm?.call(false);<br>    }<br>    isLock = false;<br>  }<br><br>  Offset? create() {<br>    animationController.forward().then((value) {<br>      setState(() {<br>        Offset? offset = unController.create.call();<br>        answerX = offset?.dx ?? 0;<br>        answerY = offset?.dy ?? 0;<br>      });<br>    });<br>    return null;<br>  }<br>}<br><br>typedef SliderCreate = Offset? Function();<br><br>class SliderCaptCha extends SingleChildRenderObjectWidget {<br>  final Widget image;<br>  final double offsetX;<br>  final double offsetY;<br>  final Color colorCaptChar;<br>  final double sizeCaptChar;<br>  final SliderController sliderController;<br><br>  const SliderCaptCha({<br>    required this.image,<br>    required this.offsetX,<br>    required this.offsetY,<br>    this.sizeCaptChar = 40,<br>    this.colorCaptChar = Colors.blue,<br>    required this.sliderController,<br>    Key? key,<br>  }) : super(key: key, child: image);<br><br>  @override<br>  RenderObject createRenderObject(BuildContext context) {<br>    final renderObject = RenderTestSliderCaptChar();<br>    sliderController.create = renderObject.create;<br>    renderObject.offsetX = offsetX;<br>    renderObject.offsetY = offsetY;<br>    renderObject.colorCaptChar = colorCaptChar;<br>    renderObject.sizeCaptChar = sizeCaptChar;<br>    renderObject.colorCaptChar = colorCaptChar;<br>    return renderObject;<br>  }<br><br>  @override<br>  void updateRenderObject(context, RenderTestSliderCaptChar renderObject) {<br>    renderObject.offsetX = offsetX;<br>    renderObject.offsetY = offsetY;<br>    renderObject.colorCaptChar = colorCaptChar;<br>    renderObject.sizeCaptChar = sizeCaptChar;<br>    renderObject.colorCaptChar = colorCaptChar;<br>    super.updateRenderObject(context, renderObject);<br>  }<br>}<br><br>class RenderTestSliderCaptChar extends RenderProxyBox {<br>  double sizeCaptChar = 40;<br>  double strokeWidth = 3;<br>  double offsetX = 0;<br>  double offsetY = 0;<br>  double createX = 0;<br>  double createY = 0;<br>  Color colorCaptChar = Colors.black;<br><br>  @override<br>  void paint(PaintingContext context, Offset offset) {<br>    if (child == null) {<br>      return;<br>    }<br>    context.paintChild(child!, offset);<br>    if (!(child!.size.width &gt; 0 &amp;&amp; child!.size.height &gt; 0)) {<br>      return;<br>    }<br><br>    Paint paint = Paint()<br>      ..color = colorCaptChar<br>      ..strokeWidth = strokeWidth;<br><br>    if (createX == 0 &amp;&amp; createY == 0) {<br>      return;<br>    }<br><br>    context.canvas.drawPath(<br>      getPiecePathCustom(<br>        size,<br>        strokeWidth + offset.dx + createX.toDouble(),<br>        offset.dy + createY.toDouble(),<br>        sizeCaptChar,<br>      ),<br>      paint..style = PaintingStyle.fill,<br>    );<br><br>    context.canvas.drawPath(<br>      getPiecePathCustom(<br>        Size(size.width - strokeWidth, size.height - strokeWidth),<br>        strokeWidth + offset.dx + offsetX,<br>        offset.dy + createY,<br>        sizeCaptChar,<br>      ),<br>      paint..style = PaintingStyle.stroke,<br>    );<br><br>    layer = context.pushClipPath(<br>      needsCompositing,<br>      Offset(-createX + offsetX + offset.dx + strokeWidth, offset.dy),<br>      Offset.zero &amp; size,<br>      getPiecePathCustom(<br>        size,<br>        createX,<br>        createY.toDouble(),<br>        sizeCaptChar,<br>      ),<br>      (context, offset) {<br>        context.paintChild(child!, offset);<br>      },<br>      oldLayer: layer as ClipPathLayer?,<br>    );<br>  }<br><br>  @override<br>  void performLayout() {<br>    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {<br>      /// tam fix<br>      if (createX != 0 &amp;&amp; createY != 0) {<br>        return;<br>      }<br>      create();<br>      markNeedsPaint();<br>    });<br><br>    super.performLayout();<br>  }<br><br>  Offset? create() {<br>    if (size == Size.zero) {<br>      return null;<br>    }<br>    createX = sizeCaptChar +<br>        Random().nextInt((size.width - 2.5 * sizeCaptChar).toInt());<br>    answerX = createX;<br>    createY = 0.0 + Random().nextInt((size.height - sizeCaptChar).toInt());<br>    markNeedsPaint();<br>    return Offset(createX, createY);<br>  }<br>}<br><br>class PuzzlePiecePainter extends CustomPainter {<br>  PuzzlePiecePainter(<br>    this.width,<br>    this.height,<br>    this.offsetX,<br>    this.offsetY, {<br>    this.paintingStyle = PaintingStyle.stroke,<br>  });<br>  final double width;<br>  final double height;<br>  final double offsetX;<br>  final double offsetY;<br>  final PaintingStyle paintingStyle;<br><br>  @override<br>  Future&lt;void&gt; paint(Canvas canvas, Size size) async {<br>    final Paint paint = Paint()<br>      ..color = Colors.blue<br>      ..style = paintingStyle<br>      ..strokeWidth = 3.0;<br><br>    canvas.drawPath(getPiecePathCustom(size, offsetX, offsetY, width), paint);<br>  }<br><br>  @override<br>  bool shouldRepaint(CustomPainter oldDelegate) =&gt; false;<br>}<br><br>Path getPiecePathCustom(<br>    Size size, double offsetX, double offsetY, double sizePart) {<br>  final double bumpSize = sizePart / 4;<br>  Path path = Path();<br>  path.moveTo(offsetX, offsetY);<br>  path.lineTo(offsetX + sizePart / 3, offsetY);<br>  path.cubicTo(<br>    offsetX + sizePart / 6,<br>    offsetY + bumpSize,<br>    offsetX + sizePart / 6 * 5,<br>    offsetY + bumpSize,<br>    offsetX + sizePart / 3 * 2,<br>    offsetY,<br>  );<br>  path.lineTo(offsetX + sizePart, offsetY);<br>  path.lineTo(offsetX + sizePart, offsetY + sizePart / 3);<br>  path.cubicTo(<br>      offsetX + sizePart + bumpSize,<br>      offsetY + sizePart / 6,<br>      offsetX + sizePart + bumpSize,<br>      offsetY + sizePart / 6 * 5,<br>      offsetX + sizePart,<br>      offsetY + sizePart / 3 * 2);<br>  path.lineTo(offsetX + sizePart, offsetY + sizePart);<br>  path.lineTo(offsetX + sizePart / 3 * 2, offsetY + sizePart);<br>  path.lineTo(offsetX, offsetY + sizePart);<br>  path.lineTo(offsetX, offsetY + sizePart / 3 * 2);<br>  path.cubicTo(<br>      offsetX + bumpSize,<br>      offsetY + sizePart / 6 * 5,<br>      offsetX + bumpSize,<br>      offsetY + sizePart / 6,<br>      offsetX,<br>      offsetY + sizePart / 3);<br>  path.close();<br>  return path;<br>}<br><br>class PuzzlePieceClipper extends CustomClipper&lt;Path&gt; {<br>  PuzzlePieceClipper(this.height, this.width, this.x, this.y);<br>  final double width;<br>  final double height;<br>  final double x;<br>  final double y;<br>  @override<br>  Path getClip(Size size) {<br>    return getPiecePathCustom(size, x, y, width);<br>  }<br><br>  @override<br>  bool shouldReclip(CustomClipper&lt;Path&gt; oldClipper) =&gt; true;<br>}</pre><h3>Project GitHub</h3><p><a href="https://github.com/AungYeZawDev/slider_recaptcha">GitHub - AungYeZawDev/slider_recaptcha: This Flutter project implements a customizable slider CAPTCHA widget for mobile applications. Users slide a button to confirm identity. The widget is highly configurable, enhancing security and user experience.</a></p><h3>Reference</h3><p><a href="https://pub.dev/packages/slider_captcha">slider_captcha | Flutter package</a></p><p><a href="https://www.linkedin.com/in/aungyezawdev/">https://www.linkedin.com/in/aungyezawdev/</a></p><p><a href="https://wa.me/qr/4DG624MHWEXJO1">Share on WhatsApp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecafc7740a6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>