Skip to content

Conversation

@schultek
Copy link
Contributor

@schultek schultek commented Nov 20, 2025

Adds a new CodePreview component to replace usages of the code_and_image partial.

Fixes: #12727

  • Column layout (default):
Bildschirmfoto 2025-11-20 um 14 03 53 - Row layout: Bildschirmfoto 2025-11-20 um 14 03 42

@schultek schultek requested a review from parlough November 20, 2025 13:04
@schultek schultek requested review from a team and sfshaza2 as code owners November 20, 2025 13:04
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @schultek, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new CodePreview component, designed to provide a more robust and flexible way to present code snippets alongside visual previews within the documentation. By replacing the older code_and_image partial, this change centralizes the logic and styling for such content, improving consistency and maintainability. The new component supports configurable layouts, allowing for both column and row arrangements of code and preview elements, and includes dedicated styling to ensure a polished presentation.

Highlights

  • New CodePreview Component: Introduced a new Dart component named CodePreview to display code blocks alongside preview content, offering a more structured and flexible approach.
  • Replaced code_and_image Partial: The new CodePreview component directly replaces the older code_and_image partial, centralizing the logic and presentation for such content.
  • Flexible Layout Options: The CodePreview component supports configurable layouts, allowing content to be displayed in either a column (default) or a row arrangement, controlled via a direction attribute.
  • CSS Refactoring: Corresponding CSS styles were added for the new .code-preview component, including flexbox properties for responsive layouts, while the deprecated .code-and-image styles were removed.
  • Content Migration: Several existing markdown documentation files were updated to utilize the new <CodePreview> component, demonstrating its usage and ensuring consistency across the site.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new CodePreview component to replace the old code_and_image partial, which is a great improvement for consistency and maintainability. The implementation looks solid, and the refactoring across the markdown files is well-executed.

I've found a couple of issues:

  • A high-severity bug in the new CodePreview component where a component attribute is being read with the wrong case, which will prevent it from working as expected.
  • A medium-severity theming issue where a hardcoded color is used, which will cause problems in dark mode.
  • A medium-severity accessibility issue with incorrect alt text for an image in one of the updated markdown files.

After addressing these points, the PR should be in excellent shape.

@schultek schultek force-pushed the feat/code-preview-component branch 2 times, most recently from 69376fa to db7861c Compare November 20, 2025 16:42
@flutter-website-bot
Copy link
Collaborator

flutter-website-bot commented Nov 20, 2025

Visit the preview URL for this PR (updated for commit e5d3bf3):

https://flutter-docs-prod--pr12731-feat-code-preview-component-r7393xt0.web.app

Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love love it, much better than I imaged.

Thanks for including the row/col support and the previewcolor is a good idea too.

@schultek schultek force-pushed the feat/code-preview-component branch from db7861c to e5d3bf3 Compare November 21, 2025 11:36
@schultek schultek merged commit 13645b9 into main Nov 21, 2025
9 checks passed
@schultek schultek deleted the feat/code-preview-component branch November 21, 2025 11:51
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.

Migrate code-and-image include to Jaspr

3 participants