mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-02-17 06:56:24 +00:00
挑单Toast组件
Signed-off-by: zhangwenbin00001 <zhangwenbin35@h-partners.com>
This commit is contained in:
parent
edb7cd1ac9
commit
81907dec06
@ -152,8 +152,7 @@ void ToastView::UpdateToastContext(const RefPtr<FrameNode>& toastNode)
|
||||
toastContext->UpdateOuterBorderColor(outerColorProp);
|
||||
}
|
||||
auto toastInfo = pattern->GetToastInfo();
|
||||
ShadowStyle shadowStyle = static_cast<ShadowStyle>(toastTheme->GetShadowNormal());
|
||||
toastContext->UpdateBackShadow(toastInfo.shadow.value_or(Shadow::CreateShadow(shadowStyle)));
|
||||
toastContext->UpdateBackShadow(toastInfo.shadow.value_or(Shadow::CreateShadow(ShadowStyle::OuterDefaultMD)));
|
||||
if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) {
|
||||
auto defaultBGcolor = toastTheme->GetDefaultBGColor();
|
||||
toastContext->UpdateBackgroundColor(defaultBGcolor);
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "bridge/common/utils/engine_helper.h"
|
||||
#include "core/common/ace_engine.h"
|
||||
#include "core/components/theme/shadow_theme.h"
|
||||
#include "core/components/toast/toast_theme.h"
|
||||
#include "core/pipeline/pipeline_base.h"
|
||||
|
||||
namespace OHOS::Ace::Napi {
|
||||
namespace {
|
||||
@ -311,6 +313,16 @@ void GetToastObjectShadow(napi_env env, napi_value shadowNApi, Shadow& shadowPro
|
||||
shadowProps.SetIsFilled(isFilled);
|
||||
}
|
||||
|
||||
void GetDefaultShadow(Shadow& shadowProps)
|
||||
{
|
||||
auto pipelineContext = PipelineBase::GetCurrentContext();
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
auto toastTheme = pipelineContext->GetTheme<ToastTheme>();
|
||||
CHECK_NULL_VOID(toastTheme);
|
||||
ShadowStyle shadowStyle = static_cast<ShadowStyle>(toastTheme->GetShadowNormal());
|
||||
GetShadowFromTheme(shadowStyle, shadowProps);
|
||||
}
|
||||
|
||||
void GetToastShadow(napi_env env, napi_value shadowNApi, std::optional<Shadow>& shadow)
|
||||
{
|
||||
Shadow shadowProps;
|
||||
@ -354,7 +366,7 @@ void GetToastShadow(napi_env env, napi_value shadowNApi, std::optional<Shadow>&
|
||||
}
|
||||
GetToastObjectShadow(env, shadowNApi, shadowProps);
|
||||
} else {
|
||||
GetShadowFromTheme(ShadowStyle::OuterDefaultMD, shadowProps);
|
||||
GetDefaultShadow(shadowProps);
|
||||
}
|
||||
shadow = shadowProps;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user