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(),
),
);
},
@@ -40,7 +40,14 @@ class SearchInputFormWidget extends StatelessWidget with AppLoaderMixin {
final _imagePaths = Get.find<ImagePaths>();
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
Widget build(BuildContext context) {
@@ -239,6 +246,9 @@ class SearchInputFormWidget extends StatelessWidget with AppLoaderMixin {
return QuickSearchTextFieldConfiguration(
controller: _searchController.searchInputController,
focusNode: _searchController.searchFocus,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: fontSize,
),
textInputAction: TextInputAction.done,
cursorColor: AppColor.primaryColor,
textDirection: DirectionUtils.getDirectionByLanguage(context),
@@ -247,7 +257,7 @@ class SearchInputFormWidget extends StatelessWidget with AppLoaderMixin {
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
contentPadding: EdgeInsets.zero,
contentPadding: contentPadding,
hintText: AppLocalizations.of(context).search_emails,
hintStyle: ThemeUtils.textStyleBodyBody2(
color: AppColor.steelGray400,