library: adopt Expressive indicators, app bars and shapes
- Commit
1814071afa44722136b01ca534dc1b086a95ea7f- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-21 18:26 UTC (3 months ago)
- Parents
1365973
Diff
library/ui/src/main/java/com/vayunmathur/library/ui/AchievementNotification.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/AchievementNotification.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/AchievementNotification.ktindex dde32ecde8..46180a7a66 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/AchievementNotification.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/AchievementNotification.kt@@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size-import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon@@ -79,7 +78,7 @@ fun AchievementNotification( } } },- shape = RoundedCornerShape(16.dp),+ shape = MaterialTheme.shapes.largeIncreased, colors = CardDefaults.cardColors( containerColor = MaterialTheme.colorScheme.primaryContainer, contentColor = MaterialTheme.colorScheme.onPrimaryContainer
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 a9ae38f9c5..45106f6995 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@@ -6,6 +6,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.library.util.NavKey@@ -20,6 +21,21 @@ import com.vayunmathur.library.util.NavKey */ enum class AppBarAlignment { Start, Center } +/**+ * How tall [AppScaffold]'s top bar is, and so how much presence its title has.+ *+ * [Small] is the default and stays the default deliberately: it is what all 39 modules using+ * [AppScaffold] already render, and the taller bars change every screen's vertical rhythm.+ * The two flexible sizes are the Expressive two-row bars - they collapse to a single row as+ * content scrolls under them, and are worth opting into on a screen whose title is the screen's+ * identity rather than a label above content. [LargeFlexible] treats the title as the headline;+ * [MediumFlexible] is the middle ground.+ *+ * A flexible size needs a `scrollBehavior` to be worth having: without one the bar stays+ * expanded and simply eats vertical space.+ */+enum class AppBarSize { Small, MediumFlexible, LargeFlexible }+ /** * Scaffold for an ordinary screen: a top app bar with an optional back button, * optional actions, and content.@@ -37,43 +53,34 @@ enum class AppBarAlignment { Start, Center } fun AppScaffold( title: String, modifier: Modifier = Modifier,+ subtitle: String? = null, onNavigateBack: (() -> Unit)? = null, onClose: (() -> Unit)? = null, navigationIcon: (@Composable () -> Unit)? = null, alignment: AppBarAlignment = AppBarAlignment.Start,+ size: AppBarSize = AppBarSize.Small, actions: @Composable RowScope.() -> Unit = {}, scrollBehavior: TopAppBarScrollBehavior? = null, floatingActionButton: @Composable () -> Unit = {}, bottomBar: @Composable () -> Unit = {}, snackbarHost: @Composable () -> Unit = {}, content: @Composable (PaddingValues) -> Unit,-) {- val resolvedNavigationIcon = resolveNavigationIcon(navigationIcon, onClose, onNavigateBack)-- Scaffold(- modifier = modifier,- topBar = {- when (alignment) {- AppBarAlignment.Start -> TopAppBar(- title = { Text(title) },- navigationIcon = resolvedNavigationIcon,- actions = actions,- scrollBehavior = scrollBehavior,- )- AppBarAlignment.Center -> CenterAlignedTopAppBar(- title = { Text(title) },- navigationIcon = resolvedNavigationIcon,- actions = actions,- scrollBehavior = scrollBehavior,- )- }- },- floatingActionButton = floatingActionButton,- bottomBar = bottomBar,- snackbarHost = snackbarHost,- content = content,- )-}+) = AppScaffold(+ title = { Text(title) },+ modifier = modifier,+ subtitle = subtitle?.let { text -> { Text(text) } },+ onNavigateBack = onNavigateBack,+ onClose = onClose,+ navigationIcon = navigationIcon,+ alignment = alignment,+ size = size,+ actions = actions,+ scrollBehavior = scrollBehavior,+ floatingActionButton = floatingActionButton,+ bottomBar = bottomBar,+ snackbarHost = snackbarHost,+ content = content,+) /** * [AppScaffold] taking a title slot rather than a string.@@ -86,10 +93,12 @@ fun AppScaffold( fun AppScaffold( title: @Composable () -> Unit, modifier: Modifier = Modifier,+ subtitle: (@Composable () -> Unit)? = null, onNavigateBack: (() -> Unit)? = null, onClose: (() -> Unit)? = null, navigationIcon: (@Composable () -> Unit)? = null, alignment: AppBarAlignment = AppBarAlignment.Start,+ size: AppBarSize = AppBarSize.Small, actions: @Composable RowScope.() -> Unit = {}, scrollBehavior: TopAppBarScrollBehavior? = null, floatingActionButton: @Composable () -> Unit = {},@@ -101,16 +110,15 @@ fun AppScaffold( Scaffold( modifier = modifier, topBar = {- when (alignment) {- AppBarAlignment.Start -> TopAppBar(- title = title, navigationIcon = resolvedNavigationIcon,- actions = actions, scrollBehavior = scrollBehavior,- )- AppBarAlignment.Center -> CenterAlignedTopAppBar(- title = title, navigationIcon = resolvedNavigationIcon,- actions = actions, scrollBehavior = scrollBehavior,- )- }+ AppTopBar(+ title = title,+ subtitle = subtitle,+ navigationIcon = resolvedNavigationIcon,+ actions = actions,+ alignment = alignment,+ size = size,+ scrollBehavior = scrollBehavior,+ ) }, floatingActionButton = floatingActionButton, bottomBar = bottomBar,@@ -126,9 +134,11 @@ fun <T : NavKey> AppScaffold( title: String, backStack: NavBackStack<T>, modifier: Modifier = Modifier,+ subtitle: String? = null, onClose: (() -> Unit)? = null, navigationIcon: (@Composable () -> Unit)? = null, alignment: AppBarAlignment = AppBarAlignment.Start,+ size: AppBarSize = AppBarSize.Small, actions: @Composable RowScope.() -> Unit = {}, scrollBehavior: TopAppBarScrollBehavior? = null, floatingActionButton: @Composable () -> Unit = {},@@ -138,10 +148,12 @@ fun <T : NavKey> AppScaffold( ) = AppScaffold( title = title, modifier = modifier,+ subtitle = subtitle, onNavigateBack = { backStack.pop() }, onClose = onClose, navigationIcon = navigationIcon, alignment = alignment,+ size = size, actions = actions, scrollBehavior = scrollBehavior, floatingActionButton = floatingActionButton,@@ -150,6 +162,51 @@ fun <T : NavKey> AppScaffold( content = content, ) +/**+ * The top bar [AppScaffold] renders, resolved from [size] and [alignment].+ *+ * Kept private and shared so the three overloads cannot drift apart. [subtitle] is only rendered+ * by the flexible sizes - the small bar is a single row and has nowhere to put it.+ */+@OptIn(ExperimentalMaterial3Api::class)+@Composable+private fun AppTopBar(+ title: @Composable () -> Unit,+ subtitle: (@Composable () -> Unit)?,+ navigationIcon: @Composable () -> Unit,+ actions: @Composable RowScope.() -> Unit,+ alignment: AppBarAlignment,+ size: AppBarSize,+ scrollBehavior: TopAppBarScrollBehavior?,+) {+ val titleAlignment = when (alignment) {+ AppBarAlignment.Start -> Alignment.Start+ AppBarAlignment.Center -> Alignment.CenterHorizontally+ }+ when (size) {+ AppBarSize.Small -> when (alignment) {+ AppBarAlignment.Start -> TopAppBar(+ title = title, navigationIcon = navigationIcon,+ actions = actions, scrollBehavior = scrollBehavior,+ )+ AppBarAlignment.Center -> CenterAlignedTopAppBar(+ title = title, navigationIcon = navigationIcon,+ actions = actions, scrollBehavior = scrollBehavior,+ )+ }+ AppBarSize.MediumFlexible -> MediumFlexibleTopAppBar(+ title = title, subtitle = subtitle, navigationIcon = navigationIcon,+ actions = actions, titleHorizontalAlignment = titleAlignment,+ scrollBehavior = scrollBehavior,+ )+ AppBarSize.LargeFlexible -> LargeFlexibleTopAppBar(+ title = title, subtitle = subtitle, navigationIcon = navigationIcon,+ actions = actions, titleHorizontalAlignment = titleAlignment,+ scrollBehavior = scrollBehavior,+ )+ }+}+ /** * Resolves the top-bar navigation icon from the available options, in priority * order: an explicit [navigationIcon] slot wins; otherwise [onClose] renders a
library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.ktindex b5a791af68..5d120b60c1 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.kt@@ -3,7 +3,6 @@ package com.vayunmathur.library.ui import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.IconButton import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text@@ -36,7 +35,7 @@ fun CommonSearchBar( } } } else null,- shape = RoundedCornerShape(28.dp),+ shape = MaterialTheme.shapes.extraLarge, singleLine = true ) }
library/ui/src/main/java/com/vayunmathur/library/ui/CompassCalibrationBanner.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/CompassCalibrationBanner.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/CompassCalibrationBanner.ktindex d19dcd5482..e18325da24 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/CompassCalibrationBanner.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/CompassCalibrationBanner.kt@@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size-import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text@@ -28,7 +27,7 @@ fun CompassCalibrationBanner(accuracy: Int, modifier: Modifier = Modifier) { Surface( modifier = modifier.fillMaxWidth(),- shape = RoundedCornerShape(16.dp),+ shape = MaterialTheme.shapes.largeIncreased, color = MaterialTheme.colorScheme.tertiaryContainer, contentColor = MaterialTheme.colorScheme.onTertiaryContainer, ) {
library/ui/src/main/java/com/vayunmathur/library/ui/DashboardSection.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/DashboardSection.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/DashboardSection.ktindex 4a58cc1c92..b27f9a9f3f 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/DashboardSection.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/DashboardSection.kt@@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width-import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier@@ -98,7 +97,7 @@ fun DashboardSection( modifier = Modifier .fillMaxWidth() .padding(horizontal = Spacing.lg),- shape = RoundedCornerShape(16.dp),+ shape = MaterialTheme.shapes.largeIncreased, color = MaterialTheme.colorScheme.surfaceContainerLow, ) { Column(modifier = Modifier.fillMaxWidth(), content = content)
library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.ktindex 67b8ec1732..e490449d4d 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.kt@@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items-import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.ExperimentalMaterial3Api@@ -85,7 +84,7 @@ fun AchievementItem(status: com.vayunmathur.library.util.AchievementStatus) { modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp, vertical = 4.dp),- shape = RoundedCornerShape(12.dp),+ shape = MaterialTheme.shapes.large, colors = CardDefaults.cardColors( containerColor = if (status.isUnlocked) MaterialTheme.colorScheme.secondaryContainer
library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.ktindex f09863bcb5..196960f08e 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.kt@@ -187,11 +187,10 @@ fun BoxScope.HistoryScrubberCard( { Text(DateString.monthDayYear(state.date)) } ) Spacer(Modifier.weight(1f))- FilterChip(- selected = state.nowMode,- onClick = { state.goNow() },- label = { Text(stringResource(R.string.label_now)) }- )+ ToggleButton(+ checked = state.nowMode,+ onCheckedChange = { state.goNow() },+ ) { Text(stringResource(R.string.label_now)) } } Row( Modifier.fillMaxWidth(),
library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.ktindex 53b37fbfc2..e396eed775 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.kt@@ -22,6 +22,7 @@ import androidx.compose.material3.DrawerDefaults import androidx.compose.material3.FilterChipDefaults import androidx.compose.material3.FloatingActionButtonDefaults import androidx.compose.material3.IconButtonDefaults+import androidx.compose.material3.LoadingIndicatorDefaults import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.MenuDefaults import androidx.compose.material3.NavigationBarItem as Material3NavigationBarItem@@ -33,6 +34,7 @@ import androidx.compose.material3.TextFieldDefaults import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.contentColorFor 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.graphics.RectangleShape@@ -315,6 +317,50 @@ fun CenterAlignedTopAppBar( colors = colors, scrollBehavior = scrollBehavior, ) +// --- Top app bars (expressive, two-row) ---+/**+ * A two-row top app bar that collapses to a single row as content scrolls under it.+ *+ * The Expressive medium bar: unlike `MediumTopAppBar` it takes a [subtitle] and lets the title+ * block be centred, and its heights follow the expressive scale. Worth a taller bar on a+ * top-level screen whose title is the screen's identity; ordinary content screens should stay+ * on [TopAppBar].+ *+ * Pass a `scrollBehavior` or the bar has nothing to collapse in response to.+ */+@Composable+fun MediumFlexibleTopAppBar(+ title: @Composable () -> Unit = {},+ modifier: Modifier = Modifier,+ subtitle: (@Composable () -> Unit)? = null,+ navigationIcon: @Composable () -> Unit = {},+ actions: @Composable RowScope.() -> Unit = {},+ titleHorizontalAlignment: Alignment.Horizontal = Alignment.Start,+ colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(),+ scrollBehavior: TopAppBarScrollBehavior? = null,+) = androidx.compose.material3.MediumFlexibleTopAppBar(+ title = title, modifier = modifier, subtitle = subtitle, navigationIcon = navigationIcon,+ actions = actions, titleHorizontalAlignment = titleHorizontalAlignment,+ colors = colors, scrollBehavior = scrollBehavior,+)++/** [MediumFlexibleTopAppBar] with a taller expanded row, for a screen whose title is the headline. */+@Composable+fun LargeFlexibleTopAppBar(+ title: @Composable () -> Unit = {},+ modifier: Modifier = Modifier,+ subtitle: (@Composable () -> Unit)? = null,+ navigationIcon: @Composable () -> Unit = {},+ actions: @Composable RowScope.() -> Unit = {},+ titleHorizontalAlignment: Alignment.Horizontal = Alignment.Start,+ colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(),+ scrollBehavior: TopAppBarScrollBehavior? = null,+) = androidx.compose.material3.LargeFlexibleTopAppBar(+ title = title, modifier = modifier, subtitle = subtitle, navigationIcon = navigationIcon,+ actions = actions, titleHorizontalAlignment = titleHorizontalAlignment,+ colors = colors, scrollBehavior = scrollBehavior,+)+ // --- Slider --- @Composable fun Slider(@@ -384,6 +430,59 @@ fun LinearProgressIndicator( strokeCap: StrokeCap = ProgressIndicatorDefaults.LinearStrokeCap, ) = androidx.compose.material3.LinearProgressIndicator(progress = progress, modifier = modifier, color = color, trackColor = trackColor, strokeCap = strokeCap) +// --- Loading indicator (expressive) ---+/**+ * The Expressive "working on it" indicator: a sequence of morphing shapes rather than a+ * spinning arc.+ *+ * Prefer this to [CircularProgressIndicator] for an ordinary wait. It occupies the same+ * footprint, so swapping one for the other does not move layout. [CircularProgressIndicator]+ * stays for callers that set a `strokeWidth` or `trackColor`, which this has no equivalent of.+ */+@Composable+fun LoadingIndicator(+ modifier: Modifier = Modifier,+ color: Color = LoadingIndicatorDefaults.indicatorColor,+) = androidx.compose.material3.LoadingIndicator(modifier = modifier, color = color)++/** Determinate [LoadingIndicator]: the shape morphs in step with [progress]. */+@Composable+fun LoadingIndicator(+ progress: () -> Float,+ modifier: Modifier = Modifier,+ color: Color = LoadingIndicatorDefaults.indicatorColor,+) = androidx.compose.material3.LoadingIndicator(progress = progress, modifier = modifier, color = color)++/**+ * [LoadingIndicator] on its own filled container.+ *+ * For an indicator that sits over content - a pull-to-refresh or an overlay - where the bare+ * indicator would not have enough contrast against whatever is behind it.+ */+@Composable+fun ContainedLoadingIndicator(+ modifier: Modifier = Modifier,+ containerColor: Color = LoadingIndicatorDefaults.containedContainerColor,+ indicatorColor: Color = LoadingIndicatorDefaults.containedIndicatorColor,+ containerShape: Shape = LoadingIndicatorDefaults.containerShape,+) = androidx.compose.material3.ContainedLoadingIndicator(+ modifier = modifier, containerColor = containerColor,+ indicatorColor = indicatorColor, containerShape = containerShape,+)++/** Determinate [ContainedLoadingIndicator]. */+@Composable+fun ContainedLoadingIndicator(+ progress: () -> Float,+ modifier: Modifier = Modifier,+ containerColor: Color = LoadingIndicatorDefaults.containedContainerColor,+ indicatorColor: Color = LoadingIndicatorDefaults.containedIndicatorColor,+ containerShape: Shape = LoadingIndicatorDefaults.containerShape,+) = androidx.compose.material3.ContainedLoadingIndicator(+ progress = progress, modifier = modifier, containerColor = containerColor,+ indicatorColor = indicatorColor, containerShape = containerShape,+)+ // --- Cards --- @Composable fun Card(
library/ui/src/main/java/com/vayunmathur/library/ui/StateScreens.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/StateScreens.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/StateScreens.ktindex 559b175a2e..eb8c687611 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/StateScreens.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/StateScreens.kt@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size-import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text@@ -89,7 +88,7 @@ fun LoadingState(modifier: Modifier = Modifier, message: String? = null) { horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(16.dp), ) {- CircularProgressIndicator()+ LoadingIndicator() if (message != null) { Text( message,
library/ui/src/main/java/com/vayunmathur/library/ui/TabbedPagerScaffold.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/TabbedPagerScaffold.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/TabbedPagerScaffold.ktindex 8b60cc7a2f..e561e21218 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/TabbedPagerScaffold.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/TabbedPagerScaffold.kt@@ -1,17 +1,13 @@ package com.vayunmathur.library.ui -import androidx.compose.foundation.horizontalScroll-import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues-import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.rememberPagerState-import androidx.compose.foundation.rememberScrollState import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier@@ -125,8 +121,13 @@ fun TabbedPagerScaffold( } /**- * A lightweight, non-swiping tab row of [FilterChip]s - the "product tabs" look- * (travel). For swipeable page hosting use [TabbedPagerScaffold].+ * A lightweight, non-swiping tab row - the "product tabs" look (travel). For swipeable page+ * hosting use [TabbedPagerScaffold].+ *+ * A [ButtonGroup] rather than a row of chips: the choices are one control, so they should read+ * as one object. The group also owns its own overflow menu, which is why this no longer needs+ * to scroll horizontally - a label that does not fit becomes a menu entry instead of scrolling+ * off the edge where it is easy to miss. */ @Composable fun ChipTabRow(@@ -135,17 +136,12 @@ fun ChipTabRow( onSelect: (Int) -> Unit, modifier: Modifier = Modifier, ) {- Row(- modifier = modifier- .horizontalScroll(rememberScrollState())- .padding(horizontal = Spacing.lg),- horizontalArrangement = Arrangement.spacedBy(Spacing.sm),- ) {+ ButtonGroup(modifier = modifier.padding(horizontal = Spacing.lg)) { tabs.forEachIndexed { index, label ->- FilterChip(- selected = selected == index,- onClick = { onSelect(index) },- label = { Text(label) },+ toggleableItem(+ checked = selected == index,+ label = label,+ onCheckedChange = { onSelect(index) }, ) } }
library/ui/src/main/java/com/vayunmathur/library/ui/VerticalShape.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/VerticalShape.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/VerticalShape.ktindex a816b680ac..57de9c6798 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/VerticalShape.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/VerticalShape.kt@@ -20,7 +20,7 @@ import androidx.compose.ui.unit.dp @Composable @ReadOnlyComposable fun verticalShape(index: Int, count: Int): RoundedCornerShape {- val outer = MaterialTheme.shapes.medium.topStart+ val outer = MaterialTheme.shapes.largeIncreased.topStart val inner = CornerSize(0.dp) return RoundedCornerShape( topStart = if (index == 0) outer else inner,