Unverified Commit 35085c39 authored by Pierre-Louis's avatar Pierre-Louis Committed by GitHub

Improve documentation for `ColorSheme.fromImageProvider` (#129952)

Sample code is added, documentation condensed, and links to guidelines updated.

For b/258360306
parent a2dbd1ec
...@@ -898,29 +898,37 @@ class ColorScheme with Diagnosticable { ...@@ -898,29 +898,37 @@ class ColorScheme with Diagnosticable {
/// Generate a [ColorScheme] derived from the given `imageProvider`. /// Generate a [ColorScheme] derived from the given `imageProvider`.
/// ///
/// Material Color Utilities extracts the dominant color from the /// Material Color Utilities extracts the dominant color from the
/// supplied [ImageProvider]. Using this color, a set of tonal palettes are /// supplied [ImageProvider]. Using this color, a [ColorScheme] is generated
/// constructed. These tonal palettes are based on the Material 3 Color /// with harmnonious colors that meet contrast requirements for accessibility.
/// system and provide all the needed colors for a [ColorScheme]. These
/// colors are designed to work well together and meet contrast
/// requirements for accessibility.
/// ///
/// If any of the optional color parameters are non-null, they will be /// If any of the optional color parameters are non-null, they will be
/// used in place of the generated colors for that field in the resulting /// used in place of the generated colors for that field in the resulting
/// color scheme. This allows apps to override specific colors for their /// [ColorScheme]. This allows apps to override specific colors for their
/// needs. /// needs.
/// ///
/// Given the nature of the algorithm, the most dominant color of the /// Given the nature of the algorithm, the most dominant color of the
/// `imageProvider` may not wind up as one of the ColorScheme colors. /// `imageProvider` may not wind up as one of the [ColorScheme] colors.
/// ///
/// The provided image will be scaled down to a maximum size of 112x112 pixels /// The provided image will be scaled down to a maximum size of 112x112 pixels
/// during color extraction. /// during color extraction.
/// ///
/// {@tool dartpad}
/// This sample shows how to use [ColorScheme.fromImageProvider] to create
/// content-based dynamic color schemes.
///
/// ** See code in examples/api/lib/material/color_scheme/dynamic_content_color.0.dart **
/// {@end-tool}
///
/// See also: /// See also:
/// ///
/// * [M3 Guidelines: Dynamic color from content](https://m3.material.io/styles/color/dynamic-color/user-generated-color#8af550b9-a19e-4e9f-bb0a-7f611fed5d0f)
/// * <https://pub.dev/packages/dynamic_color>, a package to create
/// [ColorScheme]s based on a platform's implementation of dynamic color.
/// * <https://m3.material.io/styles/color/the-color-system/color-roles>, the /// * <https://m3.material.io/styles/color/the-color-system/color-roles>, the
/// Material 3 Color system specification. /// Material 3 Color system specification.
/// * <https://pub.dev/packages/material_color_utilities>, the package /// * <https://pub.dev/packages/material_color_utilities>, the package
/// used to generate the base color and tonal palettes needed for the scheme. /// used to algorightmically determine the dominant color and to generate
/// the [ColorScheme].
static Future<ColorScheme> fromImageProvider({ static Future<ColorScheme> fromImageProvider({
required ImageProvider provider, required ImageProvider provider,
Brightness brightness = Brightness.light, Brightness brightness = Brightness.light,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment