TF-3603 Adapt search bar when inside Cozy
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:core/core.dart';
|
import 'package:core/core.dart';
|
||||||
|
import 'package:cozy/cozy_config_manager/cozy_config_manager.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_portal/flutter_portal.dart';
|
import 'package:flutter_portal/flutter_portal.dart';
|
||||||
@@ -31,6 +32,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/co
|
|||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/download/download_task_item_widget.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/download/download_task_item_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/mark_mailbox_as_read_loading_banner.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/mark_mailbox_as_read_loading_banner.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/navigation_bar/navigation_bar_widget.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/navigation_bar/navigation_bar_widget.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/profile_setting/profile_setting_icon.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/recover_deleted_message_loading_banner_widget.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/recover_deleted_message_loading_banner_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/search_filters/filter_message_button.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/search_filters/filter_message_button.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/search_filters/search_filter_button.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/search_filters/search_filter_button.dart';
|
||||||
@@ -67,29 +69,38 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
child: Container(
|
child: Container(
|
||||||
color: AppColor.colorBgDesktop,
|
color: AppColor.colorBgDesktop,
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
Obx(() {
|
FutureBuilder(
|
||||||
final accountId = controller.accountId.value;
|
future: CozyConfigManager().isInsideCozy,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.data == true) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
return NavigationBarWidget(
|
return Obx(() {
|
||||||
imagePaths: controller.imagePaths,
|
final accountId = controller.accountId.value;
|
||||||
accountId: accountId,
|
|
||||||
ownEmailAddress: controller.getOwnEmailAddress(),
|
return NavigationBarWidget(
|
||||||
contactSupportCapability: accountId != null
|
imagePaths: controller.imagePaths,
|
||||||
? controller.sessionCurrent?.getContactSupportCapability(accountId)
|
accountId: accountId,
|
||||||
: null,
|
ownEmailAddress: controller.getOwnEmailAddress(),
|
||||||
searchForm: SearchInputFormWidget(),
|
contactSupportCapability: accountId != null
|
||||||
appGridController: controller.appGridDashboardController,
|
? controller.sessionCurrent?.getContactSupportCapability(accountId)
|
||||||
settingActionTypes: ProfileSettingActionType.values,
|
: null,
|
||||||
onTapApplicationLogoAction: controller.redirectToInboxAction,
|
searchForm: SearchInputFormWidget(),
|
||||||
onTapContactSupportAction: (contactSupport) =>
|
appGridController: controller.appGridDashboardController,
|
||||||
controller.onGetHelpOrReportBug(contactSupport),
|
settingActionTypes: ProfileSettingActionType.values,
|
||||||
onProfileSettingActionTypeClick: (actionType) =>
|
onTapApplicationLogoAction: controller.redirectToInboxAction,
|
||||||
controller.handleProfileSettingActionTypeClick(
|
onTapContactSupportAction: (contactSupport) =>
|
||||||
context: context,
|
controller.onGetHelpOrReportBug(contactSupport),
|
||||||
actionType: actionType,
|
onProfileSettingActionTypeClick: (actionType) =>
|
||||||
),
|
controller.handleProfileSettingActionTypeClick(
|
||||||
);
|
context: context,
|
||||||
}),
|
actionType: actionType,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
),
|
||||||
Expanded(child: Row(children: [
|
Expanded(child: Row(children: [
|
||||||
Column(children: [
|
Column(children: [
|
||||||
ComposeButtonWidget(
|
ComposeButtonWidget(
|
||||||
@@ -112,6 +123,48 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
]),
|
]),
|
||||||
Expanded(child: Column(children: [
|
Expanded(child: Column(children: [
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
FutureBuilder(
|
||||||
|
future: CozyConfigManager().isInsideCozy,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.data != true) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.sizeOf(context).width * 0.4,
|
||||||
|
height: 44,
|
||||||
|
child: SearchInputFormWidget(
|
||||||
|
fontSize: 15,
|
||||||
|
contentPadding: const EdgeInsets.only(bottom: 4),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Obx(() {
|
||||||
|
final accountId = controller.accountId.value;
|
||||||
|
final ownEmailAddress = accountId == null
|
||||||
|
? ''
|
||||||
|
: controller.getOwnEmailAddress();
|
||||||
|
|
||||||
|
return ProfileSettingIcon(
|
||||||
|
ownEmailAddress: ownEmailAddress,
|
||||||
|
settingActionTypes: ProfileSettingActionType.values,
|
||||||
|
onProfileSettingActionTypeClick: (actionType) =>
|
||||||
|
controller.handleProfileSettingActionTypeClick(
|
||||||
|
context: context,
|
||||||
|
actionType: actionType,
|
||||||
|
),
|
||||||
|
isInsideCozy: true,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
),
|
||||||
Obx(() => RecoverDeletedMessageLoadingBannerWidget(
|
Obx(() => RecoverDeletedMessageLoadingBannerWidget(
|
||||||
isLoading: controller.isRecoveringDeletedMessage.value,
|
isLoading: controller.isRecoveringDeletedMessage.value,
|
||||||
horizontalLoadingWidget: horizontalLoadingWidget,
|
horizontalLoadingWidget: horizontalLoadingWidget,
|
||||||
|
|||||||
+30
-17
@@ -2,6 +2,7 @@ import 'package:core/presentation/extensions/color_extension.dart';
|
|||||||
import 'package:core/presentation/extensions/string_extension.dart';
|
import 'package:core/presentation/extensions/string_extension.dart';
|
||||||
import 'package:core/presentation/resources/image_paths.dart';
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
import 'package:core/presentation/utils/app_toast.dart';
|
import 'package:core/presentation/utils/app_toast.dart';
|
||||||
|
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||||
import 'package:core/presentation/views/image/avatar_builder.dart';
|
import 'package:core/presentation/views/image/avatar_builder.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@@ -15,12 +16,14 @@ class ProfileSettingIcon extends StatefulWidget {
|
|||||||
final String ownEmailAddress;
|
final String ownEmailAddress;
|
||||||
final List<ProfileSettingActionType> settingActionTypes;
|
final List<ProfileSettingActionType> settingActionTypes;
|
||||||
final OnProfileSettingActionTypeClick onProfileSettingActionTypeClick;
|
final OnProfileSettingActionTypeClick onProfileSettingActionTypeClick;
|
||||||
|
final bool isInsideCozy;
|
||||||
|
|
||||||
const ProfileSettingIcon({
|
const ProfileSettingIcon({
|
||||||
super.key,
|
super.key,
|
||||||
required this.ownEmailAddress,
|
required this.ownEmailAddress,
|
||||||
required this.settingActionTypes,
|
required this.settingActionTypes,
|
||||||
required this.onProfileSettingActionTypeClick,
|
required this.onProfileSettingActionTypeClick,
|
||||||
|
this.isInsideCozy = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -57,7 +60,7 @@ class _ProfileSettingIconState extends State<ProfileSettingIcon> {
|
|||||||
target: AppUtils.isDirectionRTL(context)
|
target: AppUtils.isDirectionRTL(context)
|
||||||
? Alignment.bottomLeft
|
? Alignment.bottomLeft
|
||||||
: Alignment.bottomRight,
|
: Alignment.bottomRight,
|
||||||
offset: const Offset(0, 8),
|
offset: Offset(widget.isInsideCozy ? -16 : 0, 8),
|
||||||
),
|
),
|
||||||
portalFollower: ProfileSettingMenuOverlay(
|
portalFollower: ProfileSettingMenuOverlay(
|
||||||
ownEmailAddress: widget.ownEmailAddress,
|
ownEmailAddress: widget.ownEmailAddress,
|
||||||
@@ -74,22 +77,32 @@ class _ProfileSettingIconState extends State<ProfileSettingIcon> {
|
|||||||
onCloseProfileSettingMenuAction: _toggleOpenMenu,
|
onCloseProfileSettingMenuAction: _toggleOpenMenu,
|
||||||
),
|
),
|
||||||
visible: isExpanded,
|
visible: isExpanded,
|
||||||
child: (AvatarBuilder()
|
child: widget.isInsideCozy
|
||||||
..text(widget.ownEmailAddress.firstCharacterToUpperCase)
|
? TMailButtonWidget.fromIcon(
|
||||||
..backgroundColor(Colors.white)
|
icon: _imagePaths.icSetting,
|
||||||
..textColor(Colors.black)
|
iconColor: AppColor.steelGrayA540,
|
||||||
..context(context)
|
backgroundColor: Colors.transparent,
|
||||||
..size(48)
|
onTapActionAtPositionCallback: (position) {
|
||||||
..addOnTapActionClick(_toggleOpenMenu)
|
_toggleOpenMenu();
|
||||||
..addBoxShadows([
|
},
|
||||||
const BoxShadow(
|
margin: const EdgeInsetsDirectional.only(end: 16),
|
||||||
color: AppColor.colorShadowBgContentEmail,
|
)
|
||||||
spreadRadius: 1,
|
: (AvatarBuilder()
|
||||||
blurRadius: 1,
|
..text(widget.ownEmailAddress.firstCharacterToUpperCase)
|
||||||
offset: Offset(0, 0.5),
|
..backgroundColor(Colors.white)
|
||||||
)
|
..textColor(Colors.black)
|
||||||
]))
|
..context(context)
|
||||||
.build(),
|
..size(48)
|
||||||
|
..addOnTapActionClick(_toggleOpenMenu)
|
||||||
|
..addBoxShadows([
|
||||||
|
const BoxShadow(
|
||||||
|
color: AppColor.colorShadowBgContentEmail,
|
||||||
|
spreadRadius: 1,
|
||||||
|
blurRadius: 1,
|
||||||
|
offset: Offset(0, 0.5),
|
||||||
|
)
|
||||||
|
]))
|
||||||
|
.build(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -40,7 +40,14 @@ class SearchInputFormWidget extends StatelessWidget with AppLoaderMixin {
|
|||||||
final _imagePaths = Get.find<ImagePaths>();
|
final _imagePaths = Get.find<ImagePaths>();
|
||||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||||
|
|
||||||
SearchInputFormWidget({Key? key}) : super(key: key);
|
SearchInputFormWidget({
|
||||||
|
super.key,
|
||||||
|
this.fontSize = 16,
|
||||||
|
this.contentPadding = EdgeInsets.zero,
|
||||||
|
});
|
||||||
|
|
||||||
|
final double fontSize;
|
||||||
|
final EdgeInsetsGeometry contentPadding;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -239,6 +246,9 @@ class SearchInputFormWidget extends StatelessWidget with AppLoaderMixin {
|
|||||||
return QuickSearchTextFieldConfiguration(
|
return QuickSearchTextFieldConfiguration(
|
||||||
controller: _searchController.searchInputController,
|
controller: _searchController.searchInputController,
|
||||||
focusNode: _searchController.searchFocus,
|
focusNode: _searchController.searchFocus,
|
||||||
|
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||||
|
fontSize: fontSize,
|
||||||
|
),
|
||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
cursorColor: AppColor.primaryColor,
|
cursorColor: AppColor.primaryColor,
|
||||||
textDirection: DirectionUtils.getDirectionByLanguage(context),
|
textDirection: DirectionUtils.getDirectionByLanguage(context),
|
||||||
@@ -247,7 +257,7 @@ class SearchInputFormWidget extends StatelessWidget with AppLoaderMixin {
|
|||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
focusedBorder: InputBorder.none,
|
focusedBorder: InputBorder.none,
|
||||||
enabledBorder: InputBorder.none,
|
enabledBorder: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: contentPadding,
|
||||||
hintText: AppLocalizations.of(context).search_emails,
|
hintText: AppLocalizations.of(context).search_emails,
|
||||||
hintStyle: ThemeUtils.textStyleBodyBody2(
|
hintStyle: ThemeUtils.textStyleBodyBody2(
|
||||||
color: AppColor.steelGray400,
|
color: AppColor.steelGray400,
|
||||||
|
|||||||
Reference in New Issue
Block a user