TF-4011 Support Tab shortcut key to switch focus between tag & input field
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -134,6 +134,9 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_currentListEmailAddress = widget.listEmailAddress;
|
||||
if (PlatformInfo.isWeb) {
|
||||
widget.focusNodeKeyboard?.addListener(_onFocusKeyboardListener);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -144,6 +147,20 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (PlatformInfo.isWeb) {
|
||||
widget.focusNodeKeyboard?.removeListener(_onFocusKeyboardListener);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onFocusKeyboardListener() {
|
||||
if (widget.focusNodeKeyboard?.hasFocus != true && mounted) {
|
||||
setState(() => _tagIndexFocused = -1);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool isMobileResponsive = _responsiveUtils.isMobile(context);
|
||||
@@ -406,7 +423,9 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
}
|
||||
|
||||
KeyEventResult _recipientInputOnKeyListener(FocusNode node, KeyEvent event) {
|
||||
if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.tab) {
|
||||
if (widget.focusNode?.hasFocus == true &&
|
||||
event is KeyDownEvent &&
|
||||
event.logicalKey == LogicalKeyboardKey.tab) {
|
||||
widget.nextFocusNode?.requestFocus();
|
||||
widget.onFocusNextAddressAction?.call();
|
||||
return KeyEventResult.handled;
|
||||
|
||||
Reference in New Issue
Block a user