TF-524 Create RecentSearchCache and TypeAHeadQuickSearch widget
This commit is contained in:
+92
@@ -0,0 +1,92 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:model/email/presentation_email.dart';
|
||||
import 'package:model/extensions/presentation_email_extension.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
|
||||
class EmailQuickSearchItemTileWidget extends StatelessWidget {
|
||||
|
||||
final imagePath = Get.find<ImagePaths>();
|
||||
|
||||
final PresentationEmail _presentationEmail;
|
||||
final PresentationMailbox? _presentationMailbox;
|
||||
|
||||
EmailQuickSearchItemTileWidget(
|
||||
this._presentationEmail,
|
||||
this._presentationMailbox,
|
||||
{Key? key}
|
||||
) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
_presentationEmail.hasStarred ? imagePath.icStar : imagePath.icUnStar,
|
||||
width: 20, height: 20, fit: BoxFit.fill),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Text(_getInformationSender(),
|
||||
maxLines: 1,
|
||||
overflow: BuildUtils.isWeb ? null : TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black)),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(_presentationEmail.getEmailTitle(),
|
||||
maxLines: 1,
|
||||
overflow: BuildUtils.isWeb ? null : TextOverflow.ellipsis,
|
||||
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),
|
||||
),
|
||||
Text(_presentationEmail.getReceivedAt(Localizations.localeOf(context).toLanguageTag()),
|
||||
textAlign: TextAlign.right,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black))
|
||||
]),
|
||||
const SizedBox(height: 3),
|
||||
Text(_presentationEmail.getPartialContent(),
|
||||
maxLines: 1,
|
||||
overflow: BuildUtils.isWeb ? null : TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: AppColor.colorContentEmail))
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _getInformationSender() {
|
||||
if (_presentationMailbox?.role == PresentationMailbox.roleSent
|
||||
|| _presentationMailbox?.role == PresentationMailbox.roleDrafts
|
||||
|| _presentationMailbox?.role == PresentationMailbox.roleOutbox) {
|
||||
return _presentationEmail.recipientsName();
|
||||
}
|
||||
return _presentationEmail.getSenderName();
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/recent_search.dart';
|
||||
|
||||
class RecentSearchItemTileWidget extends StatelessWidget {
|
||||
|
||||
final imagePath = Get.find<ImagePaths>();
|
||||
|
||||
final RecentSearch recentSearch;
|
||||
|
||||
RecentSearchItemTileWidget(this.recentSearch, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(imagePath.icClockSB),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(recentSearch.value,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user