TF-3603 Adapt search bar when inside Cozy

This commit is contained in:
DatDang
2025-04-18 14:38:03 +07:00
committed by Dat H. Pham
parent b5280c805d
commit d62e2861cf
3 changed files with 117 additions and 41 deletions
@@ -2,6 +2,7 @@ import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/extensions/string_extension.dart';
import 'package:core/presentation/resources/image_paths.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:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -15,12 +16,14 @@ class ProfileSettingIcon extends StatefulWidget {
final String ownEmailAddress;
final List<ProfileSettingActionType> settingActionTypes;
final OnProfileSettingActionTypeClick onProfileSettingActionTypeClick;
final bool isInsideCozy;
const ProfileSettingIcon({
super.key,
required this.ownEmailAddress,
required this.settingActionTypes,
required this.onProfileSettingActionTypeClick,
this.isInsideCozy = false,
});
@override
@@ -57,7 +60,7 @@ class _ProfileSettingIconState extends State<ProfileSettingIcon> {
target: AppUtils.isDirectionRTL(context)
? Alignment.bottomLeft
: Alignment.bottomRight,
offset: const Offset(0, 8),
offset: Offset(widget.isInsideCozy ? -16 : 0, 8),
),
portalFollower: ProfileSettingMenuOverlay(
ownEmailAddress: widget.ownEmailAddress,
@@ -74,22 +77,32 @@ class _ProfileSettingIconState extends State<ProfileSettingIcon> {
onCloseProfileSettingMenuAction: _toggleOpenMenu,
),
visible: isExpanded,
child: (AvatarBuilder()
..text(widget.ownEmailAddress.firstCharacterToUpperCase)
..backgroundColor(Colors.white)
..textColor(Colors.black)
..context(context)
..size(48)
..addOnTapActionClick(_toggleOpenMenu)
..addBoxShadows([
const BoxShadow(
color: AppColor.colorShadowBgContentEmail,
spreadRadius: 1,
blurRadius: 1,
offset: Offset(0, 0.5),
)
]))
.build(),
child: widget.isInsideCozy
? TMailButtonWidget.fromIcon(
icon: _imagePaths.icSetting,
iconColor: AppColor.steelGrayA540,
backgroundColor: Colors.transparent,
onTapActionAtPositionCallback: (position) {
_toggleOpenMenu();
},
margin: const EdgeInsetsDirectional.only(end: 16),
)
: (AvatarBuilder()
..text(widget.ownEmailAddress.firstCharacterToUpperCase)
..backgroundColor(Colors.white)
..textColor(Colors.black)
..context(context)
..size(48)
..addOnTapActionClick(_toggleOpenMenu)
..addBoxShadows([
const BoxShadow(
color: AppColor.colorShadowBgContentEmail,
spreadRadius: 1,
blurRadius: 1,
offset: Offset(0, 0.5),
)
]))
.build(),
),
);
},