-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
While working on other chip issues and testing the changes I noticed the chips aren't using the correct selected & unselected ColorScheme colors for the icons in Material 3.
According to tokens and the web specs, the chips should be using the onSurfaceVariant for the unselected state and onSecondaryContainer for selected state (for the chips that don't use primary color for the selected state)
flutter/dev/tools/gen_defaults/data/chip_filter.json
Lines 64 to 87 in 0b035e0
| "md.comp.filter-chip.with-leading-icon.disabled.leading-icon.color": "onSurface", | |
| "md.comp.filter-chip.with-leading-icon.disabled.leading-icon.opacity": 0.38, | |
| "md.comp.filter-chip.with-leading-icon.selected.dragged.leading-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-leading-icon.selected.focus.leading-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-leading-icon.selected.hover.leading-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-leading-icon.selected.leading-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-leading-icon.selected.pressed.leading-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-leading-icon.unselected.dragged.leading-icon.color": "primary", | |
| "md.comp.filter-chip.with-leading-icon.unselected.focus.leading-icon.color": "primary", | |
| "md.comp.filter-chip.with-leading-icon.unselected.hover.leading-icon.color": "primary", | |
| "md.comp.filter-chip.with-leading-icon.unselected.leading-icon.color": "primary", | |
| "md.comp.filter-chip.with-leading-icon.unselected.pressed.leading-icon.color": "primary", | |
| "md.comp.filter-chip.with-trailing-icon.disabled.trailing-icon.color": "onSurface", | |
| "md.comp.filter-chip.with-trailing-icon.disabled.trailing-icon.opacity": 0.38, | |
| "md.comp.filter-chip.with-trailing-icon.selected.dragged.trailing-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-trailing-icon.selected.focus.trailing-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-trailing-icon.selected.hover.trailing-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-trailing-icon.selected.pressed.trailing-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-trailing-icon.selected.trailing-icon.color": "onSecondaryContainer", | |
| "md.comp.filter-chip.with-trailing-icon.unselected.dragged.trailing-icon.color": "onSurfaceVariant", | |
| "md.comp.filter-chip.with-trailing-icon.unselected.focus.trailing-icon.color": "onSurfaceVariant", | |
| "md.comp.filter-chip.with-trailing-icon.unselected.hover.trailing-icon.color": "onSurfaceVariant", | |
| "md.comp.filter-chip.with-trailing-icon.unselected.pressed.trailing-icon.color": "onSurfaceVariant", | |
| "md.comp.filter-chip.with-trailing-icon.unselected.trailing-icon.color": "onSurfaceVariant" |
To reproduce run the code sample below which overrides these colors using a custom ColorScheme.
Expected results
Actual results
Code sample
Code sample
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.green).copyWith(
onSurfaceVariant: const Color(0xffff0000),
onSecondaryContainer: const Color(0xff0000ff),
),
),
home: const Example(),
);
}
}
class Example extends StatefulWidget {
const Example({super.key});
@override
State<Example> createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
const Text('Selected'),
FilterChip(
avatar: const Icon(Icons.favorite_rounded),
label: const Text('FilterChip'),
selected: true,
showCheckmark: false,
onSelected: (bool value) {}),
InputChip(
avatar: const Icon(Icons.favorite_rounded),
label: const Text('InputChip'),
selected: true,
showCheckmark: false,
onPressed: () {},
),
ChoiceChip(
avatar: const Icon(Icons.favorite_rounded),
label: const Text('ChoiceChip'),
selected: true,
showCheckmark: false,
onSelected: (bool value) {},
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
const Text('Enabled'),
FilterChip(
avatar: const Icon(Icons.favorite_rounded),
label: const Text('FilterChip'),
onSelected: (bool value) {},
),
InputChip(
avatar: const Icon(Icons.favorite_rounded),
label: const Text('InputChip'),
onPressed: () {},
),
ChoiceChip(
avatar: const Icon(Icons.favorite_rounded),
label: const Text('ChoiceChip'),
selected: false,
onSelected: (bool value) {},
),
],
),
const Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text('Disabled'),
FilterChip(
avatar: Icon(Icons.favorite_rounded),
label: Text('FilterChip'),
onSelected: null,
),
InputChip(
avatar: Icon(Icons.favorite_rounded),
label: Text('InputChip'),
isEnabled: false,
onPressed: null,
),
ChoiceChip(
avatar: Icon(Icons.favorite_rounded),
label: Text('ChoiceChip'),
selected: false,
onSelected: null,
),
],
),
],
),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel master, 3.16.0-11.0.pre.69, on macOS 14.0 23A344 darwin-arm64, locale en-US)
• Flutter version 3.16.0-11.0.pre.69 on channel master at /Users/tahatesser/Code/flutter
• Upstream repository [email protected]:TahaTesser/flutter.git
• FLUTTER_GIT_URL = [email protected]:TahaTesser/flutter.git
• Framework revision b66ab70c09 (4 hours ago), 2023-10-16 02:37:09 -0400
• Engine revision 539ad5b232
• Dart version 3.3.0 (build 3.3.0-27.0.dev)
• DevTools version 2.28.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/tahatesser/Code/android-sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_SDK_ROOT = /Users/tahatesser/Code/android-sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15A240d
• CocoaPods version 1.13.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.83.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.74.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.0 23A344 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 117.0.5938.149
[✓] Network resources
• All expected network resources are available.
• No issues found!rydmike and davidmartos96
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team

