@@ -1221,7 +1221,6 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
1221
1221
Orientation ? _lastOrientation;
1222
1222
FocusNode ? _internalNode;
1223
1223
FocusNode ? get focusNode => widget.focusNode ?? _internalNode;
1224
- bool _hasPrimaryFocus = false ;
1225
1224
late Map <Type , Action <Intent >> _actionMap;
1226
1225
1227
1226
// Only used if needed to create _internalNode.
@@ -1244,14 +1243,12 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
1244
1243
onInvoke: (ButtonActivateIntent intent) => _handleTap (),
1245
1244
),
1246
1245
};
1247
- focusNode! .addListener (_handleFocusChanged);
1248
1246
}
1249
1247
1250
1248
@override
1251
1249
void dispose () {
1252
1250
WidgetsBinding .instance.removeObserver (this );
1253
1251
_removeDropdownRoute ();
1254
- focusNode! .removeListener (_handleFocusChanged);
1255
1252
_internalNode? .dispose ();
1256
1253
super .dispose ();
1257
1254
}
@@ -1262,25 +1259,11 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
1262
1259
_lastOrientation = null ;
1263
1260
}
1264
1261
1265
- void _handleFocusChanged () {
1266
- if (_hasPrimaryFocus != focusNode! .hasPrimaryFocus) {
1267
- setState (() {
1268
- _hasPrimaryFocus = focusNode! .hasPrimaryFocus;
1269
- });
1270
- }
1271
- }
1272
-
1273
-
1274
1262
@override
1275
1263
void didUpdateWidget (DropdownButton <T > oldWidget) {
1276
1264
super .didUpdateWidget (oldWidget);
1277
- if (widget.focusNode != oldWidget.focusNode) {
1278
- oldWidget.focusNode? .removeListener (_handleFocusChanged);
1279
- if (widget.focusNode == null ) {
1280
- _internalNode ?? = _createFocusNode ();
1281
- }
1282
- _hasPrimaryFocus = focusNode! .hasPrimaryFocus;
1283
- focusNode! .addListener (_handleFocusChanged);
1265
+ if (widget.focusNode == null ) {
1266
+ _internalNode ?? = _createFocusNode ();
1284
1267
}
1285
1268
_updateSelectedIndex ();
1286
1269
}
0 commit comments