diff --git a/packages/flutter/lib/src/widgets/focus_traversal.dart b/packages/flutter/lib/src/widgets/focus_traversal.dart index 606df22bc4..583d247e10 100644 --- a/packages/flutter/lib/src/widgets/focus_traversal.dart +++ b/packages/flutter/lib/src/widgets/focus_traversal.dart @@ -1528,15 +1528,34 @@ class FocusTraversalOrder extends InheritedWidget { /// order = LexicalFocusOrder(widget.order.toString()); /// } /// +/// Color overlayColor(Set states) { +/// if (states.contains(MaterialState.focused)) { +/// return Colors.red; +/// } +/// if (states.contains(MaterialState.hovered)) { +/// return Colors.blue; +/// } +/// return null; // defer to the default overlayColor +/// } +/// +/// Color foregroundColor(Set states) { +/// if (states.contains(MaterialState.focused) || states.contains(MaterialState.hovered)) { +/// return Colors.white; +/// } +/// return null; // defer to the default foregroundColor +/// } +/// /// return FocusTraversalOrder( /// order: order, /// child: Padding( /// padding: const EdgeInsets.all(8.0), -/// child: OutlineButton( +/// child: OutlinedButton( /// focusNode: focusNode, /// autofocus: widget.autofocus, -/// focusColor: Colors.red, -/// hoverColor: Colors.blue, +/// style: ButtonStyle( +/// overlayColor: MaterialStateProperty.resolveWith(overlayColor), +/// foregroundColor: MaterialStateProperty.resolveWith(foregroundColor), +/// ), /// onPressed: () => _handleOnPressed(), /// child: Text(widget.name), /// ),