Skip to content

⚡ Bolt: Memoize M3EThemeData in m3eThemeBridgeBuilder - #133

Open
google-labs-jules[bot] wants to merge 3 commits into
mainfrom
perf/memoize-m3e-theme-data-6663067714700650214
Open

⚡ Bolt: Memoize M3EThemeData in m3eThemeBridgeBuilder#133
google-labs-jules[bot] wants to merge 3 commits into
mainfrom
perf/memoize-m3e-theme-data-6663067714700650214

Conversation

@google-labs-jules

@google-labs-jules google-labs-jules Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

⚡ Bolt: Memoize M3EThemeData in m3eThemeBridgeBuilder

💡 变更内容(What):
lib/theme/m3e_bridge.dart 中将 m3eThemeBridgeBuilder 重构为使用 _M3EThemeBridgeWidget (StatefulWidget) 包装,缓存 M3EThemeData 实例。仅在 Theme.of(context) 发生变化时才重新调用 buildM3EThemeData(theme) 重新生成 M3EThemeData

🎯 解决痛点(Why):
m3eThemeBridgeBuilder 作为 MaterialApp.builder 顶层桥接器,在每次 UI 重建(例如页面切换、Overlay 显隐)时都会被触发。之前每次直接调用 buildM3EThemeData(Theme.of(context)),会导致重复分配 M3EThemeDataM3EColorSchememui.TextTheme 内存对象,增加 GC 压力。

📊 预期提升(Impact):
消除顶层组件重建时冗余的主题对象映射与内存分配,减少 GC 频繁触发,提升页面切换和 Overlay 弹出时的流畅度。

🔬 测量方法(Measurement):
新增 test/unit/theme/m3e_bridge_test.dart 单元测试,验证在 ThemeData 保持不变时 M3ETheme.of(ctx) 获取到的是同一个 M3EThemeData 对象引用(identicaltrue),而当主题切换时能够正确更新。


PR created automatically by Jules for task 6663067714700650214 started by @DylanBolin42

Summary by CodeRabbit

  • 性能优化

    • 优化主题桥接处理:主题未发生变化时复用已生成的主题数据,减少重复计算和资源消耗。
    • 主题切换后会自动生成并应用新的主题数据。
  • 测试

    • 新增主题颜色、亮度同步及主题切换场景的测试覆盖。

@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

❌ Flutter CI

Check Result
Format & Analyze
Tests & Coverage
Build Android Check

View workflow run

📊 TODO Summary Report

Total TODOs found: 13

📋 Click to expand TODO Details (13)

📂 Files with TODOs:

File Path TODO Count
lib/pages/AppShell/app_shell.dart 1
lib/pages/SettingPage/subSettingPage/aiSetting/ai_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/focusSetting/focus_setting_page.dart 6
lib/pages/SettingPage/subSettingPage/notificationSetting/notification_setting_page.dart 2
lib/pages/SettingPage/subSettingPage/planningSetting/planning_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/storageSetting/storage_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/syncSetting/sync_setting_page.dart 1

🔍 Details:

lib/pages/AppShell/app_shell.dart (1)
  • 添加功能 (line 34)
lib/pages/SettingPage/subSettingPage/aiSetting/ai_setting_page.dart (1)
  • 接入TextField持久化逻辑 (line 45)
lib/pages/SettingPage/subSettingPage/focusSetting/focus_setting_page.dart (6)
  • 创建切换和存储逻辑 (line 47)
  • 添加逻辑和存储 (line 57)
  • 添加逻辑和存储 (line 61)
  • 添加白名单页面 (line 67)
  • 添加渲染引擎描述和建议 (line 130)
  • 可以适当添加商标icon (line 131)
lib/pages/SettingPage/subSettingPage/notificationSetting/notification_setting_page.dart (2)
  • 这里需要绑定时间 (line 114)
  • 这里需要绑定时间 (line 120)
lib/pages/SettingPage/subSettingPage/planningSetting/planning_setting_page.dart (1)
  • 添加说明description的默认颜色(浅灰,与SettingTile保持一致) (line 67)
lib/pages/SettingPage/subSettingPage/storageSetting/storage_setting_page.dart (1)
  • 补充显示逻辑 (line 42)
lib/pages/SettingPage/subSettingPage/syncSetting/sync_setting_page.dart (1)
  • 将颜色设为和其他一致 (line 333)

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

✅ Flutter CI

Check Result
Format & Analyze
Tests & Coverage
Build Android Check

View workflow run

📊 TODO Summary Report

Total TODOs found: 24

📋 Click to expand TODO Details (24)

📂 Files with TODOs:

File Path TODO Count
lib/database/app_database.dart 1
lib/pages/AppShell/app_shell.dart 2
lib/pages/InboxPage/inbox_page.dart 5
lib/pages/SettingPage/subSettingPage/aiSetting/ai_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/focusSetting/focus_setting_page.dart 6
lib/pages/SettingPage/subSettingPage/notificationSetting/notification_setting_page.dart 2
lib/pages/SettingPage/subSettingPage/planningSetting/planning_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/storageSetting/storage_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/syncSetting/sync_setting_page.dart 1
lib/router/app_router.dart 1
lib/theme/m3e_bridge.dart 1
test/widgets/inbox_page_test.dart 2

🔍 Details:

lib/database/app_database.dart (1)
  • 给所有相关方法添加Status字段 (line 49)
lib/pages/AppShell/app_shell.dart (2)
  • 修改为WoltModalSheet以增强可读性 (line 47)
  • 顶部Row取消中心切换,将按钮组写入ModalSheet的action区域 (line 57)
