- 31 Jan, 2024 2 commits
-
-
Polina Cherkasova authored
-
Ian Hickson authored
fixes [`DropdownMenu` doesn't have a focusNode](https://github.com/flutter/flutter/issues/142384) ### Code sample <details> <summary>expand to view the code sample</summary> ```dart import 'package:flutter/material.dart'; enum TShirtSize { s('S'), m('M'), l('L'), xl('XL'), xxl('XXL'), ; const TShirtSize(this.label); final String label; } void main() => runApp(const MyApp()); class MyApp extends StatefulWidget { const MyApp({super.key}); @override State<MyApp> createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { final FocusNode _focusNode = FocusNode(); @override void dispose() { _focusNode.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( appBar: AppBar( title: const Text('DropdownMenu Sample'), ), body: Center( child: DropdownMenu<TShirtSize>( focusNode: _focusNode, initialSelection: TShirtSize.m, label: const Text('T-Shirt Size'), dropdownMenuEntries: TShirtSize.values.map((e) { return DropdownMenuEntry<TShirtSize>( value: e, label: e.label, ); }).toList(), ), ), floatingActionButton: FloatingActionButton.extended( onPressed: () { _focusNode.requestFocus(); }, label: const Text('Request Focus on DropdownMenu'), ), ), ); } } ``` </details>
-
- 04 Jan, 2024 1 commit
-
-
Qun Cheng authored
Fixes #140162 This PR is to add a scrollbar for MenuAnchor and DropdownMenu for all platforms when height is limited. Previously, a scrollbar only shows on desktop platforms. This PR also disabled scrollbar's overscroll for MenuAnchor and DropdownMenu. <img src="https://github.com/flutter/flutter/assets/36861262/9ca3d4d0-415f-43bf-9d2b-df96a42db620" width="250"/><img src="https://github.com/flutter/flutter/assets/36861262/18da8d02-586b-4aa4-b647-927691542429" width="350"/>
-
- 15 Dec, 2023 1 commit
-
-
Polina Cherkasova authored
-
- 05 Dec, 2023 1 commit
-
-
Greg Spencer authored
## Description When a DropdownMenu exists within another menu and a MenuItem is selected, the `TextEditingController` of the DropdownMenu is used after it has been disposed. This PR manages the local `TextController` instance better, making sure that the one used when building is the current one, and handling the case where the `controller` is set on the widget after initial creation. Also, places where we were setting the text and selection separately were converted to use `TextEditingValue` and set the value atomically. ## Related Issues - Fixes https://github.com/flutter/flutter/issues/139266 ## Tests - Added tests (Created by @josh-burton in https://github.com/flutter/flutter/pull/139268 - Thanks Josh!)
-
- 19 Oct, 2023 1 commit
-
-
Qun Cheng authored
Fixes #136735 This PR is to add a searchCallback to allow users to customize the search algorithm. This feature is used to fix b/305662376 which needs an exact match algorithm.
-
- 18 Oct, 2023 1 commit
-
-
Greg Spencer authored
## Description This converts the `MenuAnchor` class to use `OverlayPortal` instead of directly using the overlay. ## Related Issues - Fixes https://github.com/flutter/flutter/issues/124830 ## Tests - No tests yet (hence it is a draft)
-
- 10 Oct, 2023 1 commit
-
-
Kostia Sokolovskyi authored
-
- 22 Sep, 2023 1 commit
-
-
Qun Cheng authored
Fixes #131350 This PR is to remove the extra padding in `DropdownMenuEntry` if both the text field and the dropdown menu entry have leading icons. **After** fix: <img width="300" alt="Screenshot 2023-09-19 at 4 35 24 PM" src="https://github.com/flutter/flutter/assets/36861262/ed7d92a5-3f96-4106-a03e-09258ea3709f"> **Before** fix: <img width="300" alt="Screenshot 2023-09-19 at 4 37 58 PM" src="https://github.com/flutter/flutter/assets/36861262/fdbfef54-6c93-48fb-bd64-41fa31dde531">
-
- 29 Aug, 2023 1 commit
-
-
Hans Muller authored
-
- 22 Aug, 2023 1 commit
-
-
Taha Tesser authored
Related https://github.com/flutter/flutter/issues/131676 ## Description #### Fix default input text style for `DropdownMenu`  ### Fix default text style for `MenuAnchor`'s menu items (which `DropdownMenu` uses for menu items)  ### Default `DropdownMenu` Input text style  ### Default `DropdownMenu` menu item text style  ### Default `MenuAnchor` menu item text style  ### Code sample <details> <summary>expand to view the code sample</summary> ```dart import 'package:flutter/material.dart'; /// Flutter code sample for [DropdownMenu]s. The first dropdown menu has an outlined border. void main() => runApp(const DropdownMenuExample()); class DropdownMenuExample extends StatefulWidget { const DropdownMenuExample({super.key}); @override State<DropdownMenuExample> createState() => _DropdownMenuExampleState(); } class _DropdownMenuExampleState extends State<DropdownMenuExample> { final TextEditingController colorController = TextEditingController(); final TextEditingController iconController = TextEditingController(); ColorLabel? selectedColor; IconLabel? selectedIcon; @override Widget build(BuildContext context) { final List<DropdownMenuEntry<ColorLabel>> colorEntries = <DropdownMenuEntry<ColorLabel>>[]; for (final ColorLabel color in ColorLabel.values) { colorEntries.add( DropdownMenuEntry<ColorLabel>( value: color, label: color.label, enabled: color.label != 'Grey'), ); } final List<DropdownMenuEntry<IconLabel>> iconEntries = <DropdownMenuEntry<IconLabel>>[]; for (final IconLabel icon in IconLabel.values) { iconEntries .add(DropdownMenuEntry<IconLabel>(value: icon, label: icon.label)); } return MaterialApp( theme: ThemeData( useMaterial3: true, colorSchemeSeed: Colors.green, // textTheme: const TextTheme( // bodyLarge: TextStyle( // fontWeight: FontWeight.bold, // fontStyle: FontStyle.italic, // decoration: TextDecoration.underline, // ), // ), ), home: Scaffold( body: SafeArea( child: Column( children: <Widget>[ const Text('DropdownMenus'), Padding( padding: const EdgeInsets.symmetric(vertical: 20), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ DropdownMenu<ColorLabel>( controller: colorController, label: const Text('Color'), dropdownMenuEntries: colorEntries, onSelected: (ColorLabel? color) { setState(() { selectedColor = color; }); }, ), const SizedBox(width: 20), DropdownMenu<IconLabel>( controller: iconController, enableFilter: true, leadingIcon: const Icon(Icons.search), label: const Text('Icon'), dropdownMenuEntries: iconEntries, inputDecorationTheme: const InputDecorationTheme( filled: true, contentPadding: EdgeInsets.symmetric(vertical: 5.0), ), onSelected: (IconLabel? icon) { setState(() { selectedIcon = icon; }); }, ), ], ), ), const Text('Plain TextFields'), Padding( padding: const EdgeInsets.symmetric(vertical: 20), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ SizedBox( width: 150, child: TextField( controller: TextEditingController(text: 'Blue'), decoration: const InputDecoration( suffixIcon: Icon(Icons.arrow_drop_down), labelText: 'Color', border: OutlineInputBorder(), )), ), const SizedBox(width: 20), SizedBox( width: 150, child: TextField( controller: TextEditingController(text: 'Smile'), decoration: const InputDecoration( prefixIcon: Icon(Icons.search), suffixIcon: Icon(Icons.arrow_drop_down), filled: true, labelText: 'Icon', )), ), ], ), ), if (selectedColor != null && selectedIcon != null) Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text( 'You selected a ${selectedColor?.label} ${selectedIcon?.label}'), Padding( padding: const EdgeInsets.symmetric(horizontal: 5), child: Icon( selectedIcon?.icon, color: selectedColor?.color, ), ) ], ) else const Text('Please select a color and an icon.') ], ), ), ), ); } } enum ColorLabel { blue('Blue', Colors.blue), pink('Pink', Colors.pink), green('Green', Colors.green), yellow('Yellow', Colors.yellow), grey('Grey', Colors.grey); const ColorLabel(this.label, this.color); final String label; final Color color; } enum IconLabel { smile('Smile', Icons.sentiment_satisfied_outlined), cloud( 'Cloud', Icons.cloud_outlined, ), brush('Brush', Icons.brush_outlined), heart('Heart', Icons.favorite); const IconLabel(this.label, this.icon); final String label; final IconData icon; } ``` </details>
-
- 10 Aug, 2023 1 commit
-
-
LongCatIsLooong authored
Migrate tests in flutter/flutter. Once the tests here and in `*_customer_testing` are migrated, the default value of the migration flag will be changed from false to true, making the rounding hack disabled by default.
-
- 08 Aug, 2023 1 commit
-
-
Jesús S Guerrero authored
Reverts flutter/flutter#130164 reverting because it cause internal google testing failures b/294917394
-
- 02 Aug, 2023 1 commit
-
-
Justin McCandless authored
Simplifying the TextField API.
-
- 24 Jul, 2023 1 commit
-
-
Sabin Neupane authored
Fixes: #130674 Before: The dropdown menu was not closed if empty text was provided After: The dropdown menu is closed even if empty text is provided https://github.com/flutter/flutter/assets/61322712/fccac501-9fca-4f60-8a94-abfc50552ec9 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
-
- 17 Jul, 2023 1 commit
-
-
Qun Cheng authored
Updated unit tests for `DropdownMenu`, `SnackBarTheme` and `Stepper` to have M2 and M3 versions. More info in #127064
-
- 11 Jul, 2023 1 commit
-
-
Qun Cheng authored
Fixes #125199 This PR is to add a new property `expandedInsets` so that the `DropdownMenu` can be expandable and has some margins around. <details><summary>Example: Setting `expandedInsets` to `EdgeInsets.zero`</summary> ```dart import 'package:flutter/material.dart'; void main() => runApp(const DropdownMenuExample()); class DropdownMenuExample extends StatefulWidget { const DropdownMenuExample({super.key}); @override State<DropdownMenuExample> createState() => _DropdownMenuExampleState(); } class _DropdownMenuExampleState extends State<DropdownMenuExample> { final TextEditingController colorController = TextEditingController(); ColorLabel? selectedColor; @override Widget build(BuildContext context) { final List<DropdownMenuEntry<ColorLabel>> colorEntries = <DropdownMenuEntry<ColorLabel>>[]; for (final ColorLabel color in ColorLabel.values) { colorEntries.add( DropdownMenuEntry<ColorLabel>(value: color, label: color.label, enabled: color.label != 'Grey'), ); } return MaterialApp( theme: ThemeData( useMaterial3: true, colorSchemeSeed: Colors.green, ), home: Scaffold( body: Center( child: Container( width: 500, height: 500, color: Colors.orange, child: DropdownMenu<ColorLabel>( expandedInsets: EdgeInsets.zero, inputDecorationTheme: const InputDecorationTheme( filled: true, fillColor: Colors.white, border: OutlineInputBorder(), ), controller: colorController, dropdownMenuEntries: colorEntries, onSelected: (ColorLabel? color) { setState(() { selectedColor = color; }); }, // expandedInsets: EdgeInsets.only(left: 35.0, right: 20.0, top: 80), ), ), ), ), ); } } enum ColorLabel { blue('Blue', Colors.blue), pink('Pink', Colors.pink), green('Green', Colors.green), yellow('Yellow', Colors.yellow), grey('Grey', Colors.grey); const ColorLabel(this.label, this.color); final String label; final Color color; } ``` <img width="500" alt="Screenshot 2023-06-28 at 11 33 20 PM" src="https://github.com/flutter/flutter/assets/36861262/e703f8a2-6e7c-45a0-86cf-d96da6dc157a"> </details>
-
- 30 Jun, 2023 1 commit
-
-
Qun Cheng authored
Fixes #120349 This PR enables `DropdownMenu` to automatically scroll to the first matching item when `enableSearch` is true. <details><summary>video example</summary> https://github.com/flutter/flutter/assets/36861262/1a7a956c-c186-44ca-9a52-d94dc21cac8a </details>
-
- 14 Jun, 2023 1 commit
-
-
Qun Cheng authored
-
- 13 Jun, 2023 1 commit
-
-
Qun Cheng authored
-
- 20 Apr, 2023 1 commit
-
-
xubaolin authored
Fixes https://github.com/flutter/flutter/issues/120567
-
- 19 Apr, 2023 1 commit
-
-
xubaolin authored
-
- 06 Apr, 2023 1 commit
-
-
Tirth authored
[DropdownMenu] add helperText & errorText to DropdownMenu Widget
-
- 31 Mar, 2023 1 commit
-
-
Qun Cheng authored
-
- 22 Mar, 2023 1 commit
-
-
Michael Goderbauer authored
Remove 1745 decorative breaks
-
- 23 Feb, 2023 1 commit
-
-
Qun Cheng authored
Co-authored-by:
Qun Cheng <quncheng@google.com>
-
- 27 Jan, 2023 1 commit
-
-
Qun Cheng authored
* Add canRequestFocus to TextField and requestFocusOnTap to DropdownMenu * Address comments * Address comments --------- Co-authored-by:
Qun Cheng <quncheng@google.com>
-
- 01 Dec, 2022 1 commit
-
-
Qun Cheng authored
-
- 29 Nov, 2022 1 commit
-
-
Qun Cheng authored
* Created ComboBox * Fixed failing tests * Reverted the menu style tests change * Addressed comments * Updated documentation and rename foregroundColor variable * Remamed ComboBox to DropdownMenu * Removed a unused import * Removed unused import Co-authored-by:
Qun Cheng <quncheng@google.com>
-