Only create and use the correct rich text controller for each platform

This commit is contained in:
dab246
2024-04-23 23:26:17 +07:00
committed by Dat H. Pham
parent a2e6b78576
commit 36ab6b1ccc
8 changed files with 139 additions and 111 deletions
@@ -149,14 +149,7 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
child: FocusScope(
child: Focus(
onFocusChange: (focus) => widget.onFocusEmailAddressChangeAction?.call(widget.prefix, focus),
onKey: (focusNode, event) {
if (event is RawKeyDownEvent && event.logicalKey == LogicalKeyboardKey.tab) {
widget.nextFocusNode?.requestFocus();
widget.onFocusNextAddressAction?.call();
return KeyEventResult.handled;
}
return KeyEventResult.ignored;
},
onKey: PlatformInfo.isWeb ? _recipientInputOnKeyListener : null,
child: StatefulBuilder(
builder: (context, stateSetter) {
if (PlatformInfo.isWeb || widget.isTestingForWeb) {
@@ -389,6 +382,15 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
);
}
KeyEventResult _recipientInputOnKeyListener(FocusNode node, RawKeyEvent event) {
if (event is RawKeyDownEvent && event.logicalKey == LogicalKeyboardKey.tab) {
widget.nextFocusNode?.requestFocus();
widget.onFocusNextAddressAction?.call();
return KeyEventResult.handled;
}
return KeyEventResult.ignored;
}
bool get _isCollapse => _currentListEmailAddress.length > 1 && widget.expandMode == ExpandMode.COLLAPSE;
bool get _isAllRecipientInputEnabled => widget.fromState == PrefixRecipientState.enabled