-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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.19Found to occur in 3.19Found to occur in 3.19found in release: 3.21Found to occur in 3.21Found to occur in 3.21frameworkflutter/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 onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to reproduce
The issue is that I want to style the trailingIcon of a DropdownMenu to not have a hover effect or splash factory. The Icon is internally represented by an IconButton. Therefore I want to wrap my DropdownMenu with an IconButtonTheme and provide the style this way.
- Create a
DropdownMenuand wrap it with aIconButtonTheme - Observe that the properties set in the
IconButtonThemeare not used to style thetrailingIcon
Expected results
I expect that the IconButton within the DropdownMenu finds the Theme in the widget tree and uses the provided values.
The same behavior which is displayed when just wrapping an IconButton in an IconButtonTheme. (as seen in the Example)
Actual results
The IconButton which is wrapping the trailingIcon of the DropdownMenu is ignoring the properties provided by the IconButtonTheme.
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(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
IconButtonTheme(
data: IconButtonThemeData(
style: ButtonStyle(
splashFactory: NoSplash.splashFactory,
overlayColor: MaterialStateProperty.all(Colors.transparent),
),
),
child: IconButton(
onPressed: () {
print('');
},
icon: const Icon(Icons.ac_unit),
),
),
IconButtonTheme(
data: IconButtonThemeData(
style: ButtonStyle(
splashFactory: NoSplash.splashFactory,
overlayColor: MaterialStateProperty.all(Colors.transparent),
),
),
child: DropdownMenu(
dropdownMenuEntries: [
const DropdownMenuEntry(label: 'Item 1', value: 'Item 1'),
],
trailingIcon: const Icon(Icons.arrow_drop_down),
),
),
],
),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
Screen.Recording.2024-03-13.at.14.06.58.mov
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.19.3, on macOS 14.4 23E214 darwin-arm64, locale
en-US)
• Flutter version 3.19.3 on channel stable at
/Users/felix/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ba39319843 (6 days ago), 2024-03-07 15:22:21 -0600
• Engine revision 2e4ba9c6fb
• Dart version 3.3.1
• DevTools version 2.31.1
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/felix/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for
more details.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
and macOS development.
Download at: https://developer.apple.com/xcode/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin
code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.2)
• 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.9+0-17.0.9b1087.7-11185874)
[✓] IntelliJ IDEA Community Edition (version 2023.3.4)
• IntelliJ at /Users/felix/Applications/IntelliJ IDEA Community Edition.app
• Flutter plugin version 78.3.1
• Dart plugin version 233.13763.5
[✓] VS Code (version 1.87.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.82.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.4 23E214 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.129
[✓] Network resources
• All expected network resources are available.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.19Found to occur in 3.19Found to occur in 3.19found in release: 3.21Found to occur in 3.21Found to occur in 3.21frameworkflutter/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 onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Type
Projects
Status
Done (PR merged)