TF-1354 Support use Up/Down in keyboard to move selection in the list

This commit is contained in:
dab246
2023-01-11 09:51:18 +07:00
committed by Dat H. Pham
parent d49f276ff3
commit fb690ea078
4 changed files with 34 additions and 21 deletions
@@ -149,6 +149,12 @@ class EmailAddressInputBuilder {
suggestionsBoxMaxHeight: 300,
textStyle: const TextStyle(color: AppColor.colorEmailAddress, fontSize: 14, fontWeight: FontWeight.w500),
onDeleteTagAction: () => _handleDeleteTagAction(setState),
onSelectOptionAction: (item) {
if (!_isDuplicatedRecipient(item.emailAddress.emailAddress)) {
setState(() => listEmailAddress.add(item.emailAddress));
_onUpdateListEmailAddressAction?.call(_prefixEmailAddress, listEmailAddress);
}
},
onSubmitted: (value) {
log('EmailAddressInputBuilder::_buildTagEditor(): onSubmitted: $value');
if (!_isDuplicatedRecipient(value)) {
@@ -201,7 +207,7 @@ class EmailAddressInputBuilder {
_handleGapBetweenTagChangedAndFindSuggestion);
},
findSuggestions: _findSuggestions,
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress) {
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, highlight) {
switch (suggestionEmailAddress.state) {
case SuggestionEmailState.duplicated:
return _buildExistedSuggestionItem(setState, context, suggestionEmailAddress);
@@ -315,7 +321,8 @@ class EmailAddressInputBuilder {
log('EmailAddressInputBuilder::_buildSuggestionItem(): onTap: $suggestionEmailAddress');
setState(() => listEmailAddress.add(suggestionEmailAddress.emailAddress));
_onUpdateListEmailAddressAction?.call(_prefixEmailAddress, listEmailAddress);
tagEditorState.selectSuggestion(suggestionEmailAddress);
tagEditorState.closeSuggestionBox();
tagEditorState.resetTextField();
},
);
}
@@ -123,7 +123,7 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
);
},
findSuggestions: _findSuggestions,
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress) {
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, highlight) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: ContactSuggestionBoxItem(
@@ -132,7 +132,8 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
borderRadius: BorderRadius.all(Radius.circular(12))),
selectedContactCallbackAction: (contact) {
setState(() => listEmailAddress.add(contact));
tagEditorState.selectSuggestion(suggestionEmailAddress);
tagEditorState.closeSuggestionBox();
tagEditorState.resetTextField();
},
),
);
@@ -199,6 +200,11 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
teamMailSuggestion.addAll(_matchedSuggestionEmailAddress(processedQuery, listEmailAddress));
final currentTextOnTextField = widget.controller?.text ?? '';
if (currentTextOnTextField.isEmpty) {
return [];
}
return teamMailSuggestion.toSet().toList();
}
+16 -16
View File
@@ -14,7 +14,7 @@ packages:
name: _flutterfire_internals
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.10"
version: "1.0.11"
analyzer:
dependency: transitive
description:
@@ -154,21 +154,21 @@ packages:
name: cloud_firestore_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.9.1"
version: "5.10.0"
cloud_firestore_web:
dependency: transitive
description:
name: cloud_firestore_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
version: "3.2.0"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.0"
version: "4.4.0"
collection:
dependency: "direct main"
description:
@@ -480,7 +480,7 @@ packages:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.1.0"
firebase_messaging:
dependency: "direct main"
description:
@@ -494,14 +494,14 @@ packages:
name: firebase_messaging_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.8"
version: "4.2.9"
firebase_messaging_web:
dependency: transitive
description:
name: firebase_messaging_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.9"
version: "3.2.10"
fixnum:
dependency: transitive
description:
@@ -837,7 +837,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.2"
version: "3.3.0"
infinite_listview:
dependency: transitive
description:
@@ -871,7 +871,7 @@ packages:
description:
path: "."
ref: master
resolved-ref: "66ef334ac2cf4d5cb30835b30094a51802fae2ba"
resolved-ref: b848fdda3c48c78594a804bb609e1077bb42125d
url: "https://github.com/linagora/jmap-dart-client.git"
source: git
version: "0.0.1"
@@ -1256,14 +1256,14 @@ packages:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
version: "2.0.5"
shared_preferences_platform_interface:
dependency: transitive
description:
@@ -1284,7 +1284,7 @@ packages:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
shelf:
dependency: transitive
description:
@@ -1380,14 +1380,14 @@ packages:
name: super_tag_editor
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3+3"
version: "0.0.3+4"
syncfusion_flutter_core:
dependency: transitive
description:
name: syncfusion_flutter_core
url: "https://pub.dartlang.org"
source: hosted
version: "20.3.60"
version: "20.4.43"
syncfusion_flutter_datepicker:
dependency: transitive
description:
@@ -1436,7 +1436,7 @@ packages:
name: timezone
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0"
version: "0.9.1"
timing:
dependency: transitive
description:
@@ -1611,7 +1611,7 @@ packages:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+2"
version: "0.2.0+3"
xml:
dependency: "direct dev"
description:
+1 -1
View File
@@ -99,7 +99,7 @@ dependencies:
filesize: 2.0.1
# super_tag_editor
super_tag_editor: 0.0.3+3
super_tag_editor: 0.0.3+4
# uuid
uuid: 3.0.4