1
+ /*
2
+ * Copyright lt 2023
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1
17
package com.lt.common
2
18
3
19
import androidx.compose.foundation.Image
4
20
import androidx.compose.foundation.layout.size
5
21
import androidx.compose.foundation.lazy.LazyColumn
22
+ import androidx.compose.foundation.lazy.LazyListState
6
23
import androidx.compose.foundation.lazy.items
24
+ import androidx.compose.foundation.lazy.rememberLazyListState
7
25
import androidx.compose.runtime.Composable
8
26
import androidx.compose.ui.Modifier
9
27
import androidx.compose.ui.unit.dp
10
28
11
29
@Composable
12
- fun App () {
30
+ fun App (
31
+ lazyColumnState : LazyListState = rememberLazyListState()
32
+ ) {
13
33
val images = listOf (
14
34
// Correct
15
35
" C:\\ SpringBootFiles\\ imgs\\ 7633948650d6b30461fce6d13422ec3a.jpeg" ,
@@ -28,7 +48,7 @@ fun App() {
28
48
" https://img.zcool.cn/community/017e625e57415ea80121128c25819.jpg@1280w_1l_2o_100sh.jpg" ,
29
49
)
30
50
31
- LazyColumn {
51
+ LazyColumn (state = lazyColumnState) {
32
52
items(images) {
33
53
Image (rememberImagePainter(it), " " , Modifier .size(500 .dp))
34
54
}
0 commit comments