Skip to content

fix(auth): allow customizing top app bar colors via AuthUITheme - #2391

Merged
russellwheatley merged 6 commits into
version-10.0.0-beta04from
fix/customizable-top-app-bar-colors
Jul 27, 2026
Merged

fix(auth): allow customizing top app bar colors via AuthUITheme#2391
russellwheatley merged 6 commits into
version-10.0.0-beta04from
fix/customizable-top-app-bar-colors

Conversation

@demolaf

@demolaf demolaf commented Jul 15, 2026

Copy link
Copy Markdown
Member

Fixes #2390.

AuthUITheme.topAppBarColors was a companion-object getter derived from the ambient MaterialTheme.colorScheme, so there was no way to override it per AuthUITheme instance — apps couldn't align the auth screens' top app bar with their own branding.

Usage

val customTheme = AuthUITheme.Default.copy(
    topAppBarColors = TopAppBarColors(
        containerColor = Color(0xFFFFA000), // firebase primary color - amber
        scrolledContainerColor = Color(0xFFFFA000),
        navigationIconContentColor = Color.White,
        titleContentColor = Color.White,
        actionIconContentColor = Color.White,
        subtitleContentColor = Color.White,
    )
)

val configuration = authUIConfiguration {
    context = applicationContext
    theme = customTheme
    // ...
}

Preview

Screenshot_1784126283

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

Copy link
Copy Markdown

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 introduces the ability to customize top app bar colors on authentication screens by adding a topAppBarColors property to AuthUITheme and applying it across various UI screens. The review feedback highlights a compilation error in HighLevelApiDemoActivity.kt due to the use of a non-existent subtitleContentColor parameter in Material 3's TopAppBarColors. Additionally, because TopAppBarColors is an experimental API, the reviewer recommends adding the @OptIn(ExperimentalMaterial3Api::class) annotation locally in the demo activity and propagating the @property:ExperimentalMaterial3Api annotation to the public property in AuthUITheme.

Comment thread app/src/main/java/com/firebaseui/android/demo/HighLevelApiDemoActivity.kt Outdated

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few bits of feedback

SelectFactorUI's TopAppBar in MfaEnrollmentDefaults.kt doesn't take colors at all, so it won't pick up topAppBarColors (or even the existing default). Can you wire that one up too, otherwise the 2FA screen won't match once someone sets a custom color.

see auth/src/main/java/com/firebase/ui/auth/ui/screens/MfaEnrollmentDefaults.kt:255 (the TopAppBar call inside SelectFactorUI)

@demolaf
demolaf force-pushed the version-10.0.0-beta04 branch from 84a8b5d to d382bd5 Compare July 17, 2026 08:21

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few bits of feedback

topAppBarColors on AuthUITheme (and the matching copy() param) is typed as TopAppBarColors, which is still @ExperimentalMaterial3Api, but neither is annotated. Anyone who actually sets it - the whole point of this PR -gets a compile error with no hint why unless they already have @OptIn in scope elsewhere. Can you propagate the opt-in onto the property and the copy() param?

see auth/src/main/java/com/firebase/ui/auth/configuration/theme/AuthUITheme.kt:90 and :110

Same issue bites the demo itself — TopAppBarColors(...) is constructed inside onCreate/setContent, but the only @OptIn(ExperimentalMaterial3Api::class) in the file is on the unrelated composable further down. As it stands this won't compile.

see app/src/main/java/com/firebaseui/android/demo/HighLevelApiDemoActivity.kt:88 (missing @OptIn on onCreate, existing one is at line 252)

Nit: README and demo both construct TopAppBarColors(...) with all six params instead of going through TopAppBarDefaults.topAppBarColors(...) like the rest of the codebase does (including our own default at AuthUITheme.kt:247). Worth switching for consistency and so we don't break if Material3 adds params later.

@demolaf

demolaf commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

topAppBarColors on AuthUITheme (and the matching copy() param) is typed as TopAppBarColors, which is still @ExperimentalMaterial3Api, but neither is annotated. Anyone who actually sets it - the whole point of this PR -gets a compile error with no hint why unless they already have @OptIn in scope elsewhere. Can you propagate the opt-in onto the property and the copy() param?

I think it compiles fine. In newer versions of compose bom the APIs are now stable, before the compose bom was updated this (i.e. @OptIn(ExperimentalMaterial3Api::class)) was needed but i've taken it out now.

@demolaf

demolaf commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Nit: README and demo both construct TopAppBarColors(...) with all six params instead of going through TopAppBarDefaults.topAppBarColors(...) like the rest of the codebase does (including our own default at AuthUITheme.kt:247). Worth switching for consistency and so we don't break if Material3 adds params later.

Valid point, i'll make the necessary changes to the demo and README.

@demolaf
demolaf requested a review from russellwheatley July 17, 2026 15:02
@demolaf demolaf linked an issue Jul 17, 2026 that may be closed by this pull request
@demolaf
demolaf force-pushed the version-10.0.0-beta04 branch from d382bd5 to 1ecd498 Compare July 22, 2026 22:13
@demolaf

demolaf commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

@russellwheatley anything else blocking this from being merged?

@russellwheatley

Copy link
Copy Markdown
Member

@demolaf - just the merge conflict and I think we're good to go 👍

@demolaf
demolaf force-pushed the fix/customizable-top-app-bar-colors branch from 10ab21e to 223eb77 Compare July 27, 2026 12:24
@russellwheatley
russellwheatley merged commit 12762f1 into version-10.0.0-beta04 Jul 27, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in studio-2394994192-60a69 Jul 27, 2026
@russellwheatley
russellwheatley deleted the fix/customizable-top-app-bar-colors branch July 27, 2026 12:37
demolaf added a commit that referenced this pull request Jul 29, 2026
…2404)

* fix(auth): validate display name only when required in sign-up form (#2383)

* fix(auth): validate display name only when required in sign-up form

* fix(auth): use locale-safe matcher for sign-up button in test

* fix(internal): append CHAR_LIMIT to translation descriptions in export script (#2417)

Fixes #1613

* fix(auth): mitigate tapjacking on the auth activity window (#2416)

Fixes #2041

* sample(app): add Firestore, Database & Storage demos to sample app (#2406)

* fix(auth): allow customizing top app bar colors via AuthUITheme (#2391)

* fix(auth): handle edge-to-edge insets in MFA challenge and auth screens (#2413)

* fix(auth): use fixed padding for method picker provider buttons (#2424) (#2426)

* fix(firestore): catch InterruptedException in FirestorePagingSource

* fix(firestore): drop load error logging and restore rx error handler in test

* fix(firestore): return LoadResult.Error for every load failure instead of throwing

* fix(firestore): fix PageKey.equals NPE on null snapshots and add hashCode

* test(firestore): run paging source test in CI via robolectric and replace sleeps with latches

* fix(firestore): log genuine load failures while keeping cancellations silent

---------

Co-authored-by: Oluwatobi Shokunbi <ayoshokz@gmail.com>
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.

Allow customizing AuthUITheme.topAppBarColors from outside AuthUITheme

2 participants