@@ -16,6 +16,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
16
16
required this .barrierCoversButton,
17
17
required this .parentFocusNode,
18
18
required this .enableFeedback,
19
+ required this .textDirection,
19
20
required this .dropdownStyle,
20
21
required this .menuItemStyle,
21
22
required this .inputDecorationPadding,
@@ -34,6 +35,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
34
35
final TextStyle style;
35
36
final FocusNode parentFocusNode;
36
37
final bool enableFeedback;
38
+ final TextDirection ? textDirection;
37
39
final DropdownStyleData dropdownStyle;
38
40
final MenuItemStyleData menuItemStyle;
39
41
final EdgeInsets ? inputDecorationPadding;
@@ -61,46 +63,49 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
61
63
62
64
@override
63
65
Widget buildPage (BuildContext context, _, __) {
64
- return FocusScope .withExternalFocusNode (
65
- focusScopeNode: _childNode,
66
- parentNode: parentFocusNode,
67
- child: LayoutBuilder (
68
- builder: (BuildContext ctx, BoxConstraints constraints) {
69
- //Exclude BottomInset from maxHeight to avoid overlapping menu items
70
- //with keyboard when using searchable dropdown.
71
- //This will ensure menu is drawn in the actual available height.
72
- final padding = MediaQuery .paddingOf (context);
73
- final viewInsets = MediaQuery .viewInsetsOf (context);
74
- final BoxConstraints actualConstraints =
75
- constraints.copyWith (maxHeight: constraints.maxHeight - viewInsets.bottom);
76
- final EdgeInsets mediaQueryPadding =
77
- dropdownStyle.useSafeArea ? padding : EdgeInsets .zero;
78
- return ValueListenableBuilder <Rect ?>(
79
- valueListenable: buttonRect,
80
- builder: (BuildContext context, Rect ? rect, _) {
81
- final routePage = _DropdownRoutePage <T >(
82
- route: this ,
83
- constraints: actualConstraints,
84
- mediaQueryPadding: mediaQueryPadding,
85
- buttonRect: rect! ,
86
- selectedIndex: selectedIndex,
87
- capturedThemes: capturedThemes,
88
- style: style,
89
- enableFeedback: enableFeedback,
90
- );
91
- return barrierCoversButton
92
- ? routePage
93
- : _CustomModalBarrier (
94
- barrierColor: _altBarrierColor,
95
- animation: animation,
96
- barrierCurve: barrierCurve,
97
- buttonRect: rect,
98
- buttonBorderRadius: buttonBorderRadius ?? BorderRadius .zero,
99
- child: routePage,
100
- );
101
- },
102
- );
103
- },
66
+ return Directionality (
67
+ textDirection: textDirection ?? Directionality .of (context),
68
+ child: FocusScope .withExternalFocusNode (
69
+ focusScopeNode: _childNode,
70
+ parentNode: parentFocusNode,
71
+ child: LayoutBuilder (
72
+ builder: (BuildContext ctx, BoxConstraints constraints) {
73
+ //Exclude BottomInset from maxHeight to avoid overlapping menu items
74
+ //with keyboard when using searchable dropdown.
75
+ //This will ensure menu is drawn in the actual available height.
76
+ final padding = MediaQuery .paddingOf (context);
77
+ final viewInsets = MediaQuery .viewInsetsOf (context);
78
+ final BoxConstraints actualConstraints =
79
+ constraints.copyWith (maxHeight: constraints.maxHeight - viewInsets.bottom);
80
+ final EdgeInsets mediaQueryPadding =
81
+ dropdownStyle.useSafeArea ? padding : EdgeInsets .zero;
82
+ return ValueListenableBuilder <Rect ?>(
83
+ valueListenable: buttonRect,
84
+ builder: (BuildContext context, Rect ? rect, _) {
85
+ final routePage = _DropdownRoutePage <T >(
86
+ route: this ,
87
+ constraints: actualConstraints,
88
+ mediaQueryPadding: mediaQueryPadding,
89
+ buttonRect: rect! ,
90
+ selectedIndex: selectedIndex,
91
+ capturedThemes: capturedThemes,
92
+ style: style,
93
+ enableFeedback: enableFeedback,
94
+ );
95
+ return barrierCoversButton
96
+ ? routePage
97
+ : _CustomModalBarrier (
98
+ barrierColor: _altBarrierColor,
99
+ animation: animation,
100
+ barrierCurve: barrierCurve,
101
+ buttonRect: rect,
102
+ buttonBorderRadius: buttonBorderRadius ?? BorderRadius .zero,
103
+ child: routePage,
104
+ );
105
+ },
106
+ );
107
+ },
108
+ ),
104
109
),
105
110
);
106
111
}
0 commit comments