File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -140,18 +140,23 @@ setAdditionalArguments(arguments = null)
140
140
141
141
### Вызов переменной функционального типа
142
142
143
- Всегда использовать полный вариант с написанием ` invoke ` у переменной вместо использования сокращенного варианта:
143
+ Если отсутствуют договоренности внутри проекта, допускается сокращенный вызов лямбды без ` invoke ` :
144
144
145
145
``` kotlin
146
- fun runAndCall (expression : () -> Unit ): Result {
147
- val result = run ()
148
-
149
- // Bad
150
- expression()
146
+ @Composable
147
+ fun ProfileScreenContent (
148
+ header : @Composable LazyItemScope .() -> Unit ,
149
+ body : LazyListScope .() -> Unit ,
150
+ footer : @Composable LazyItemScope .() -> Unit ,
151
+ ) {
152
+ LazyColumn {
153
+ item(content = header)
151
154
// Good
152
- expression.invoke()
153
-
154
- return result
155
+ body()
156
+ // Optional
157
+ body.invoke(this @LazyColumn)
158
+ item(content = footer)
159
+ }
155
160
}
156
161
```
157
162
You can’t perform that action at this time.
0 commit comments