Kotlin / Kotlin/Storytale

Lambda parameter

Open
#85 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
686
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Add a function type like `() -> Unit` to the default types that Gallery can display. This will enhance the Composable manual test review experience.

In addition, the following points should be kept in mind to create a more meaningful UI Catalog.

- Provide some kind of feedback when an event occurs.
- Display Snackbar.
- Displays detailed information about the invoked event.
- Support events with arguments and return value. This has a significant effect when MVI is employed.
- It would be even better to have a UI like BottomSheet (or Drawer, Dialog) that lists the events that have occurred.
- `@Composable () -> Unit`, so that lambdas such as A can also be accepted. It is very common for UI components to provide a Slot argument.
- It would be better if the size, position, and number of elements to be placed were editable. This is because a Slot may have child elements of various sizes.

## Usage example

```kt
val `MyButton with onEvent parameter` by story {
// `lambdaParameter()` function by
val onClick: /* () -> Unit */ by lambdaParameter()

// With type parameter
val onIntent: (MyIntent) -> Unit by lambdaParameter()

// With return value
val getMyData: /* () -> MyData */ by lambdaParameter()

// With event label
// - This is useful to distinguish between multiple parameters of a function type.
val onClickWithLabel: /* () -> Unit */ by parameter(label = "onClick" /* Might as well have it set up automatically. */)

MyButton(
onClick = onClick,
)

MyScreen(
onIntent = onIntent,
getMyData = getMyData,
)
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files or tests. Start at lambdaParameter() and the default types that Gallery displays; compare the usage examples for () -> Unit, typed arguments, return values, and labels. Done requires a decided scope and corresponding UI behavior for the supported function parameters and event feedback.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.