Skip to content

Commit 628c764

Browse files
committed
example: Use Icon component instead of Image
1 parent 172724d commit 628c764

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

composeApp/src/commonMain/kotlin/MainPage.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import androidx.compose.foundation.Image
21
import androidx.compose.foundation.clickable
32
import androidx.compose.foundation.layout.BoxWithConstraints
43
import androidx.compose.foundation.layout.Column
@@ -22,8 +21,6 @@ import androidx.compose.runtime.remember
2221
import androidx.compose.runtime.saveable.rememberSaveable
2322
import androidx.compose.runtime.setValue
2423
import androidx.compose.ui.Modifier
25-
import androidx.compose.ui.graphics.BlendMode
26-
import androidx.compose.ui.graphics.BlendModeColorFilter
2724
import androidx.compose.ui.unit.dp
2825
import component.OtherComponent
2926
import component.TextComponent
@@ -151,13 +148,10 @@ fun MainPage(
151148
onExpandedChange = { expanded = it },
152149
label = "Search",
153150
leadingIcon = {
154-
Image(
151+
Icon(
155152
modifier = Modifier.padding(horizontal = 16.dp),
156153
imageVector = MiuixIcons.Search,
157-
colorFilter = BlendModeColorFilter(
158-
MiuixTheme.colorScheme.onSurfaceContainer,
159-
BlendMode.SrcIn
160-
),
154+
tint = MiuixTheme.colorScheme.onSurfaceContainer,
161155
contentDescription = "Search"
162156
)
163157
},

composeApp/src/commonMain/kotlin/UITest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import androidx.compose.animation.fadeIn
55
import androidx.compose.animation.fadeOut
66
import androidx.compose.animation.shrinkHorizontally
77
import androidx.compose.animation.shrinkVertically
8-
import androidx.compose.foundation.Image
98
import androidx.compose.foundation.layout.PaddingValues
109
import androidx.compose.foundation.layout.captionBarPadding
1110
import androidx.compose.foundation.layout.fillMaxSize
@@ -30,7 +29,6 @@ import androidx.compose.runtime.setValue
3029
import androidx.compose.runtime.snapshotFlow
3130
import androidx.compose.ui.Modifier
3231
import androidx.compose.ui.graphics.Color
33-
import androidx.compose.ui.graphics.ColorFilter
3432
import androidx.compose.ui.platform.LocalUriHandler
3533
import androidx.compose.ui.unit.dp
3634
import kotlinx.coroutines.FlowPreview
@@ -145,9 +143,9 @@ fun UITest(
145143
uriHandler.openUri("https://github.com/miuix-kotlin-multiplatform/miuix")
146144
}
147145
) {
148-
Image(
146+
Icon(
149147
imageVector = MiuixIcons.GitHub,
150-
colorFilter = ColorFilter.tint(Color.White),
148+
tint = Color.White,
151149
contentDescription = "GitHub"
152150
)
153151
}

0 commit comments

Comments
 (0)