Fix out of memory in when type recipient composer
This commit is contained in:
@@ -247,7 +247,7 @@ class EmailAddressInputBuilder {
|
|||||||
return _buildExistedSuggestionItem(
|
return _buildExistedSuggestionItem(
|
||||||
setState,
|
setState,
|
||||||
context,
|
context,
|
||||||
suggestionEmailAddress,
|
suggestionEmailAddress.emailAddress,
|
||||||
suggestionValid
|
suggestionValid
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
@@ -255,7 +255,7 @@ class EmailAddressInputBuilder {
|
|||||||
setState,
|
setState,
|
||||||
context,
|
context,
|
||||||
tagEditorState,
|
tagEditorState,
|
||||||
suggestionEmailAddress,
|
suggestionEmailAddress.emailAddress,
|
||||||
index,
|
index,
|
||||||
length,
|
length,
|
||||||
highlight,
|
highlight,
|
||||||
@@ -294,7 +294,7 @@ class EmailAddressInputBuilder {
|
|||||||
Widget _buildExistedSuggestionItem(
|
Widget _buildExistedSuggestionItem(
|
||||||
StateSetter setState,
|
StateSetter setState,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
SuggestionEmailAddress suggestionEmailAddress,
|
EmailAddress emailAddress,
|
||||||
String? suggestionValid
|
String? suggestionValid
|
||||||
) {
|
) {
|
||||||
return Container(
|
return Container(
|
||||||
@@ -307,35 +307,9 @@ class EmailAddressInputBuilder {
|
|||||||
borderRadius: BorderRadius.all(Radius.circular(_suggestionBoxRadius))),
|
borderRadius: BorderRadius.all(Radius.circular(_suggestionBoxRadius))),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
leading: Container(
|
leading: _buildAvatarSuggestionItem(emailAddress),
|
||||||
width: 40,
|
title: _buildTitleSuggestionItem(emailAddress, suggestionValid),
|
||||||
height: 40,
|
subtitle: _buildSubtitleSuggestionItem(emailAddress, suggestionValid),
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: AppColor.avatarColor,
|
|
||||||
border: Border.all(color: AppColor.colorShadowBgContentEmail, width: 1.0)),
|
|
||||||
child: Text(
|
|
||||||
suggestionEmailAddress.emailAddress.asString().isNotEmpty ? suggestionEmailAddress.emailAddress.asString()[0].toUpperCase() : '',
|
|
||||||
style: const TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.w600))),
|
|
||||||
title: RichTextWidget(
|
|
||||||
textOrigin: suggestionEmailAddress.emailAddress.asString(),
|
|
||||||
wordSearched: suggestionValid ?? '',
|
|
||||||
),
|
|
||||||
subtitle: suggestionEmailAddress.emailAddress.displayName.isNotEmpty && suggestionEmailAddress.emailAddress.emailAddress.isNotEmpty
|
|
||||||
? RichTextWidget(
|
|
||||||
textOrigin: suggestionEmailAddress.emailAddress.emailAddress,
|
|
||||||
wordSearched: suggestionValid ?? '',
|
|
||||||
styleTextOrigin: const TextStyle(
|
|
||||||
color: AppColor.colorHintSearchBar,
|
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: FontWeight.normal),
|
|
||||||
styleWordSearched: const TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
trailing: SvgPicture.asset(_imagePaths.icFilterSelected,
|
trailing: SvgPicture.asset(_imagePaths.icFilterSelected,
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
@@ -349,7 +323,7 @@ class EmailAddressInputBuilder {
|
|||||||
StateSetter setState,
|
StateSetter setState,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
TagsEditorState<SuggestionEmailAddress> tagEditorState,
|
TagsEditorState<SuggestionEmailAddress> tagEditorState,
|
||||||
SuggestionEmailAddress suggestionEmailAddress,
|
EmailAddress emailAddress,
|
||||||
int index,
|
int index,
|
||||||
int length,
|
int length,
|
||||||
bool highlight,
|
bool highlight,
|
||||||
@@ -359,46 +333,73 @@ class EmailAddressInputBuilder {
|
|||||||
color: highlight ? AppColor.colorItemSelected : Colors.white,
|
color: highlight ? AppColor.colorItemSelected : Colors.white,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
leading: Container(
|
leading: _buildAvatarSuggestionItem(emailAddress),
|
||||||
width: 40,
|
title: _buildTitleSuggestionItem(emailAddress, suggestionValid),
|
||||||
height: 40,
|
subtitle: _buildSubtitleSuggestionItem(emailAddress, suggestionValid),
|
||||||
alignment: Alignment.center,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: AppColor.avatarColor,
|
|
||||||
border: Border.all(color: AppColor.colorShadowBgContentEmail, width: 1.0)),
|
|
||||||
child: Text(
|
|
||||||
suggestionEmailAddress.emailAddress.asString().isNotEmpty ? suggestionEmailAddress.emailAddress.asString()[0].toUpperCase() : '',
|
|
||||||
style: const TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.w600))),
|
|
||||||
title: RichTextWidget(
|
|
||||||
textOrigin: suggestionEmailAddress.emailAddress.asString(),
|
|
||||||
wordSearched: suggestionValid ?? '',
|
|
||||||
),
|
|
||||||
subtitle: suggestionEmailAddress.emailAddress.displayName.isNotEmpty && suggestionEmailAddress.emailAddress.emailAddress.isNotEmpty
|
|
||||||
? RichTextWidget(
|
|
||||||
textOrigin: suggestionEmailAddress.emailAddress.emailAddress,
|
|
||||||
wordSearched: suggestionValid ?? '',
|
|
||||||
styleTextOrigin: const TextStyle(
|
|
||||||
color: AppColor.colorHintSearchBar,
|
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: FontWeight.normal),
|
|
||||||
styleWordSearched: const TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
log('EmailAddressInputBuilder::_buildSuggestionItem(): onTap: $suggestionEmailAddress');
|
setState(() => listEmailAddress.add(emailAddress));
|
||||||
setState(() => listEmailAddress.add(suggestionEmailAddress.emailAddress));
|
|
||||||
_onUpdateListEmailAddressAction?.call(_prefixEmailAddress, listEmailAddress);
|
_onUpdateListEmailAddressAction?.call(_prefixEmailAddress, listEmailAddress);
|
||||||
tagEditorState.closeSuggestionBox();
|
|
||||||
tagEditorState.resetTextField();
|
tagEditorState.resetTextField();
|
||||||
|
tagEditorState.closeSuggestionBox();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildAvatarSuggestionItem(EmailAddress emailAddress) {
|
||||||
|
return Container(
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: AppColor.avatarColor,
|
||||||
|
border: Border.all(
|
||||||
|
color: AppColor.colorShadowBgContentEmail,
|
||||||
|
width: 1.0
|
||||||
|
)
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
emailAddress.asString().isNotEmpty
|
||||||
|
? emailAddress.asString()[0].toUpperCase()
|
||||||
|
: '',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTitleSuggestionItem(EmailAddress emailAddress, String? suggestionValid) {
|
||||||
|
return RichTextWidget(
|
||||||
|
textOrigin: emailAddress.asString(),
|
||||||
|
wordSearched: suggestionValid ?? ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget? _buildSubtitleSuggestionItem(EmailAddress emailAddress, String? suggestionValid) {
|
||||||
|
if (emailAddress.displayName.isNotEmpty && emailAddress.emailAddress.isNotEmpty) {
|
||||||
|
return RichTextWidget(
|
||||||
|
textOrigin: emailAddress.emailAddress,
|
||||||
|
wordSearched: suggestionValid ?? '',
|
||||||
|
styleTextOrigin: const TextStyle(
|
||||||
|
color: AppColor.colorHintSearchBar,
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.normal
|
||||||
|
),
|
||||||
|
styleWordSearched: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.bold
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query) async {
|
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query) async {
|
||||||
log('EmailAddressInputBuilder::_findSuggestions():query: $query');
|
log('EmailAddressInputBuilder::_findSuggestions():query: $query');
|
||||||
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
||||||
|
|||||||
+1
-1
@@ -1379,7 +1379,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: master
|
ref: master
|
||||||
resolved-ref: e38dc4971cb123833cf81118a2a4b94e6b348d48
|
resolved-ref: df99b9536d92fc94d5137aa118f84c1cbb9c0c11
|
||||||
url: "https://github.com/dab246/super_tag_editor.git"
|
url: "https://github.com/dab246/super_tag_editor.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.3+4"
|
version: "0.0.3+4"
|
||||||
|
|||||||
Reference in New Issue
Block a user