Skip to content

Feature/ms 503 add properties to the sdk theme#24

Merged
vscmaster merged 8 commits into
mainfrom
feature/MS-503-Add-properties-to-the-SDK-theme
Apr 1, 2026
Merged

Feature/ms 503 add properties to the sdk theme#24
vscmaster merged 8 commits into
mainfrom
feature/MS-503-Add-properties-to-the-SDK-theme

Conversation

@vscmaster

Copy link
Copy Markdown
Contributor

@jab3z ready for review MS-503MS-503

@vscmaster

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Mar 30, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


Code Review

  • Gathering context
  • Reading changed files
  • Analyzing changes
  • Posting review

@vscmaster

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Mar 31, 2026

Copy link
Copy Markdown

Claude finished @vscmaster's task in 2m 42s —— View job


Code Review

  • Gathering context
  • Reading changed files
  • Analyzing changes
  • Posting review

Summary

This PR adds new theme properties to CheckoutTheme (paymentItemBackgroundColor, paymentItemDescriptionTextColor, selectorIconColor, savePhoneNumberIconColor, font selection for buttons) and wires them through the Android and iOS native layers. The Flutter-side changes look structurally sound, but there are several bugs and incomplete implementations that need attention before merging.


Bugs

1. ColorState.copyWith has inverted colorDisabled logic

checkout_theme.dart:188:

ColorState copyWith({Color? color, Color? colorDisabled}) {
  return ColorState(
    color: color ?? this.color,
    colorDisabled: this.colorDisabled ?? colorDisabled  // ← BUG: should be colorDisabled ?? this.colorDisabled
  );
}

The colorDisabled argument is silently ignored whenever this.colorDisabled is already set. Any call to copyWith(colorDisabled: newColor) on an instance that already has a colorDisabled value will produce the wrong result. Fix this →


2. iOS SwitchComponent.toCheckoutSwitch() is incomplete

ext.swift:237-255: Only checkedThumbTintColor is mapped — the other 5 properties (uncheckedThumbTintColor, checkedTrackTintColor, etc.) are dropped via a large commented-out block. This creates a silent Android/iOS divergence where Android applies all 6 switch colors and iOS only applies 1. The commented-out code shows this was never finished.


3. iOS TextFieldStyle.toCheckoutTextField() is incomplete

ext.swift:149-174: primaryColor, focusedColor, and error text styling are all commented out. Only text.textColor is partially applied. The Android equivalent maps all 5 fields. Again a silent platform divergence.


4. savePhoneNumberIconColor silently discarded on iOS

CheckoutPlatformView.swift:370-374:

if let color = theme?.savePhoneNumberIconColor?.toUIColors() {
    if let cc = color.color {
        //cht.savePhoneNumberIconColor = cc   ← commented out, never applied
    }
}

The color is parsed but then thrown away. This property has no effect on iOS. (Note: selectorIconColor has a similar redundant block at line 376 but is correctly applied at line 410.)


5. paymentItemDescriptionTextColor missing from Android appearanceDark

CheckoutView.kt:331-360: The appearanceDark block is an almost-exact copy of appearanceLight, but paymentItemDescriptionTextColor is omitted from dark mode. This means setting this color will have no effect when the device is in dark mode on Android.


6. Font family name transformation inconsistency between platforms

Extensions.kt:89: Android converts spaces to underscores ("My Font""my_font")
ext.swift:225: iOS converts spaces to hyphens ("My Font""My-Font")

The same theme JSON will resolve to different font resource names on each platform, making custom font selection unreliable. One or both platforms needs to be corrected to use the same convention.


Code Quality

7. Unguarded println in production code

Extensions.kt:90:

println("findFontResId, with name: $sanitized")

No debug/release guard. This will appear in production logcat for every font resolution call.

8. Dead code: String.toUIColor() nil check on non-optional

ext.swift:31-39: self != nil on a non-optional String is always true. This extension is either dead code or the guard is meaningless. Should be removed or simplified.

9. Large commented-out Color extension

ext.swift:114-147: ~35 lines of commented-out Color extension code should be removed rather than left as dead code in the repository.

10. TextStyle name shadows Flutter's built-in TextStyle

checkout_theme.dart:220: The local class TextStyle shadows flutter/material.dart's TextStyle. Since this file imports flutter/material.dart, any future code mixing the two types will be confusing and error-prone. Consider renaming to CheckoutTextStyle or similar.

11. BrandingPaymentMethods constructor missing tamara and jamiawallet

branding_options_request.dart:43-54: Both fields are declared but excluded from the constructor. They're mutable and set post-construction in home_screen_cubit.dart, but a complete constructor would be more consistent.


Android: Dark Mode Appearance is Identical to Light Mode

CheckoutView.kt:300-360: The appearanceDark block is a copy of appearanceLight with no separate dark-mode colors wired up. There is currently no way for a merchant to set different colors for dark mode vs. light mode — both appearances will always receive the same values. This may be intentional as a placeholder, but if so, it should be documented or the duplication should be eliminated.


Minor

  • pubspec.yaml SDK constraint bumped from ^3.6.0 to ^3.8.0 — confirm this is actually required by new code and not an accidental bump.
  • Sample/pubspec.yaml bumped to ^3.10.0 with Flutter >=3.38.0 — Flutter 3.38.0 is a very recent version constraint for a sample app that may limit contributors' ability to run it.

@vscmaster
vscmaster merged commit 51e3287 into main Apr 1, 2026
1 check passed
@vscmaster
vscmaster deleted the feature/MS-503-Add-properties-to-the-SDK-theme branch April 1, 2026 07:55
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.

3 participants