Modern Apps git

← Modern-Apps.git

ui: migrate stale scaffold exceptions; AppScaffold gains containerColor

Commit
dc9be0e3797daf06110a7d502421fc529c3f1872
Author
Vayun Mathur <[email protected]>
When
2026-11-20 20:09 UTC (15 days ago)
Parents
5d654dd
A marker census found most RAW SCAFFOLD EXCEPTIONs excused
only by 'the shared scaffold always adds a top bar'. It does
not - AppScaffold(topBar = {}) expresses a bar-less screen, so
clock's ringing screen, chess learn/puzzle, office's online
opt-in, web's bottom-toolbar omnibox editor, and photos
People/Map pages (bottom-nav-only) migrate to the shared
scaffold and the markers are deleted. Insets behaviour is
unchanged: AppScaffold delegates to the same Scaffold wrapper.

The black photo viewers were additionally blocked on colour:
AppScaffold gains containerColor (default = colorScheme.
background, exactly its previous behaviour; forwarding to the
underlying scaffold), letting PhotoPage, the filmstrip pending
view and the vault viewer migrate with Color.Black, and
photos' wallpaper page (transparent bar over black).

Legitimate exceptions (gallery's pull-to-refresh bar swap,
web BrowserChrome's composite bar) stay. 23 code markers repo-
wide are down to 12, all legitimate or in other modules.

Verified: :library:ui:testDebugUnitTest, :photos:testDevUnitTest
790, :games:chess:testDevUnitTest, web/office/clock compile.

Diff

clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmRingingScreen.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmRingingScreen.kt b/clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmRingingScreen.ktindex 875f715dc9..3c8ba1df9c 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmRingingScreen.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmRingingScreen.kt@@ -25,7 +25,7 @@ import com.vayunmathur.library.ui.FilledTonalButton import com.vayunmathur.library.ui.IconAlarm import com.vayunmathur.library.ui.IconPause import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text @@ -38,10 +38,7 @@ fun AlarmRingingScreen(     onSnooze: () -> Unit,     snoozeEnabled: Boolean = true, ) {-    // RAW SCAFFOLD EXCEPTION: full-screen alarm-ringing takeover — no top bar, nav,-    // actions or FAB, just centered content with SpaceBetween. None of the shared-    // scaffolds (which all add chrome) fit; a minimal Scaffold is intentional here.-    Scaffold(modifier = Modifier.fillMaxSize()) { paddingValues ->+    AppScaffold(topBar = {}, modifier = Modifier.fillMaxSize()) { paddingValues ->         Column(             modifier = Modifier.fillMaxSize().padding(paddingValues).padding(horizontal = 24.dp, vertical = 48.dp),             horizontalAlignment = Alignment.CenterHorizontally,
games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.kt
diff --git a/games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.kt b/games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.ktindex fc1b2bb006..424e166fb2 100644--- a/games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.kt+++ b/games/chess/src/main/java/com/vayunmathur/games/chess/ChessLearnScreens.kt@@ -64,7 +64,6 @@ import com.vayunmathur.library.ui.Icon import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.R as UiR-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton import kotlinx.coroutines.Dispatchers@@ -84,12 +83,11 @@ fun LearnHomeScreen(onOpenStage: (String, String) -> Unit) {         }     }     // No app bar: the tab has no title worth showing and no actions, so the content gets the space.-    // RAW SCAFFOLD EXCEPTION: bar-less game list; the shared scaffolds all impose a top app bar.-    Scaffold { pad ->+    AppScaffold(topBar = {}) { pad ->         val cats = categories         if (cats == null) {             Box(Modifier.fillMaxSize().padding(pad), Alignment.Center) { CircularProgressIndicator() }-            return@Scaffold+            return@AppScaffold         }         LazyColumn(             Modifier.fillMaxSize(),
games/chess/src/main/java/com/vayunmathur/games/chess/ChessPuzzleScreens.kt
diff --git a/games/chess/src/main/java/com/vayunmathur/games/chess/ChessPuzzleScreens.kt b/games/chess/src/main/java/com/vayunmathur/games/chess/ChessPuzzleScreens.ktindex 3fc49e52db..a99f24953a 100644--- a/games/chess/src/main/java/com/vayunmathur/games/chess/ChessPuzzleScreens.kt+++ b/games/chess/src/main/java/com/vayunmathur/games/chess/ChessPuzzleScreens.kt@@ -36,7 +36,7 @@ import com.vayunmathur.library.ui.ExperimentalMaterial3Api import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.R as UiR-import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.SegmentedButton import com.vayunmathur.library.ui.SegmentedButtonDefaults import com.vayunmathur.library.ui.SingleChoiceSegmentedButtonRow@@ -95,8 +95,7 @@ fun PuzzleBoardScreen(state: PuzzleUiState, actions: PuzzleActions) {     }      // No app bar: the tab has no title worth showing and no actions, so the content gets the space.-    // RAW SCAFFOLD EXCEPTION: bar-less game board; the shared scaffolds all impose a top app bar.-    Scaffold { innerPadding ->+    AppScaffold(topBar = {}) { innerPadding ->         BoxWithConstraints(             Modifier                 .fillMaxSize()
library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.ktindex 5fd32228db..6e2160bb1e 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.kt@@ -7,6 +7,7 @@ import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.nestedscroll.nestedScroll import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.library.util.NavKey@@ -67,6 +68,7 @@ fun AppScaffold(     floatingActionButton: @Composable () -> Unit = {},     bottomBar: @Composable () -> Unit = {},     snackbarHost: (@Composable () -> Unit)? = null,+    containerColor: Color = MaterialTheme.colorScheme.background,     content: @Composable (PaddingValues) -> Unit, ) = AppScaffold(     title = { Text(title) },@@ -82,6 +84,7 @@ fun AppScaffold(     floatingActionButton = floatingActionButton,     bottomBar = bottomBar,     snackbarHost = snackbarHost,+    containerColor = containerColor,     content = content, ) @@ -106,6 +109,7 @@ fun AppScaffold(     floatingActionButton: @Composable () -> Unit = {},     bottomBar: @Composable () -> Unit = {},     snackbarHost: (@Composable () -> Unit)? = null,+    containerColor: Color = MaterialTheme.colorScheme.background,     content: @Composable (PaddingValues) -> Unit, ) {     val resolvedNavigationIcon = resolveNavigationIcon(navigationIcon, onClose, onNavigateBack)@@ -126,6 +130,7 @@ fun AppScaffold(         floatingActionButton = floatingActionButton,         bottomBar = bottomBar,         snackbarHost = snackbarHost,+        containerColor = containerColor,         content = content,     ) }@@ -142,6 +147,7 @@ fun AppScaffold(     floatingActionButton: @Composable () -> Unit = {},     bottomBar: @Composable () -> Unit = {},     snackbarHost: (@Composable () -> Unit)? = null,+    containerColor: Color = MaterialTheme.colorScheme.background,     content: @Composable (PaddingValues) -> Unit, ) = Scaffold(     modifier = modifier,@@ -149,6 +155,7 @@ fun AppScaffold(     floatingActionButton = floatingActionButton,     bottomBar = bottomBar,     snackbarHost = snackbarHost,+    containerColor = containerColor,     content = content, ) @@ -168,6 +175,7 @@ fun <T : NavKey> AppScaffold(     floatingActionButton: @Composable () -> Unit = {},     bottomBar: @Composable () -> Unit = {},     snackbarHost: (@Composable () -> Unit)? = null,+    containerColor: Color = MaterialTheme.colorScheme.background,     content: @Composable (PaddingValues) -> Unit, ) = AppScaffold(     title = title,@@ -183,6 +191,7 @@ fun <T : NavKey> AppScaffold(     floatingActionButton = floatingActionButton,     bottomBar = bottomBar,     snackbarHost = snackbarHost,+    containerColor = containerColor,     content = content, ) 
office/src/main/java/com/vayunmathur/office/ui/OfficeOnlineScreens.kt
diff --git a/office/src/main/java/com/vayunmathur/office/ui/OfficeOnlineScreens.kt b/office/src/main/java/com/vayunmathur/office/ui/OfficeOnlineScreens.ktindex 8b87ff16ee..2852aa9e83 100644--- a/office/src/main/java/com/vayunmathur/office/ui/OfficeOnlineScreens.kt+++ b/office/src/main/java/com/vayunmathur/office/ui/OfficeOnlineScreens.kt@@ -49,7 +49,6 @@ import com.vayunmathur.library.ui.ListItem import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.OutlinedTextField-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton import com.vayunmathur.library.util.OfflineBanner@@ -106,10 +105,7 @@ internal fun OnlineInit(viewModel: OfficeViewModel) { @OptIn(ExperimentalMaterial3Api::class) @Composable internal fun OnlineDisabledScreen(onEnable: () -> Unit) {-    // RAW SCAFFOLD EXCEPTION: bar-less full-screen opt-in prompt; the shared scaffolds all-    // impose a top app bar (AppScaffold/DetailScaffold) or lazy-list content semantics-    // (LazyListScaffold), none of which fit a centered, bar-less message screen.-    Scaffold { pad ->+    AppScaffold(topBar = {}) { pad ->         Column(             Modifier.fillMaxSize().padding(pad).padding(SpacingScreen),             horizontalAlignment = Alignment.CenterHorizontally
photos/src/main/java/com/vayunmathur/photos/ui/MapPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/MapPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/MapPage.ktindex ad53350051..290f9af2b8 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/MapPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/MapPage.kt@@ -17,7 +17,7 @@ import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text import androidx.compose.runtime.Composable@@ -125,10 +125,7 @@ fun MapPage(         }     } -    // RAW SCAFFOLD EXCEPTION: full-bleed map main-nav page with only a bottom-    // NavigationBar and no top app bar. AppScaffold always renders a top app bar (which-    // would break the immersive map) and the body is not a LazyColumn.-    Scaffold(bottomBar = { NavigationBar(Route.Map, backStack) }) { paddingValues ->+    AppScaffold(topBar = {}, bottomBar = { NavigationBar(Route.Map, backStack) }) { paddingValues ->         Box(Modifier.padding(paddingValues).fillMaxSize()) {             VectorMap(                 cameraState = cameraState,
photos/src/main/java/com/vayunmathur/photos/ui/PeopleScreen.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/PeopleScreen.kt b/photos/src/main/java/com/vayunmathur/photos/ui/PeopleScreen.ktindex 1317eab361..ed782bea2f 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/PeopleScreen.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/PeopleScreen.kt@@ -21,7 +21,7 @@ import androidx.compose.foundation.shape.CircleShape import com.vayunmathur.library.ui.ExperimentalMaterial3Api import com.vayunmathur.library.ui.LinearProgressIndicator import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TopAppBar import androidx.compose.runtime.Composable@@ -81,10 +81,8 @@ fun PeopleScreen(     val showProgress = state.faceTargetCount > 0 &&         (state.indexing || state.faceScannedCount < state.faceTargetCount) -    // RAW SCAFFOLD EXCEPTION: main-nav page with only a bottom NavigationBar and no top-    // app bar. AppScaffold always renders a top app bar (which would break the layout) and-    // the body is a Column (progress + grid), not a LazyColumn.-    Scaffold(+    AppScaffold(+        topBar = {},         bottomBar = { NavigationBar(Route.People, backStack) },     ) { padding ->         Box(Modifier.padding(padding).fillMaxSize()) {
photos/src/main/java/com/vayunmathur/photos/ui/PhotoFilmstrip.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoFilmstrip.kt b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoFilmstrip.ktindex 414a03fd60..8c70dfb6e8 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoFilmstrip.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoFilmstrip.kt@@ -59,9 +59,7 @@ internal fun FilmstripPane(photos: List<Photo>, pagerState: PagerState) {  */ @Composable internal fun PendingPhotoView(uri: String, context: Context) {-    // RAW SCAFFOLD EXCEPTION: bar-less full-screen black viewer for a not-yet-indexed image;-    // AppScaffold always renders a top app bar, which would break the immersive viewer.-    com.vayunmathur.library.ui.Scaffold(containerColor = Color.Black) { paddingValues ->+    com.vayunmathur.library.ui.AppScaffold(topBar = {}, containerColor = Color.Black) { paddingValues ->         AsyncImage(             model = ImageRequest.Builder(context).data(uri.toUri()).build(),             contentDescription = null,
photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.ktindex 05bbe07f98..62046f24d0 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/PhotoPage.kt@@ -30,7 +30,7 @@ import androidx.core.net.toUri import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.compose.LocalLifecycleOwner-import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.ZoomState import com.vayunmathur.library.ui.isExpandedWidth import com.vayunmathur.library.util.NavBackStack@@ -150,10 +150,7 @@ fun PhotoPage(galleryViewModel: GalleryViewModel, photoMapViewModel: PhotoMapVie         val pagerState =             rememberPagerState(initialPage = initialIndex.coerceAtLeast(0), pageCount = { photosSorted.size }) -        // RAW SCAFFOLD EXCEPTION: bar-less full-screen black media viewer (no top/bottom-        // bar); controls are a bottom overlay inside the pager. AppScaffold always renders a-        // top app bar, which would break the immersive viewer.-        Scaffold(containerColor = Color.Black) { paddingValues ->+        AppScaffold(topBar = {}, containerColor = Color.Black) { paddingValues ->             // Expanded windows keep the same pager but beside a filmstrip of the             // surrounding photos; compact keeps the full-bleed pager.             val pagerContent: @Composable (Modifier) -> Unit = { pagerModifier ->
photos/src/main/java/com/vayunmathur/photos/ui/VaultViewerScreen.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/VaultViewerScreen.kt b/photos/src/main/java/com/vayunmathur/photos/ui/VaultViewerScreen.ktindex 7aefd71fd5..3b28a192d5 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/VaultViewerScreen.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/VaultViewerScreen.kt@@ -27,7 +27,7 @@ import com.vayunmathur.library.ui.FadeVisibility import com.vayunmathur.library.ui.IconBack import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.ZoomState import com.vayunmathur.library.ui.zoomGestures@@ -56,10 +56,7 @@ fun VaultViewerScreen(     val zoomState = rememberUpdatedState(zoom)     var containerSize by remember { mutableStateOf(IntSize.Zero) } -    // RAW SCAFFOLD EXCEPTION: bar-less full-screen black media viewer (no top/bottom-    // bar); chrome is a floating overlay inside the viewer. AppScaffold always renders a-    // top app bar, which would break the immersive viewer.-    Scaffold(containerColor = Color.Black) { paddingValues ->+    AppScaffold(topBar = {}, containerColor = Color.Black) { paddingValues ->         Box(             modifier = Modifier                 .fillMaxSize()
photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.kt
diff --git a/photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.kt b/photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.ktindex f3ebf3f8ef..a6a1fd195f 100644--- a/photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.kt+++ b/photos/src/main/java/com/vayunmathur/photos/ui/WallpaperPage.kt@@ -30,7 +30,7 @@ import androidx.compose.ui.platform.LocalResources import androidx.compose.ui.res.stringResource import com.vayunmathur.library.ui.IconNavigation import com.vayunmathur.library.ui.MaterialTheme-import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.SnackbarHost import com.vayunmathur.library.ui.SnackbarHostState import com.vayunmathur.library.ui.Text@@ -113,10 +113,7 @@ fun WallpaperPage(         targetW.toFloat() / targetH.toFloat()     } else 9f / 16f -    // RAW SCAFFOLD EXCEPTION: immersive black wallpaper preview with a transparent,-    // white-tinted TopAppBar (title + back). AppScaffold exposes no top-bar color slot, so-    // the transparent/white immersive bar cannot be preserved.-    Scaffold(+    AppScaffold(         containerColor = Color.Black,         topBar = {             TopAppBar(
web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.kt b/web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.ktindex 4918b2d3f9..2f39d3501e 100644--- a/web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/BrowserOmniboxEditor.kt@@ -35,7 +35,6 @@ import com.vayunmathur.library.ui.IconClose import com.vayunmathur.library.ui.IconSearch import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedTextField-import com.vayunmathur.library.ui.Scaffold import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text import com.vayunmathur.web.R@@ -140,11 +139,8 @@ internal fun OmniboxEditor(             )         }         if (effectiveAtBottom) {-            // RAW SCAFFOLD EXCEPTION: with the toolbar at the bottom the editing-            // omnibox has no top bar at all, which AppScaffold cannot express - its-            // top bar is mandatory and would leave an empty bar hanging above the-            // suggestions.-            Scaffold(+            AppScaffold(+                topBar = {},                 bottomBar = {                     Surface(Modifier.fillMaxWidth()) {                         Row(