Skip to content

surfaceTint, field of ColorScheme, can’t be overwritten #104350

@epentesi

Description

@epentesi

Steps to Reproduce

  1. Make a custom ColorScheme named customColorScheme using ColorScheme.fromSeed()
  2. The seedColoris Colors.orange
  3. Set surfaceTint to Colors.green using copyWith()
ColorScheme customColorScheme = ColorScheme.fromSeed(seedColor: Colors.orange)
.copyWith(
  surfaceTint: Colors.green,
);
  1. Make a Container with color: customColorScheme.surfaceTint
Container(
  width: 100,
  height: 100,
  color: customColorScheme.surfaceTint,
)

Expected results:
A Container filled with Colors.green color

Actual results:
A Container filled with customColorScheme.primary color (tone 40 of Colors.orange used as seed)

Steps to solve the bug:

  1. Open color_scheme.dart from flutter/packages/flutter/lib/src/material/
  2. Change line 840 from
    surfaceTint: _surfaceTint ?? this.surfaceTint,
    to
    surfaceTint: surfaceTint ?? this.surfaceTint,

Metadata

Metadata

Assignees

Labels

f: material designflutter/packages/flutter/material repository.found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions