TF-3236 Display SearchSnippet in search suggest
This commit is contained in:
@@ -8,6 +8,7 @@ class RichTextBuilder extends StatefulWidget {
|
||||
final TextStyle styleWord;
|
||||
final String? preMarkedText;
|
||||
final bool ensureHighlightVisible;
|
||||
final bool? softWrap;
|
||||
|
||||
const RichTextBuilder({
|
||||
super.key,
|
||||
@@ -17,6 +18,7 @@ class RichTextBuilder extends StatefulWidget {
|
||||
required this.styleWord,
|
||||
this.preMarkedText,
|
||||
this.ensureHighlightVisible = false,
|
||||
this.softWrap,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -63,6 +65,7 @@ class _RichTextBuilderState extends State<RichTextBuilder> with AutomaticKeepAli
|
||||
),
|
||||
style: widget.styleOrigin,
|
||||
maxLines: 1,
|
||||
softWrap: widget.softWrap,
|
||||
overflow: TextOverflow.ellipsis
|
||||
);
|
||||
|
||||
|
||||
+70
-43
@@ -7,6 +7,7 @@ import 'package:model/email/presentation_email.dart';
|
||||
import 'package:model/extensions/presentation_email_extension.dart';
|
||||
import 'package:model/extensions/presentation_mailbox_extension.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
|
||||
|
||||
class EmailQuickSearchItemTileWidget extends StatelessWidget {
|
||||
|
||||
@@ -15,12 +16,14 @@ class EmailQuickSearchItemTileWidget extends StatelessWidget {
|
||||
final PresentationEmail _presentationEmail;
|
||||
final PresentationMailbox? _presentationMailbox;
|
||||
final EdgeInsetsGeometry? contentPadding;
|
||||
final SearchQuery? searchQuery;
|
||||
|
||||
EmailQuickSearchItemTileWidget(
|
||||
this._presentationEmail,
|
||||
this._presentationMailbox, {
|
||||
Key? key,
|
||||
this.contentPadding,
|
||||
this.searchQuery,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -46,54 +49,78 @@ class EmailQuickSearchItemTileWidget extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(maxWidth: maxWidthItem / 3),
|
||||
child: Text(_getInformationSender(),
|
||||
maxLines: 1,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black)),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(_presentationEmail.getEmailTitle(),
|
||||
maxLines: 1,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black)),
|
||||
),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: SvgPicture.asset(imagePath.icAttachment, width: 14, height: 14, fit: BoxFit.fill),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(maxWidth: maxWidthItem / 3),
|
||||
child: RichTextBuilder(
|
||||
textOrigin: _getInformationSender(),
|
||||
wordToStyle: searchQuery?.value ?? '',
|
||||
styleOrigin: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
),
|
||||
styleWord: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
backgroundColor: Colors.amberAccent[200],
|
||||
),
|
||||
),
|
||||
Text(_presentationEmail.getReceivedAt(Localizations.localeOf(context).toLanguageTag()),
|
||||
textAlign: TextAlign.right,
|
||||
maxLines: 1,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black))
|
||||
]),
|
||||
const SizedBox(height: 3),
|
||||
Text(_presentationEmail.getPartialContent(),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: RichTextBuilder(
|
||||
textOrigin: _presentationEmail.getEmailTitle(),
|
||||
wordToStyle: searchQuery?.value ?? '',
|
||||
preMarkedText: _presentationEmail.sanitizedSearchSnippetSubject,
|
||||
ensureHighlightVisible: true,
|
||||
styleOrigin: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
styleWord: TextStyle(
|
||||
fontSize: 13,
|
||||
backgroundColor: Colors.amberAccent[200],
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.normal
|
||||
)
|
||||
),
|
||||
),
|
||||
if (_presentationEmail.hasAttachment == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: SvgPicture.asset(imagePath.icAttachment, width: 14, height: 14, fit: BoxFit.fill),
|
||||
),
|
||||
Text(_presentationEmail.getReceivedAt(Localizations.localeOf(context).toLanguageTag()),
|
||||
textAlign: TextAlign.right,
|
||||
maxLines: 1,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: AppColor.colorContentEmail))
|
||||
]
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black))
|
||||
]),
|
||||
const SizedBox(height: 3),
|
||||
RichTextBuilder(
|
||||
textOrigin: _presentationEmail.getPartialContent(),
|
||||
wordToStyle: searchQuery?.value ?? '',
|
||||
preMarkedText: _presentationEmail.sanitizedSearchSnippetPreview,
|
||||
ensureHighlightVisible: true,
|
||||
styleOrigin: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColor.colorContentEmail,
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
styleWord: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColor.colorContentEmail,
|
||||
backgroundColor: Colors.amberAccent[200],
|
||||
)
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -28,6 +28,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/qu
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/quick_search/email_quick_search_item_tile_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/quick_search/recent_search_item_tile_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/search_filters/search_filter_button.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import 'package:tmail_ui_user/features/search/email/presentation/widgets/email_s
|
||||
import 'package:tmail_ui_user/features/search/email/presentation/widgets/email_sort_by_cupertino_action_sheet_action_builder.dart';
|
||||
import 'package:tmail_ui_user/features/search/email/presentation/widgets/empty_search_email_widget.dart';
|
||||
import 'package:tmail_ui_user/features/search/email/presentation/widgets/search_email_loading_bar_widget.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/state/search_more_email_state.dart';
|
||||
import 'package:tmail_ui_user/features/thread/presentation/styles/item_email_tile_styles.dart';
|
||||
import 'package:tmail_ui_user/features/thread/presentation/widgets/email_tile_builder.dart'
|
||||
|
||||
Reference in New Issue
Block a user