PostHog / PostHog/posthog-flutter

feat(surveys): Support custom fontFamily in survey appearance

Open
#258 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Survey
Dominant language
Dart
Stars
97
Forks
85
Avg merge
1d 8h
Merged PRs (30d)
31

Description

Summary

The Flutter SDK has built-in survey UI but doesn't apply the fontFamily from survey appearance settings.

Current State

  • PostHogDisplaySurveyAppearance includes fontFamily field
  • Built-in survey widgets use hardcoded TextStyle without fontFamily
  • The data is parsed but not used

Expected Behavior

When a survey is configured with a custom fontFamily, the built-in survey UI should apply that font (if available/bundled in the app), falling back to system default if not found.

Reference Implementation

See posthog-ios SurveySheet.swift:

static func customFont(family: String) -> Font? {
    if let uiFont = UIFont(name: family, size: UIFont.systemFontSize) {
        return Font(uiFont)
    }
    return nil  // Falls back to system default
}

Implementation Notes

  • Pass fontFamily to TextStyle in survey widgets (e.g., question_header.dart, survey_button.dart, etc.)
  • Font must be declared in pubspec.yaml and bundled with the app
  • Fall back to system default if font not found

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the survey widgets named in the issue, including question_header.dart and survey_button.dart, and trace how PostHogDisplaySurveyAppearance.fontFamily reaches them. Apply the configured family through each relevant TextStyle, preserving the system default when the font is unavailable. Confirm the behavior with a bundled font and with an unavailable font.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.