Skip to content

Commit 13a7211

Browse files
chagne the elevation from int to double (flutter#82340)
1 parent 1ff5665 commit 13a7211

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

packages/flutter/lib/src/material/dropdown.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class _DropdownMenuPainter extends CustomPainter {
5555
super(repaint: resize);
5656

5757
final Color? color;
58-
final int? elevation;
58+
final double? elevation;
5959
final int? selectedIndex;
6060
final Animation<double> resize;
6161
final ValueGetter<double> getSelectedItemOffset;
@@ -425,7 +425,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
425425
final EdgeInsetsGeometry padding;
426426
final Rect buttonRect;
427427
final int selectedIndex;
428-
final int elevation;
428+
final double elevation;
429429
final CapturedThemes capturedThemes;
430430
final TextStyle style;
431431
final double? itemHeight;
@@ -568,7 +568,7 @@ class _DropdownRoutePage<T> extends StatelessWidget {
568568
final EdgeInsetsGeometry padding;
569569
final Rect buttonRect;
570570
final int selectedIndex;
571-
final int elevation;
571+
final double elevation;
572572
final CapturedThemes capturedThemes;
573573
final TextStyle? style;
574574
final Color? dropdownColor;
@@ -997,12 +997,8 @@ class DropdownButton<T> extends StatefulWidget {
997997
final DropdownButtonBuilder? selectedItemBuilder;
998998

999999
/// The z-coordinate at which to place the menu when open.
1000-
///
1001-
/// The following elevations have defined shadows: 1, 2, 3, 4, 6, 8, 9, 12,
1002-
/// 16, and 24. See [kElevationToShadow].
1003-
///
10041000
/// Defaults to 8, the appropriate elevation for dropdown buttons.
1005-
final int elevation;
1001+
final double elevation;
10061002

10071003
/// The text style to use for text in the dropdown button and the dropdown
10081004
/// menu that appears when you tap the button.
@@ -1540,7 +1536,7 @@ class DropdownButtonFormField<T> extends FormField<T> {
15401536
Widget? disabledHint,
15411537
this.onChanged,
15421538
VoidCallback? onTap,
1543-
int elevation = 8,
1539+
double elevation = 8,
15441540
TextStyle? style,
15451541
Widget? icon,
15461542
Color? iconDisabledColor,

packages/flutter/test/material/dropdown_form_field_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Finder _iconRichText(Key iconKey) {
2727
Widget buildFormFrame({
2828
Key? buttonKey,
2929
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
30-
int elevation = 8,
30+
double elevation = 8,
3131
String? value = 'two',
3232
ValueChanged<String?>? onChanged,
3333
VoidCallback? onTap,
@@ -125,7 +125,7 @@ class TestApp extends StatefulWidget {
125125
State<TestApp> createState() => _TestAppState();
126126
}
127127

128-
void verifyPaintedShadow(Finder customPaint, int elevation) {
128+
void verifyPaintedShadow(Finder customPaint, double elevation) {
129129
const Rect originalRectangle = Rect.fromLTRB(0.0, 0.0, 800, 208.0);
130130

131131
final List<BoxShadow> boxShadows = List<BoxShadow>.generate(3, (int index) => kElevationToShadow[elevation]![index]);

packages/flutter/test/material/dropdown_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void checkSelectedItemTextGeometry(WidgetTester tester, String value) {
237237
expect(box0.size, equals(box1.size));
238238
}
239239

240-
void verifyPaintedShadow(Finder customPaint, int elevation) {
240+
void verifyPaintedShadow(Finder customPaint, double elevation) {
241241
const Rect originalRectangle = Rect.fromLTRB(0.0, 0.0, 800, 208.0);
242242

243243
final List<BoxShadow> boxShadows = List<BoxShadow>.generate(3, (int index) => kElevationToShadow[elevation]![index]);

0 commit comments

Comments
 (0)