Theme: Add ElementModalBottomSheetLayout.
This commit is contained in:
parent
0af99b88a1
commit
3273685cc4
2 changed files with 62 additions and 2 deletions
|
|
@ -44,6 +44,7 @@ import io.element.android.features.messages.actionlist.model.TimelineItemAction
|
||||||
import io.element.android.features.messages.timeline.model.TimelineItem
|
import io.element.android.features.messages.timeline.model.TimelineItem
|
||||||
import io.element.android.libraries.designsystem.components.VectorIcon
|
import io.element.android.libraries.designsystem.components.VectorIcon
|
||||||
import io.element.android.libraries.designsystem.theme.ElementTheme
|
import io.element.android.libraries.designsystem.theme.ElementTheme
|
||||||
|
import io.element.android.libraries.designsystem.theme.components.ElementModalBottomSheetLayout
|
||||||
import kotlinx.coroutines.flow.filter
|
import kotlinx.coroutines.flow.filter
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|
@ -73,7 +74,7 @@ fun ActionListView(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ModalBottomSheetLayout(
|
ElementModalBottomSheetLayout(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
sheetState = modalBottomSheetState,
|
sheetState = modalBottomSheetState,
|
||||||
sheetContent = {
|
sheetContent = {
|
||||||
|
|
@ -85,7 +86,7 @@ fun ActionListView(
|
||||||
.imePadding()
|
.imePadding()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) {}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.libraries.designsystem.theme.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
|
import androidx.compose.material.ExperimentalMaterialApi
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.ModalBottomSheetDefaults
|
||||||
|
import androidx.compose.material.ModalBottomSheetLayout
|
||||||
|
import androidx.compose.material.ModalBottomSheetState
|
||||||
|
import androidx.compose.material.ModalBottomSheetValue
|
||||||
|
import androidx.compose.material.rememberModalBottomSheetState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.Shape
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
|
import io.element.android.libraries.designsystem.components.color.elementContentColorFor
|
||||||
|
import io.element.android.libraries.designsystem.theme.ElementTheme
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterialApi::class)
|
||||||
|
@Composable
|
||||||
|
fun ElementModalBottomSheetLayout(
|
||||||
|
sheetContent: @Composable ColumnScope.() -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
sheetState: ModalBottomSheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden),
|
||||||
|
sheetShape: Shape = MaterialTheme.shapes.large,
|
||||||
|
sheetElevation: Dp = ModalBottomSheetDefaults.Elevation,
|
||||||
|
sheetBackgroundColor: Color = ElementTheme.colors.surfaceVariant,
|
||||||
|
sheetContentColor: Color = elementContentColorFor(sheetBackgroundColor),
|
||||||
|
scrimColor: Color = ElementTheme.colors.onSurfaceVariant.copy(alpha = 0.32f),
|
||||||
|
content: @Composable () -> Unit = {}
|
||||||
|
) {
|
||||||
|
ModalBottomSheetLayout(
|
||||||
|
sheetContent = sheetContent,
|
||||||
|
modifier = modifier,
|
||||||
|
sheetState = sheetState,
|
||||||
|
sheetShape = sheetShape,
|
||||||
|
sheetElevation = sheetElevation,
|
||||||
|
sheetBackgroundColor = sheetBackgroundColor,
|
||||||
|
sheetContentColor = sheetContentColor,
|
||||||
|
scrimColor = scrimColor,
|
||||||
|
content = content,
|
||||||
|
)
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue