⚡ Bolt: Memoize M3EThemeData in m3eThemeBridgeBuilder - #133
⚡ Bolt: Memoize M3EThemeData in m3eThemeBridgeBuilder#133google-labs-jules[bot] wants to merge 3 commits into
Conversation
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
❌ Flutter CI
📊 TODO Summary ReportTotal TODOs found: 13 📋 Click to expand TODO Details (13)📂 Files with TODOs:
🔍 Details: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)
|
✅ Flutter CI
📊 TODO Summary ReportTotal TODOs found: 24 📋 Click to expand TODO Details (24)📂 Files with TODOs:
🔍 Details: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)
|
|
@coderabbitai review |
|
|
Warning Review limit reachedNext included review available in 53 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (3)
Note
|
✅ Flutter CI
📊 TODO Summary ReportTotal TODOs found: 24 📋 Click to expand TODO Details (24)📂 Files with TODOs:
🔍 Details: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)
|
⚡ 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)),会导致重复分配M3EThemeData、M3EColorScheme及mui.TextTheme内存对象,增加 GC 压力。📊 预期提升(Impact):
消除顶层组件重建时冗余的主题对象映射与内存分配,减少 GC 频繁触发,提升页面切换和 Overlay 弹出时的流畅度。
🔬 测量方法(Measurement):
新增
test/unit/theme/m3e_bridge_test.dart单元测试,验证在ThemeData保持不变时M3ETheme.of(ctx)获取到的是同一个M3EThemeData对象引用(identical为true),而当主题切换时能够正确更新。PR created automatically by Jules for task 6663067714700650214 started by @DylanBolin42
Summary by CodeRabbit
性能优化
测试