0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-25 20:55:12 +00:00

component cleanup

This commit is contained in:
X1nto 2022-02-27 13:02:02 +04:00
parent 11ac0d0e75
commit 73ee8d4f7a
3 changed files with 29 additions and 83 deletions

View file

@ -41,9 +41,36 @@ fun ManagerLazyColumn(
)
}
@Composable
fun ManagerLazyRow(
modifier: Modifier = Modifier,
state: LazyListState = rememberLazyListState(),
contentPadding: PaddingValues = PaddingValues(
start = EdgeToEdgeContentPadding,
end = EdgeToEdgeContentPadding,
),
reverseLayout: Boolean = false,
horizontalArrangement: Arrangement.Horizontal =
Arrangement.spacedBy(8.dp, if (!reverseLayout) Alignment.Start else Alignment.End),
verticalAlignment: Alignment.Vertical = Alignment.Top,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
content: LazyListScope.() -> Unit
) {
LazyRow(
modifier = modifier,
state = state,
contentPadding = contentPadding,
reverseLayout = reverseLayout,
horizontalArrangement = horizontalArrangement,
verticalAlignment = verticalAlignment,
flingBehavior = flingBehavior,
content = content
)
}
inline fun LazyListScope.managerCategory(
noinline categoryName: @Composable () -> String,
content: LazyListScope.() -> Unit,
crossinline categoryName: @Composable () -> String,
content: LazyListScope.() -> Unit
) {
item {
ManagerText(

View file

@ -1,42 +0,0 @@
package com.vanced.manager.ui.component
import androidx.compose.foundation.gestures.FlingBehavior
import androidx.compose.foundation.gestures.ScrollableDefaults
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.vanced.manager.ui.util.EdgeToEdgeContentPadding
@Composable
fun ManagerLazyRow(
modifier: Modifier = Modifier,
state: LazyListState = rememberLazyListState(),
contentPadding: PaddingValues = PaddingValues(
start = EdgeToEdgeContentPadding,
end = EdgeToEdgeContentPadding,
),
reverseLayout: Boolean = false,
horizontalArrangement: Arrangement.Horizontal =
Arrangement.spacedBy(8.dp, if (!reverseLayout) Alignment.Start else Alignment.End),
verticalAlignment: Alignment.Vertical = Alignment.Top,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
content: LazyListScope.() -> Unit
) {
LazyRow(
modifier = modifier,
state = state,
contentPadding = contentPadding,
reverseLayout = reverseLayout,
horizontalArrangement = horizontalArrangement,
verticalAlignment = verticalAlignment,
flingBehavior = flingBehavior,
content = content
)
}

View file

@ -1,39 +0,0 @@
package com.vanced.manager.ui.component
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@Composable
fun ManagerSelectableListItem(
modifier: Modifier = Modifier,
title: @Composable () -> Unit,
trailing: @Composable (() -> Unit)
) {
Row(
modifier = modifier
.padding(vertical = 8.dp, horizontal = 6.dp)
) {
Box(
modifier = Modifier
.weight(1f)
.padding(horizontal = 6.dp)
.align(Alignment.CenterVertically),
) {
title()
}
Box(
modifier = Modifier
.size(30.dp)
.align(Alignment.CenterVertically),
contentAlignment = Alignment.Center,
) {
trailing()
}
}
}