Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ dependencies {
testImplementation(Config.Libs.Test.robolectric)
testImplementation(Config.Libs.Test.kotlinReflect)
testImplementation(Config.Libs.Provider.facebook)
testImplementation(libs.androidx.ui.test.junit4)

debugImplementation(project(":internal:lintchecks"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.google.firebase.auth.ActionCodeSettings
import androidx.compose.ui.graphics.vector.ImageVector
import com.firebase.ui.auth.compose.configuration.stringprovider.AuthUIStringProvider
import com.firebase.ui.auth.compose.configuration.stringprovider.DefaultAuthUIStringProvider
import com.firebase.ui.auth.compose.configuration.theme.AuthUITheme

fun actionCodeSettings(block: ActionCodeSettings.Builder.() -> Unit) =
ActionCodeSettings.newBuilder().apply(block).build()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* Copyright 2025 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.firebase.ui.auth.compose.configuration.theme

import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Shapes
import androidx.compose.material3.Typography
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

/**
* Theming configuration for the entire Auth UI.
*/
class AuthUITheme(
/**
* The color scheme to use.
*/
val colorScheme: ColorScheme,

/**
* The typography to use.
*/
val typography: Typography,

/**
* The shapes to use for UI elements.
*/
val shapes: Shapes,

/**
* A map of provider IDs to custom styling.
*/
val providerStyles: Map<String, ProviderStyle> = emptyMap()
) {

/**
* A class nested within AuthUITheme that defines the visual appearance of a specific
* provider button, allowing for per-provider branding and customization.
*/
class ProviderStyle(
/**
* The background color of the button.
*/
val backgroundColor: Color,

/**
* The color of the text label on the button.
*/
val contentColor: Color,

/**
* An optional tint color for the provider's icon. If null,
* the icon's intrinsic color is used.
*/
var iconTint: Color? = null,

/**
* The shape of the button container. Defaults to RoundedCornerShape(4.dp).
*/
val shape: Shape = RoundedCornerShape(4.dp),

/**
* The shadow elevation for the button. Defaults to 2.dp.
*/
val elevation: Dp = 2.dp
)

companion object {
/**
* A standard light theme with Material 3 defaults and
* pre-configured provider styles.
*/
val Default = AuthUITheme(
colorScheme = lightColorScheme(
primary = Color(0xFFFFA611)
),
typography = Typography(),
shapes = Shapes(),
providerStyles = ProviderStyleDefaults.default
)

/**
* Creates a theme inheriting the app's current Material
* Theme settings.
*/
@Composable
fun fromMaterialTheme(
providerStyles: Map<String, ProviderStyle> = ProviderStyleDefaults.default
): AuthUITheme {
return AuthUITheme(
colorScheme = MaterialTheme.colorScheme,
typography = MaterialTheme.typography,
shapes = MaterialTheme.shapes,
providerStyles = providerStyles
)
}

}
}

@Composable
fun AuthUITheme(
theme: AuthUITheme = AuthUITheme.Default,
content: @Composable () -> Unit
) {
MaterialTheme(
colorScheme = theme.colorScheme,
typography = theme.typography,
shapes = theme.shapes,
content = content
)
}
Loading