diff --git a/packages/flutter/lib/src/material/dropdown_menu.dart b/packages/flutter/lib/src/material/dropdown_menu.dart index 703962f7b7b..9d3504bbe5e 100644 --- a/packages/flutter/lib/src/material/dropdown_menu.dart +++ b/packages/flutter/lib/src/material/dropdown_menu.dart @@ -194,6 +194,7 @@ class DropdownMenu extends StatefulWidget { this.closeBehavior = DropdownMenuCloseBehavior.all, this.maxLines = 1, this.textInputAction, + this.cursorHeight, this.restorationId, }) : assert(filterCallback == null || enableFilter), assert( @@ -558,6 +559,9 @@ class DropdownMenu extends StatefulWidget { /// {@macro flutter.widgets.TextField.textInputAction} final TextInputAction? textInputAction; + /// {@macro flutter.widgets.editableText.cursorHeight} + final double? cursorHeight; + /// {@macro flutter.material.textfield.restorationId} final String? restorationId; @@ -1112,6 +1116,7 @@ class _DropdownMenuState extends State> { textAlignVertical: TextAlignVertical.center, maxLines: widget.maxLines, textInputAction: widget.textInputAction, + cursorHeight: widget.cursorHeight, style: effectiveTextStyle, controller: _effectiveTextEditingController, onEditingComplete: _handleEditingComplete, diff --git a/packages/flutter/test/material/dropdown_menu_test.dart b/packages/flutter/test/material/dropdown_menu_test.dart index 89d66a32332..33d44810e9e 100644 --- a/packages/flutter/test/material/dropdown_menu_test.dart +++ b/packages/flutter/test/material/dropdown_menu_test.dart @@ -4515,6 +4515,23 @@ void main() { expect(selectedValueText.style.color, disabledColor); }, ); + + testWidgets('DropdownMenu can set cursorHeight', (WidgetTester tester) async { + const double cursorHeight = 4.0; + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: DropdownMenu( + cursorHeight: cursorHeight, + dropdownMenuEntries: menuChildren, + ), + ), + ), + ); + + final EditableText editableText = tester.widget(find.byType(EditableText)); + expect(editableText.cursorHeight, cursorHeight); + }); } enum TestMenu {