From 7d2cef287fccde0607451e6e75f286185509c83d Mon Sep 17 00:00:00 2001 From: lijianing Date: Wed, 12 Jun 2024 20:51:25 +0800 Subject: [PATCH] =?UTF-8?q?ListItemGroup=20=E9=80=82=E9=85=8D=E6=B7=B1?= =?UTF-8?q?=E6=B5=85=E8=89=B2=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lijianing Change-Id: I7831bc7805ea471013e5aa702a89f910a9131563 --- .../pattern/list/list_item_group_pattern.cpp | 17 +++++++++++++++++ .../pattern/list/list_item_group_pattern.h | 1 + .../pattern/list/list_item_pattern.cpp | 17 +++++++++++++++++ .../pattern/list/list_item_pattern.h | 1 + 4 files changed, 36 insertions(+) diff --git a/frameworks/core/components_ng/pattern/list/list_item_group_pattern.cpp b/frameworks/core/components_ng/pattern/list/list_item_group_pattern.cpp index d05a6282113..e3e9bf97456 100644 --- a/frameworks/core/components_ng/pattern/list/list_item_group_pattern.cpp +++ b/frameworks/core/components_ng/pattern/list/list_item_group_pattern.cpp @@ -33,6 +33,23 @@ void ListItemGroupPattern::OnAttachToFrameNode() } } +void ListItemGroupPattern::OnColorConfigurationUpdate() +{ + if (listItemGroupStyle_ != V2::ListItemGroupStyle::CARD) { + return; + } + auto itemGroupNode = GetHost(); + CHECK_NULL_VOID(itemGroupNode); + auto renderContext = itemGroupNode->GetRenderContext(); + CHECK_NULL_VOID(renderContext); + auto pipeline = itemGroupNode->GetContext(); + CHECK_NULL_VOID(pipeline); + auto listItemGroupTheme = pipeline->GetTheme(); + CHECK_NULL_VOID(listItemGroupTheme); + + renderContext->UpdateBackgroundColor(listItemGroupTheme->GetItemGroupDefaultColor()); +} + void ListItemGroupPattern::SetListItemGroupDefaultAttributes(const RefPtr& itemGroupNode) { auto renderContext = itemGroupNode->GetRenderContext(); diff --git a/frameworks/core/components_ng/pattern/list/list_item_group_pattern.h b/frameworks/core/components_ng/pattern/list/list_item_group_pattern.h index b8acb640ccf..4c3e8e57528 100644 --- a/frameworks/core/components_ng/pattern/list/list_item_group_pattern.h +++ b/frameworks/core/components_ng/pattern/list/list_item_group_pattern.h @@ -212,6 +212,7 @@ private: bool OnDirtyLayoutWrapperSwap(const RefPtr& dirty, const DirtySwapConfig& config) override; void OnAttachToFrameNode() override; void SetListItemGroupDefaultAttributes(const RefPtr& itemGroupNode); + void OnColorConfigurationUpdate() override; void CheckListDirectionInCardStyle(); RefPtr shallowBuilder_; RefPtr posMap_; diff --git a/frameworks/core/components_ng/pattern/list/list_item_pattern.cpp b/frameworks/core/components_ng/pattern/list/list_item_pattern.cpp index 75e84c4327d..03c9b343636 100644 --- a/frameworks/core/components_ng/pattern/list/list_item_pattern.cpp +++ b/frameworks/core/components_ng/pattern/list/list_item_pattern.cpp @@ -53,6 +53,23 @@ void ListItemPattern::OnAttachToFrameNode() } } +void ListItemPattern::OnColorConfigurationUpdate() +{ + if (listItemStyle_ != V2::ListItemStyle::CARD) { + return; + } + auto listItemNode = GetHost(); + CHECK_NULL_VOID(listItemNode); + auto renderContext = listItemNode->GetRenderContext(); + CHECK_NULL_VOID(renderContext); + auto pipeline = listItemNode->GetContext(); + CHECK_NULL_VOID(pipeline); + auto listItemTheme = pipeline->GetTheme(); + CHECK_NULL_VOID(listItemTheme); + + renderContext->UpdateBackgroundColor(listItemTheme->GetItemDefaultColor()); +} + void ListItemPattern::SetListItemDefaultAttributes(const RefPtr& listItemNode) { auto renderContext = listItemNode->GetRenderContext(); diff --git a/frameworks/core/components_ng/pattern/list/list_item_pattern.h b/frameworks/core/components_ng/pattern/list/list_item_pattern.h index ee1b12f0fee..c566399bb3e 100644 --- a/frameworks/core/components_ng/pattern/list/list_item_pattern.h +++ b/frameworks/core/components_ng/pattern/list/list_item_pattern.h @@ -236,6 +236,7 @@ private: void StartSpringMotion(float start, float end, float velocity, bool isCloseAllSwipeActions = false); void OnAttachToFrameNode() override; void SetListItemDefaultAttributes(const RefPtr& listItemNode); + void OnColorConfigurationUpdate() override; void InitListItemCardStyleForList(); void UpdateListItemAlignToCenter(); Color GetBlendGgColor(); -- Gitee