TF-2323 Update contact view for web
(cherry picked from commit 6dd055f9da7b8bb35a7826428d5b9afa3cf65e2d)
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/scrollbar_list_view.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/model/suggestion_email_address.dart';
|
||||
import 'package:tmail_ui_user/features/contact/presentation/contact_controller.dart';
|
||||
@@ -16,37 +17,33 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class ContactView extends GetWidget<ContactController> {
|
||||
|
||||
final _maxHeight = 656.0;
|
||||
final _maxWidth = 556.0;
|
||||
|
||||
const ContactView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black38,
|
||||
body: GestureDetector(
|
||||
body: PointerInterceptor(
|
||||
child: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
left: false,
|
||||
right: false,
|
||||
top: ContactUtils.supportAppBarTopBorder(context, controller.responsiveUtils),
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: _getHeightContactView(context),
|
||||
width: _getWidthContactView(context),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(ContactUtils.getRadiusBorderAppBarTop(
|
||||
context,
|
||||
controller.responsiveUtils)),
|
||||
topRight: Radius.circular(ContactUtils.getRadiusBorderAppBarTop(
|
||||
context,
|
||||
controller.responsiveUtils))),
|
||||
color: Colors.white),
|
||||
borderRadius: _getRadiusContactView(context),
|
||||
color: Colors.white
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(ContactUtils.getRadiusBorderAppBarTop(
|
||||
context,
|
||||
controller.responsiveUtils)),
|
||||
topRight: Radius.circular(ContactUtils.getRadiusBorderAppBarTop(
|
||||
context,
|
||||
controller.responsiveUtils))),
|
||||
borderRadius: _getRadiusContactView(context),
|
||||
child: SafeArea(child: Container(
|
||||
color: Colors.white,
|
||||
child: Column(children: [
|
||||
@@ -81,6 +78,25 @@ class ContactView extends GetWidget<ContactController> {
|
||||
onTextChangeSearchAction: controller.onTextSearchChange,
|
||||
onSearchTextAction: controller.onSearchTextAction,
|
||||
),
|
||||
if (PlatformInfo.isWeb && !controller.responsiveUtils.isMobile(context))
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
Obx(() => ContactSuggestionBoxItem(
|
||||
controller.getFromMeSuggestion(context),
|
||||
padding: ContactUtils.getPaddingSearchResultList(context, controller.responsiveUtils),
|
||||
selectedContactCallbackAction: (contact) {
|
||||
controller.selectContact(context, contact);
|
||||
},
|
||||
)),
|
||||
Padding(
|
||||
padding: ContactUtils.getPaddingDividerSearchResultList(context, controller.responsiveUtils),
|
||||
child: const Divider(height: 1, color: AppColor.colorDivider),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: Obx(() {
|
||||
if (controller.listContactSearched.isNotEmpty) {
|
||||
if (PlatformInfo.isMobile) {
|
||||
@@ -148,10 +164,77 @@ class ContactView extends GetWidget<ContactController> {
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
BorderRadius _getRadiusContactView(BuildContext context) {
|
||||
if (PlatformInfo.isMobile && controller.responsiveUtils.isLandscapeMobile(context)) {
|
||||
return BorderRadius.zero;
|
||||
} else if (controller.responsiveUtils.isMobile(context)) {
|
||||
return BorderRadius.only(
|
||||
topRight: Radius.circular(
|
||||
ContactUtils.getRadiusBorderAppBarTop(
|
||||
context,
|
||||
controller.responsiveUtils
|
||||
)
|
||||
),
|
||||
topLeft: Radius.circular(
|
||||
ContactUtils.getRadiusBorderAppBarTop(
|
||||
context,
|
||||
controller.responsiveUtils
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return const BorderRadius.all(Radius.circular(16));
|
||||
}
|
||||
}
|
||||
|
||||
double _getHeightContactView(BuildContext context) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
if (controller.responsiveUtils.isMobile(context)) {
|
||||
return double.infinity;
|
||||
} else {
|
||||
if (controller.responsiveUtils.getSizeScreenHeight(context) > _maxHeight) {
|
||||
return _maxHeight;
|
||||
} else {
|
||||
return double.infinity;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (controller.responsiveUtils.isLandscapeMobile(context) ||
|
||||
controller.responsiveUtils.isPortraitMobile(context)) {
|
||||
return double.infinity;
|
||||
} else {
|
||||
if (controller.responsiveUtils.getSizeScreenHeight(context) > _maxHeight) {
|
||||
return _maxHeight;
|
||||
} else {
|
||||
return double.infinity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double _getWidthContactView(BuildContext context) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
if (controller.responsiveUtils.isMobile(context)) {
|
||||
return double.infinity;
|
||||
} else {
|
||||
return _maxWidth;
|
||||
}
|
||||
} else {
|
||||
if (controller.responsiveUtils.isLandscapeMobile(context) ||
|
||||
controller.responsiveUtils.isPortraitMobile(context)) {
|
||||
return double.infinity;
|
||||
} else {
|
||||
return _maxWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SuggestionEmailAddress _toSuggestionEmailAddress(EmailAddress item, List<EmailAddress> addedEmailAddresses) {
|
||||
if (addedEmailAddresses.contains(item)) {
|
||||
return SuggestionEmailAddress(item, state: SuggestionEmailState.duplicated);
|
||||
|
||||
Reference in New Issue
Block a user