mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 01:03:08 +00:00
!45334 【toast】修复toast阴影热更新的bug
Merge pull request !45334 from 胡占江/hzj_toast_20241010
This commit is contained in:
commit
54ccfeded9
@ -41,6 +41,7 @@ struct ToastInfo {
|
||||
std::optional<Shadow> shadow;
|
||||
bool enableHoverMode = false;
|
||||
HoverModeAreaType hoverModeArea = HoverModeAreaType::BOTTOM_SCREEN;
|
||||
bool isTypeStyleShadow = true;
|
||||
};
|
||||
class ACE_EXPORT ToastLayoutProperty : public LayoutProperty {
|
||||
DECLARE_ACE_TYPE(ToastLayoutProperty, LayoutProperty);
|
||||
|
@ -157,7 +157,16 @@ void ToastView::UpdateToastNodeStyle(const RefPtr<FrameNode>& toastNode)
|
||||
auto toastTheme = pipelineContext->GetTheme<ToastTheme>();
|
||||
CHECK_NULL_VOID(toastTheme);
|
||||
auto toastInfo = pattern->GetToastInfo();
|
||||
toastContext->UpdateBackShadow(toastInfo.shadow.value_or(Shadow::CreateShadow(ShadowStyle::OuterDefaultMD)));
|
||||
auto shadow = toastInfo.shadow.value_or(Shadow::CreateShadow(ShadowStyle::OuterDefaultMD));
|
||||
if (toastInfo.isTypeStyleShadow) {
|
||||
auto colorMode = SystemProperties::GetColorMode();
|
||||
auto shadowStyle = shadow.GetStyle();
|
||||
auto shadowTheme = pipelineContext->GetTheme<ShadowTheme>();
|
||||
if (shadowTheme) {
|
||||
shadow = shadowTheme->GetShadow(shadowStyle, colorMode);
|
||||
}
|
||||
}
|
||||
toastContext->UpdateBackShadow(shadow);
|
||||
if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) {
|
||||
toastContext->UpdateBackgroundColor(toastInfo.backgroundColor.value_or(Color::TRANSPARENT));
|
||||
BlurStyleOption styleOption;
|
||||
|
@ -314,7 +314,7 @@ void GetToastObjectShadow(napi_env env, napi_value shadowNApi, Shadow& shadowPro
|
||||
shadowProps.SetIsFilled(isFilled);
|
||||
}
|
||||
|
||||
void GetToastShadow(napi_env env, napi_value shadowNApi, std::optional<Shadow>& shadow)
|
||||
void GetToastShadow(napi_env env, napi_value shadowNApi, std::optional<Shadow>& shadow, bool& isTypeStyleShadow)
|
||||
{
|
||||
Shadow shadowProps;
|
||||
napi_valuetype valueType = napi_undefined;
|
||||
@ -356,6 +356,7 @@ void GetToastShadow(napi_env env, napi_value shadowNApi, std::optional<Shadow>&
|
||||
}
|
||||
}
|
||||
GetToastObjectShadow(env, shadowNApi, shadowProps);
|
||||
isTypeStyleShadow = false;
|
||||
} else {
|
||||
GetShadowFromTheme(ShadowStyle::OuterDefaultMD, shadowProps);
|
||||
}
|
||||
@ -443,7 +444,7 @@ bool GetToastParams(napi_env env, napi_value argv, NG::ToastInfo& toastInfo)
|
||||
GetToastBackgroundColor(env, backgroundColorNApi, toastInfo.backgroundColor);
|
||||
GetToastTextColor(env, textColorNApi, toastInfo.textColor);
|
||||
GetToastBackgroundBlurStyle(env, backgroundBlurStyleNApi, toastInfo.backgroundBlurStyle);
|
||||
GetToastShadow(env, shadowNApi, toastInfo.shadow);
|
||||
GetToastShadow(env, shadowNApi, toastInfo.shadow, toastInfo.isTypeStyleShadow);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user