mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-12-12 13:13:44 +08:00
refactor: merge to BetterAndroid new usage
This commit is contained in:
@@ -27,8 +27,8 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import com.highcapable.betterandroid.ui.extension.component.base.toMixColor
|
||||
import com.highcapable.betterandroid.ui.extension.component.feature.SystemColors
|
||||
import com.highcapable.betterandroid.ui.extension.graphics.mixColorOf
|
||||
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
@@ -39,7 +39,7 @@ internal actual val DynamicLightColors
|
||||
@ReadOnlyComposable
|
||||
get() = if (SystemColors.isAvailable) Colors(
|
||||
backgroundPrimary = Color(DynamicColors.materialDynamicNeutral(95)),
|
||||
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(95) mix DynamicColors.materialDynamicNeutral(99)),
|
||||
backgroundSecondary = Color(mixColorOf(DynamicColors.materialDynamicNeutral(95), DynamicColors.materialDynamicNeutral(99))),
|
||||
foregroundPrimary = Color(DynamicColors.materialDynamicNeutral(99)),
|
||||
foregroundSecondary = Color(DynamicColors.materialDynamicNeutral(95)),
|
||||
themePrimary = Color(DynamicColors.materialDynamicPrimary(60)),
|
||||
@@ -55,7 +55,7 @@ internal actual val DynamicDarkColors
|
||||
@ReadOnlyComposable
|
||||
get() = if (SystemColors.isAvailable) Colors(
|
||||
backgroundPrimary = Color(DynamicColors.materialDynamicNeutral(10)),
|
||||
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(10) mix DynamicColors.materialDynamicNeutral(20)),
|
||||
backgroundSecondary = Color(mixColorOf(DynamicColors.materialDynamicNeutral(10), DynamicColors.materialDynamicNeutral(20))),
|
||||
foregroundPrimary = Color(DynamicColors.materialDynamicNeutral(20)),
|
||||
foregroundSecondary = Color(DynamicColors.materialDynamicNeutral(30)),
|
||||
themePrimary = Color(DynamicColors.materialDynamicSecondary(60)),
|
||||
@@ -71,7 +71,7 @@ internal actual val DynamicBlackColors
|
||||
@ReadOnlyComposable
|
||||
get() = if (SystemColors.isAvailable) Colors(
|
||||
backgroundPrimary = Color(DynamicColors.materialDynamicNeutral(0)),
|
||||
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(0) mix DynamicColors.materialDynamicNeutral(10)),
|
||||
backgroundSecondary = Color(mixColorOf(DynamicColors.materialDynamicNeutral(0), DynamicColors.materialDynamicNeutral(10))),
|
||||
foregroundPrimary = Color(DynamicColors.materialDynamicNeutral(10)),
|
||||
foregroundSecondary = Color(DynamicColors.materialDynamicNeutral(20)),
|
||||
themePrimary = Color(DynamicColors.materialDynamicSecondary(60)),
|
||||
@@ -85,6 +85,4 @@ internal actual val DynamicBlackColors
|
||||
private val DynamicColors
|
||||
@Composable
|
||||
@ReadOnlyComposable
|
||||
get() = SystemColors.from(LocalContext.current)
|
||||
|
||||
private infix fun Int.mix(other: Int) = toMixColor(other)
|
||||
get() = SystemColors.from(LocalContext.current)
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Flexi UI - A flexible and useful UI component library.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* https://github.com/BetterAndroid/FlexiUI
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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.
|
||||
*
|
||||
* This file is created by fankes on 2023/11/16.
|
||||
*/
|
||||
@file:Suppress("unused")
|
||||
|
||||
package com.highcapable.flexiui.window
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.input.key.KeyEvent
|
||||
import androidx.compose.ui.unit.IntOffset
|
||||
import androidx.compose.ui.window.PopupPositionProvider
|
||||
import androidx.compose.ui.window.PopupProperties
|
||||
import androidx.compose.ui.window.Popup as ComposePopup
|
||||
|
||||
@Composable
|
||||
actual fun Popup(
|
||||
alignment: Alignment,
|
||||
offset: IntOffset,
|
||||
popupPositionProvider: PopupPositionProvider?,
|
||||
onDismissRequest: (() -> Unit)?,
|
||||
properties: PopupProperties,
|
||||
onPreviewKeyEvent: ((KeyEvent) -> Boolean)?,
|
||||
onKeyEvent: ((KeyEvent) -> Boolean)?,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
popupPositionProvider?.also {
|
||||
ComposePopup(
|
||||
popupPositionProvider = it,
|
||||
onDismissRequest = onDismissRequest,
|
||||
properties = properties,
|
||||
content = content
|
||||
)
|
||||
} ?: ComposePopup(
|
||||
alignment = alignment,
|
||||
offset = offset,
|
||||
onDismissRequest = onDismissRequest,
|
||||
properties = properties,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user