Skip to content

Conversation

@kyleswank
Copy link

Co-authored-by: Tate [email protected]

💡 Motivation and Context

This was written by Tate, but due to our projects not having the ability to allow external contributors at the moment I am sort of sponsoring this. I'll let Tate explain:

Goals:
Unifying styling in PostHog Flutter SDK and fix bug where some text inherits its color directly from app context, while other elements have hard-coded colors, frequently creating invisible text within PostHog surveys.

Overview of changes:
Briefly, I tried to preserve the current theming behavior of the PostHog surveys in Flutter while unifying all the style information into survey_appearance.dart​ and providing more comprehensive coverage of theme elements to avoid cases of, e.g., invisible text.
Since directly changing the theme of surveys is supposed to be behind a paywall, I simply added more theme coverage (to hopefully include colors of all the elements that could possibly appear in a survey, especially text). For perfect functionality, you will need to update the Web UI to include theming options for the elements that were previously not covered. When you do this, you will need to update Appearance​ to receive those theme options from the PostHog API (see below for details).

Detailed changes

  • Centralized all color definitions to SurveyAppearance​ class.
  • Added color definitions for (hopefully) all elements that appear in surveys.
  • SurveyAppearance​ color definitions are no longer nullable and are initialized with the defaults that previously appeared dispersed amongst many files.
  • The following had color definitions buried in other files. I extracted them and moved them to SurveyAppearance​:
    • backgroundColor​ - white
    • descriptionTextColor​ - black
    • ratingButtonColor​ - Color(0xFFEEEEEE)
    • ratingButtonActiveColor​ - black
    • borderColor​ - Color(0xFFBDBDBD)
  • New color definition coverage (need to be added to theme options in Web UI for surveys which is currently behind a paywall). These were previously inherited from the app context, therefore creating invisible text in many cases, especially with light-colored text:
    • questionTextColor​ - black
    • closeButtonColor​ - black
    • ratingButtonSelectedTextColor​ - white
    • ratingButtonUnselectedTextColor​ - black with 50% alpha
    • inputBackgroundColor​ - white
    • inputTextcolor​ - black [This is the bug I came here to fix!!!]
    • inputPlaceholderColor​ - Color(0xFF757575)
    • choiceButtonBorderColor​ - black
    • choiceButtonTextColor​ - black
  • I removed the ?? Colors.[color]​ (null coalescing) blocks from the following files:
    • survey_bottom_sheet.dart​
    • question_header.dart​
    • number_rating_button.dart​
    • rating_icons.dart​
  • I removed hardcoded colors from these files, instead using definitions in SurveyAppearance​
    • survey_choice_button.dart​
    • open_text_question.dart​
    • rating_question.dart
  • Necessary updates to Web theme UI
    • Color options to add
      • Question text color
      • Input text color
      • Choice button color
      • Close button color
      • Description text color
      • Rating button color
      • Rating button active color

Summary of remaining issues:

image-2

💚 How did you test it?

I, Kyle, modified the style of the example app on iOS and tested against a sample survey of varying colors and styles.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

@kyleswank kyleswank requested a review from a team as a code owner December 11, 2025 14:00
@github-actions
Copy link

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Next" section. Make sure the entry includes this PR's number.
Example:

## Next
- Improve consistency when handling colors in surveys ([#233](https://github.com/PostHog/posthog-flutter/pull/233))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 3e75325

@kyleswank kyleswank requested a review from a team December 11, 2025 16:26
@ioannisj
Copy link
Collaborator

@PostHog/team-surveys hey guys, since you recently worked on themes for react-native, mind taking a look at this as well?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants