@@ -2129,6 +2129,60 @@ void main() {
2129
2129
// No exception should be thrown.
2130
2130
expect (tester.takeException (), isNull);
2131
2131
});
2132
+
2133
+ // This is a regression test for https://github.com/flutter/flutter/issues/147076.
2134
+ testWidgets ('Text field does not overflow parent' , (WidgetTester tester) async {
2135
+ await tester.pumpWidget (MaterialApp (
2136
+ home: Scaffold (
2137
+ body: SizedBox (
2138
+ width: 300 ,
2139
+ child: DropdownMenu <int >(
2140
+ dropdownMenuEntries: < DropdownMenuEntry <int >> [
2141
+ DropdownMenuEntry <int >(
2142
+ value: 0 ,
2143
+ label: 'This is a long text that is multiplied by 4 so it can overflow. ' * 4 ,
2144
+ ),
2145
+ ],
2146
+ ),
2147
+ ),
2148
+ ),
2149
+ ));
2150
+
2151
+ await tester.pump ();
2152
+ final RenderBox box = tester.firstRenderObject (find.byType (TextField ));
2153
+ expect (box.size.width, 300.0 );
2154
+ });
2155
+
2156
+ // This is a regression test for https://github.com/flutter/flutter/issues/147173.
2157
+ testWidgets ('Text field with large helper text can be selected' , (WidgetTester tester) async {
2158
+ const String labelText = 'MenuEntry 1' ;
2159
+ await tester.pumpWidget (const MaterialApp (
2160
+ home: Scaffold (
2161
+ body: Center (
2162
+ child: DropdownMenu <int >(
2163
+ hintText: 'Hint text' ,
2164
+ helperText: 'Menu Helper text' ,
2165
+ inputDecorationTheme: InputDecorationTheme (
2166
+ helperMaxLines: 2 ,
2167
+ helperStyle: TextStyle (fontSize: 30 ),
2168
+ ),
2169
+ dropdownMenuEntries: < DropdownMenuEntry <int >> [
2170
+ DropdownMenuEntry <int >(
2171
+ value: 0 ,
2172
+ label: labelText,
2173
+ ),
2174
+ ],
2175
+ ),
2176
+ ),
2177
+ ),
2178
+ ));
2179
+
2180
+ await tester.pump ();
2181
+ await tester.tapAt (tester.getCenter (find.text ('Hint text' )));
2182
+ await tester.pumpAndSettle ();
2183
+ // One is layout for the _DropdownMenuBody, the other one is the real button item in the menu.
2184
+ expect (find.widgetWithText (MenuItemButton , labelText), findsNWidgets (2 ));
2185
+ });
2132
2186
}
2133
2187
2134
2188
enum TestMenu {
0 commit comments