Last active
October 17, 2023 13:08
-
-
Save GuiRitter/bbb86ce3cceccf14338419af228b4d4f to your computer and use it in GitHub Desktop.
Lack of DropDownButton menu shadow theming in Flutter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 'DropDownButton shadow test', | |
theme: ThemeData.light().copyWith( | |
colorScheme: const ColorScheme.light( | |
// TODO does nothing | |
shadow: Colors.red, | |
), | |
dialogTheme: const DialogTheme( | |
// TODO does nothing | |
shadowColor: Colors.red, | |
), | |
drawerTheme: const DrawerThemeData( | |
// TODO does nothing | |
shadowColor: Colors.red, | |
), | |
dropdownMenuTheme: const DropdownMenuThemeData( | |
menuStyle: MenuStyle( | |
// TODO only works for DropDownMenu | |
shadowColor: MaterialStatePropertyAll(Colors.red), | |
), | |
), | |
menuBarTheme: const MenuBarThemeData( | |
style: MenuStyle( | |
// TODO does nothing | |
shadowColor: MaterialStatePropertyAll(Colors.red), | |
), | |
), | |
menuButtonTheme: const MenuButtonThemeData( | |
style: ButtonStyle( | |
// TODO does nothing | |
shadowColor: MaterialStatePropertyAll(Colors.red), | |
), | |
), | |
menuTheme: const MenuBarThemeData( | |
style: MenuStyle( | |
// TODO does nothing | |
shadowColor: MaterialStatePropertyAll(Colors.red), | |
), | |
), | |
navigationBarTheme: const NavigationBarThemeData( | |
// TODO does nothing | |
shadowColor: Colors.red, | |
), | |
navigationDrawerTheme: const NavigationDrawerThemeData( | |
// TODO does nothing | |
shadowColor: Colors.red, | |
), | |
popupMenuTheme: const PopupMenuThemeData( | |
// TODO does nothing | |
shadowColor: Colors.red, | |
), | |
), | |
home: Scaffold( | |
appBar: AppBar(), | |
body: Center( | |
child: DropdownButton( | |
onChanged: (_) {}, | |
value: 1, | |
items: const [ | |
DropdownMenuItem( | |
value: 1, | |
child: Text("Item 1"), | |
), | |
DropdownMenuItem( | |
value: 2, | |
child: Text("Item 2"), | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment