Skip to content

Commit

Permalink
feat: Add Ctrl+R keyboard shortcut to all the refresh sheets
Browse files Browse the repository at this point in the history
  • Loading branch information
Lastaapps committed Mar 7, 2024
1 parent 33725ee commit 2c9838f
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clipToBounds
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.isCtrlPressed
import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onKeyEvent
import androidx.compose.ui.input.nestedscroll.nestedScroll

@OptIn(ExperimentalMaterial3Api::class)
Expand All @@ -45,6 +49,13 @@ fun PullToRefreshWrapper(
Box(
modifier
.nestedScroll(state.nestedScrollConnection)
.onKeyEvent {
if ((it.isCtrlPressed && it.key == Key.R) || it.key == Key.Refresh) {
state.startRefresh()
return@onKeyEvent true
}
false
}
.clipToBounds(),
) {
content()
Expand Down

0 comments on commit 2c9838f

Please sign in to comment.