lib/pages/InboxPage/inbox_page.dart (5)
  • 确认左滑手势的逻辑 (line 257)
  • 改为真实用户名 (line 358)
  • 添加背景装饰和字体,以及接入真实逻辑 (line 394)
  • 添加背景装饰和字体 (line 432)
  • 根据优先级计算选择性传参 (line 537)
lib/pages/SettingPage/subSettingPage/aiSetting/ai_setting_page.dart (1)
  • 接入TextField持久化逻辑 (line 44)
lib/pages/SettingPage/subSettingPage/focusSetting/focus_setting_page.dart (6)
  • 创建切换和存储逻辑 (line 46)
  • 添加逻辑和存储 (line 56)
  • 添加逻辑和存储 (line 60)
  • 添加白名单页面 (line 66)
  • 添加渲染引擎描述和建议 (line 129)
  • 可以适当添加商标icon (line 130)
lib/pages/SettingPage/subSettingPage/notificationSetting/notification_setting_page.dart (2)
  • 这里需要绑定时间 (line 113)
  • 这里需要绑定时间 (line 119)
lib/pages/SettingPage/subSettingPage/planningSetting/planning_setting_page.dart (1)
  • 添加说明description的默认颜色(浅灰,与SettingTile保持一致) (line 66)
lib/pages/SettingPage/subSettingPage/storageSetting/storage_setting_page.dart (1)
  • 补充显示逻辑 (line 41)
lib/pages/SettingPage/subSettingPage/syncSetting/sync_setting_page.dart (1)
  • 将颜色设为和其他一致 (line 332)
lib/router/app_router.dart (1)
  • 存在多端渲染策略问题,移动端动画正常,但是桌面端出现短暂背景渲染失败问题,需要解决或抑制 (line 96)
lib/theme/m3e_bridge.dart (1)
  • 需要被抽象进theme.dart (line 120)
test/widgets/inbox_page_test.dart (2)
  • 该调试在未知情况下失败,但真机调试正常 (line 48)
  • 存在无法解释的异常,但是真机调试通过 (line 95)

@DylanBolin42

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: c9679659-b753-498f-baeb-c213a2234b61

📥 Commits

Reviewing files that changed from the base of the PR and between fdc4e72 and fbbf162.

📒 Files selected for processing (3)
  • .jules/bolt.md
  • lib/theme/m3e_bridge.dart
  • test/unit/theme/m3e_bridge_test.dart

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "version"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/memoize-m3e-theme-data-6663067714700650214

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

✅ Flutter CI

Check Result
Format & Analyze
Tests & Coverage
Build Android Check

View workflow run

📊 TODO Summary Report

Total TODOs found: 24

📋 Click to expand TODO Details (24)

📂 Files with TODOs:

File Path TODO Count
lib/database/app_database.dart 1
lib/pages/AppShell/app_shell.dart 2
lib/pages/InboxPage/inbox_page.dart 5
lib/pages/SettingPage/subSettingPage/aiSetting/ai_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/focusSetting/focus_setting_page.dart 6
lib/pages/SettingPage/subSettingPage/notificationSetting/notification_setting_page.dart 2
lib/pages/SettingPage/subSettingPage/planningSetting/planning_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/storageSetting/storage_setting_page.dart 1
lib/pages/SettingPage/subSettingPage/syncSetting/sync_setting_page.dart 1
lib/router/app_router.dart 1
lib/theme/m3e_bridge.dart 1
test/widgets/inbox_page_test.dart 2

🔍 Details:

lib/database/app_database.dart (1)
  • 给所有相关方法添加Status字段 (line 49)
lib/pages/AppShell/app_shell.dart (2)
  • 修改为WoltModalSheet以增强可读性 (line 47)
  • 顶部Row取消中心切换,将按钮组写入ModalSheet的action区域 (line 57)
lib/pages/InboxPage/inbox_page.dart (5)
  • 确认左滑手势的逻辑 (line 257)
  • 改为真实用户名 (line 358)
  • 添加背景装饰和字体,以及接入真实逻辑 (line 394)
  • 添加背景装饰和字体 (line 432)
  • 根据优先级计算选择性传参 (line 537)
lib/pages/SettingPage/subSettingPage/aiSetting/ai_setting_page.dart (1)
  • 接入TextField持久化逻辑 (line 44)
lib/pages/SettingPage/subSettingPage/focusSetting/focus_setting_page.dart (6)
  • 创建切换和存储逻辑 (line 46)
  • 添加逻辑和存储 (line 56)
  • 添加逻辑和存储 (line 60)
  • 添加白名单页面 (line 66)
  • 添加渲染引擎描述和建议 (line 129)
  • 可以适当添加商标icon (line 130)
lib/pages/SettingPage/subSettingPage/notificationSetting/notification_setting_page.dart (2)
  • 这里需要绑定时间 (line 113)
  • 这里需要绑定时间 (line 119)
lib/pages/SettingPage/subSettingPage/planningSetting/planning_setting_page.dart (1)
  • 添加说明description的默认颜色(浅灰,与SettingTile保持一致) (line 66)
lib/pages/SettingPage/subSettingPage/storageSetting/storage_setting_page.dart (1)
  • 补充显示逻辑 (line 41)
lib/pages/SettingPage/subSettingPage/syncSetting/sync_setting_page.dart (1)
  • 将颜色设为和其他一致 (line 332)
lib/router/app_router.dart (1)
  • 存在多端渲染策略问题,移动端动画正常,但是桌面端出现短暂背景渲染失败问题,需要解决或抑制 (line 96)
lib/theme/m3e_bridge.dart (1)
  • 需要被抽象进theme.dart (line 120)
test/widgets/inbox_page_test.dart (2)
  • 该调试在未知情况下失败,但真机调试正常 (line 48)
  • 存在无法解释的异常,但是真机调试通过 (line 95)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant