-
Notifications
You must be signed in to change notification settings - Fork 0
Screen UI Providers
Andrés Pedraza Míguez edited this page Dec 6, 2025
·
4 revisions
The ScreenUiProvider pattern is a mechanism used to decouple the "Chrome" of a screen (TopAppBar, FloatingActionButton) from the screen's content and the main navigation host.
In a modular app, the MainScreen (which holds the Scaffold) doesn't know about specific screens inside feature modules. We wanted to avoid a monolithic when(route) statement in MainScreen to determine which Title or FAB to show.
We define an interface ScreenUiProvider in :core:ui. Each Feature module implements this interface for its screens if they need a TopBar or FAB.
interface ScreenUiProvider {
val route: String
val topBar: (@Composable () -> Unit)? get() = null
val fab: (@Composable () -> Unit)? get() = null
}