mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-07 19:14:12 +08:00
feat: update demo
This commit is contained in:
@@ -25,6 +25,8 @@ import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.highcapable.flexiui.FlexiTheme
|
||||
import com.highcapable.flexiui.component.Text
|
||||
@@ -48,4 +50,16 @@ fun SecondaryText(text: String) {
|
||||
color = FlexiTheme.colors.textSecondary,
|
||||
style = FlexiTheme.typography.secondary
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun HapticFeedback(
|
||||
type: HapticFeedbackType = HapticFeedbackType.LongPress,
|
||||
handler: () -> Unit
|
||||
): () -> Unit {
|
||||
val hapticFeedback = LocalHapticFeedback.current
|
||||
return {
|
||||
handler()
|
||||
hapticFeedback.performHapticFeedback(type)
|
||||
}
|
||||
}
|
@@ -44,8 +44,6 @@ import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.highcapable.betterandroid.compose.multiplatform.backpress.BackHandler
|
||||
import com.highcapable.flexiui.component.Button
|
||||
@@ -61,6 +59,7 @@ import com.highcapable.flexiui.component.Text
|
||||
import com.highcapable.flexiui.component.window.FlexiDialog
|
||||
import com.highcapable.flexiui.demo.Delete
|
||||
import com.highcapable.flexiui.demo.DeleteForever
|
||||
import com.highcapable.flexiui.demo.HapticFeedback
|
||||
import com.highcapable.flexiui.demo.ListAdd
|
||||
import com.highcapable.flexiui.demo.PrimarySpacer
|
||||
import com.highcapable.flexiui.demo.bean.SimpleListBean
|
||||
@@ -155,13 +154,9 @@ fun LazyListScreen() {
|
||||
@Composable
|
||||
fun LazyItem(modifier: Modifier, index: Int) {
|
||||
Box(modifier = modifier) {
|
||||
val hapticFeedback = LocalHapticFeedback.current
|
||||
var showDropdownMenu by remember { mutableStateOf(false) }
|
||||
HorizontalItemBox(
|
||||
onLongClick = {
|
||||
showDropdownMenu = true
|
||||
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
},
|
||||
onLongClick = HapticFeedback { showDropdownMenu = true },
|
||||
title = { Text(testListData[index].title) },
|
||||
subtitle = { Text(testListData[index].subtitle) },
|
||||
showArrowIcon = false
|
||||
|
@@ -58,8 +58,8 @@ fun SecondaryScreen() {
|
||||
AreaColumn(modifier = Modifier.fillMaxWidth()) {
|
||||
Text(
|
||||
"""
|
||||
Now, you open a separate secondary page.
|
||||
You can click the button below to back to the homepage.
|
||||
Now, you open a separate secondary page.
|
||||
You can click the button below to back to the homepage.
|
||||
""".trimIndent(),
|
||||
style = FlexiTheme.typography.primary.copy(lineHeight = 2.em)
|
||||
)
|
||||
|
Reference in New Issue
Block a user