Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements a comprehensive dark mode theme system for the blog, introducing a NestedThemeSwitcher component, centralizing theme initialization and synchronization scripts, and updating layouts, components, and SCSS styles to support dark mode. Feedback on the changes highlights a style guide violation where unawaited calls in ThemeSwitcher.dispose should include explanatory comments.
|
Staged preview of the updated docs.flutter.dev site (updated for commit ae56abb): https://flutter-docs-prod--docs-pr13954-blog-dark-mode-97n6shd9.web.app |
|
Staged preview of the updated flutter.dev site (updated for commit ae56abb): https://flutter-dev-230821--www-pr13954-blog-dark-mode-tcpu8yil.web.app |
parlough
left a comment
There was a problem hiding this comment.
Thanks for exploring this @conooi!
Generally looks great and like a good direction, with most of my remaining concerns about generalizing the style updates so future updates and maintenance are easier. Perhaps the capability can be expanded in the future as well.
Let me know if you have any questions or if you'd prefer I tackle any of the suggestions. Thanks again :D
|
Thanks for the review @parlough! I've updated the PR to address all of your feedback:
Ready for another look when you have a chance! |
There was a problem hiding this comment.
Code Review
This pull request introduces dark mode support across the websites by defining theme-specific CSS variables, adding a ThemeSwitcher component, and using an inline script to apply the saved theme preference before the page paints. It also refactors the blog card layout logic using a new BlogCardLayout enum, updates the header and footer to support dark-themed logos, and improves dropdown focus behavior. The review feedback highlights potential runtime TypeError risks in dropdown.dart when casting event targets directly to web.Element, and notes styling regressions in the footer where removing explicit link colors causes them to default to the global blue link color instead of inheriting the muted footer text color.
Adds dark mode support (
Light,Dark, andAutomatic) to the Flutter blog (flutter.dev/blog), matching the theme switcher experience ondart.devanddocs.flutter.dev:NestedThemeSwitcherin theflutter.devheader when viewing/blogpages and auto-closes the dropdown menu on selection.themeInitScriptandthemeSyncBodyScripthelpers inpackage:site_sharedso bothDashLayoutandBlogLayoutapply the storedlocalStorage['theme']preference before first paint and stay in sync across browser back/forward navigation (pageshow), cross-tabstorageevents, and live OSprefers-color-schemechanges..opaldark syntax highlighting overrides, header/footer dark styling, and diagram/icon contrast safeguards (--site-diagram-wrap-bgColor,.light-mode-visible,.dark-mode-visible,.theme-icon) scoped tobody.blogin_blog_page.scsswithout affecting otherflutter.devmarketing pages..blog-cardDOM class mutations inBlogCategoriesduring initial hydration when the defaultallview is already server-rendered.Fixes #13942