refactor: address issues from compose-lint 1.3.x

This commit is contained in:
Harsh Shandilya 2024-01-26 14:54:21 +05:30
parent 800bffbf24
commit e7d5676cb5
8 changed files with 34 additions and 34 deletions

View file

@ -230,7 +230,7 @@ private fun TagText(tag: String, modifier: Modifier = Modifier) {
@ThemePreviews
@Composable
fun LobstersCardPreview() {
private fun LobstersCardPreview() {
LobstersTheme {
LobstersCard(
post =

View file

@ -70,7 +70,7 @@ fun SearchBar(
@DevicePreviews
@ThemePreviews
@Composable
fun SearchBarPreview() {
private fun SearchBarPreview() {
LobstersTheme {
Box(Modifier.fillMaxWidth().background(MaterialTheme.colorScheme.background).padding(8.dp)) {
var value by remember { mutableStateOf("") }

View file

@ -0,0 +1,50 @@
/*
* Copyright © 2021-2024 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.common.ui.decorations
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import dev.msfjarvis.claw.common.theme.LobstersTheme
import dev.msfjarvis.claw.common.ui.preview.DevicePreviews
import dev.msfjarvis.claw.common.ui.preview.ThemePreviews
import dev.msfjarvis.claw.common.ui.surfaceColorAtNavigationBarElevation
@Composable
@OptIn(ExperimentalMaterial3Api::class)
fun ClawAppBar(
modifier: Modifier = Modifier,
navigationIcon: @Composable () -> Unit = {},
title: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
) {
TopAppBar(
title = title,
modifier = modifier.shadow(8.dp),
colors =
TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.surfaceColorAtNavigationBarElevation()
),
navigationIcon = navigationIcon,
actions = actions,
)
}
@DevicePreviews
@ThemePreviews
@Composable
private fun ClawAppBarPreview() {
LobstersTheme { ClawAppBar(title = { Text("Claw", fontWeight = FontWeight.Bold) }) }
}

View file

@ -40,6 +40,6 @@ fun MonthHeader(label: String, modifier: Modifier = Modifier) {
@DevicePreviews
@ThemePreviews
@Composable
fun MonthHeaderPreview() {
private fun MonthHeaderPreview() {
LobstersTheme { MonthHeader("April 2023") }
}