Skip to content

Conversation

Robert-SD
Copy link
Collaborator

No description provided.

RahmiTufanoglu and others added 5 commits July 24, 2025 09:58
The AdyenCardComponent has been refactored from a StatelessWidget to a StatefulWidget. This change allows for better state management, particularly for the asynchronous fetching of the SDK version number.

The build logic has been streamlined by:
- Moving the SDK version number fetching to `initState`.
- Introducing dedicated internal widgets (`_CardSessionFlowWidget` and `_CardAdvancedFlowWidget`) to handle the different checkout flows (Session and Advanced). This separation improves code organization and makes the main build method cleaner.
- The `_determineInitialHeight` method and its platform-specific helpers remain, but their usage is now within the context of the new stateful widget structure.

These changes enhance the component's maintainability and readability without altering its core functionality.
…owWidget

The `AdyenCardComponent` now directly returns either `CardSessionComponent` or `CardAdvancedComponent` based on the checkout type, simplifying the widget tree.
The `super.initState()` call was moved before widget-specific initialization in `BaseCardComponent` to ensure the base class is properly initialized first.
The loading widget for the CardComponent has been refactored for better readability and conciseness.
The separate `_buildLoadingWidget` method has been removed, and its logic is now inline using a switch expression.
This change maintains the existing behavior of showing a `CircularProgressIndicator` on Android and an empty `SizedBox` on other platforms.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @Robert-SD, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the internal structure and readability of the AdyenCardComponent and related UI components. The changes aim to improve the maintainability and clarity of the codebase by adopting more idiomatic Flutter patterns for state management and UI rendering, without altering the external behavior or functionality of the payment components.

Highlights

  • AdyenCardComponent refactoring: The AdyenCardComponent has been refactored from a StatelessWidget to a StatefulWidget, improving its ability to manage internal state and lifecycle events. This change streamlines the component's logic and enhances maintainability.
  • Code simplification: Several helper methods within AdyenCardComponent and CardComponentContainer have been removed, with their logic inlined directly into the build methods or relevant sections. This reduces indirection and makes the code flow more straightforward.
  • Improved platform-specific rendering: The logic for determining initial view heights and displaying loading indicators has been simplified using Dart's switch expressions, leading to more concise and readable code for platform-specific UI adjustments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the AdyenCardComponent to a StatefulWidget for better performance and improves the code structure using modern Dart syntax. While the refactoring is generally well-executed and enhances readability, a critical regression was introduced. The onBinLookup and onBinValue callbacks are no longer passed to the underlying card components, which would break functionality for users relying on these callbacks. I've provided a suggestion to fix this issue.

Copy link

github-actions bot commented Sep 8, 2025

LCOV of commit f3cb9ac during Check PR #1392

Summary coverage rate:
  lines......: 8.5% (136 of 1592 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate:
                                                                                                |Lines       |Functions  |Branches    
  Filename                                                                                      |Rate     Num|Rate    Num|Rate     Num
  ====================================================================================================================================
  lib/src/components/card/adyen_card_component.dart                                             |    -      0|    -     0|    -      0
  lib/src/components/card/base_card_component.dart                                              |    -      0|    -     0|    -      0
  lib/src/components/card/card_component_container.dart                                         |    -      0|    -     0|    -      0

@Robert-SD
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the AdyenCardComponent by refactoring it from a StatelessWidget to a StatefulWidget. This correctly handles the asynchronous fetching of the SDK version, preventing unnecessary calls on each rebuild and improving performance. The code has also been made more readable and modern by using switch expressions and inlining helper methods. Overall, these are excellent changes that enhance code quality and maintainability. I have added one suggestion to further improve the user experience by displaying a consistent loading indicator.

Copy link

github-actions bot commented Sep 8, 2025

LCOV of commit bbf1d2b during Check PR #1395

Summary coverage rate:
  lines......: 8.5% (136 of 1596 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate:
                                                                                                |Lines       |Functions  |Branches    
  Filename                                                                                      |Rate     Num|Rate    Num|Rate     Num
  ====================================================================================================================================
  lib/src/components/card/adyen_card_component.dart                                             |    -      0|    -     0|    -      0
  lib/src/components/card/base_card_component.dart                                              |    -      0|    -     0|    -      0
  lib/src/components/card/card_component_container.dart                                         |    -      0|    -     0|    -      0

Copy link

sonarqubecloud bot commented Sep 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants