TF-985 Change TopBar widget of EmailView
This commit is contained in:
@@ -22,6 +22,7 @@ export 'domain/exceptions/web_session_exception.dart';
|
||||
export 'presentation/utils/theme_utils.dart';
|
||||
export 'presentation/utils/responsive_utils.dart';
|
||||
export 'presentation/utils/keyboard_utils.dart';
|
||||
export 'presentation/utils/icon_utils.dart';
|
||||
export 'presentation/utils/style_utils.dart';
|
||||
export 'presentation/utils/app_toast.dart';
|
||||
export 'presentation/utils/html_transformer/html_template.dart';
|
||||
|
||||
@@ -150,6 +150,8 @@ extension AppColor on Color {
|
||||
static const colorBackgroundKeyboard = Color(0xFFD2D5DC);
|
||||
static const colorShadowLayerBottom = Color(0x29000000);
|
||||
static const colorShadowLayerTop = Color(0x1F000000);
|
||||
static const colorDividerHorizontal = Color(0x1F000000);
|
||||
static const colorEmailAddressFull = Color(0xFF818C99);
|
||||
|
||||
static const mapGradientColor = [
|
||||
[Color(0xFF21D4FD), Color(0xFFB721FF)],
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
|
||||
class IconUtils {
|
||||
static final double defaultIconSize = BuildUtils.isWeb ? 20.0 : 24.0;
|
||||
}
|
||||
@@ -90,31 +90,35 @@ class ButtonBuilder {
|
||||
}
|
||||
|
||||
Widget build() {
|
||||
return InkWell(
|
||||
onTap: () => _onPressActionClick != null ? _onPressActionClick?.call() : null,
|
||||
onTapDown: (detail) {
|
||||
if (_onPressActionWithPositionClick != null && _context != null) {
|
||||
final screenSize = MediaQuery.of(_context!).size;
|
||||
final offset = detail.globalPosition;
|
||||
final position = RelativeRect.fromLTRB(
|
||||
offset.dx,
|
||||
offset.dy,
|
||||
screenSize.width - offset.dx,
|
||||
screenSize.height - offset.dy,
|
||||
);
|
||||
_onPressActionWithPositionClick?.call(position);
|
||||
}
|
||||
},
|
||||
borderRadius: BorderRadius.all(Radius.circular(_radiusSplash ?? 20)),
|
||||
child: Container(
|
||||
key: _key,
|
||||
alignment: Alignment.center,
|
||||
color: _decoration == null ? _colorButton : null,
|
||||
decoration: _decoration,
|
||||
width: _maxWidth,
|
||||
padding: _padding ?? EdgeInsets.zero,
|
||||
child: _buildBody()
|
||||
)
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () => _onPressActionClick != null ? _onPressActionClick?.call() : null,
|
||||
onTapDown: (detail) {
|
||||
if (_onPressActionWithPositionClick != null && _context != null) {
|
||||
final screenSize = MediaQuery.of(_context!).size;
|
||||
final offset = detail.globalPosition;
|
||||
final position = RelativeRect.fromLTRB(
|
||||
offset.dx,
|
||||
offset.dy,
|
||||
screenSize.width - offset.dx,
|
||||
screenSize.height - offset.dy,
|
||||
);
|
||||
_onPressActionWithPositionClick?.call(position);
|
||||
}
|
||||
},
|
||||
customBorder: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(_radiusSplash ?? 20)),
|
||||
child: Container(
|
||||
key: _key,
|
||||
alignment: Alignment.center,
|
||||
color: _decoration == null ? _colorButton : null,
|
||||
decoration: _decoration,
|
||||
width: _maxWidth,
|
||||
padding: _padding ?? EdgeInsets.zero,
|
||||
child: _buildBody()
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -144,7 +148,12 @@ class ButtonBuilder {
|
||||
|
||||
Widget _buildIcon() => Padding(
|
||||
padding: _paddingIcon ?? EdgeInsets.all(10),
|
||||
child: SvgPicture.asset(_icon ?? '', width: _size ?? 24, height: _size ?? 24, fit: BoxFit.fill, color: _iconColor));
|
||||
child: SvgPicture.asset(
|
||||
_icon ?? '',
|
||||
width: _size ?? 24,
|
||||
height: _size ?? 24,
|
||||
fit: BoxFit.fill,
|
||||
color: _iconColor));
|
||||
|
||||
Widget _buildText() {
|
||||
return Text(
|
||||
@@ -152,7 +161,9 @@ class ButtonBuilder {
|
||||
maxLines: 1,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
style: _textStyle ?? TextStyle(fontSize: 12, color: AppColor.colorTextButton),
|
||||
style: _textStyle ?? TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColor.colorTextButton),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class AppBarMailWidgetBuilder extends StatelessWidget {
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
final PresentationEmail? _presentationEmail;
|
||||
final PresentationEmail _presentationEmail;
|
||||
final PresentationMailbox? currentMailbox;
|
||||
final bool isSearchIsRunning;
|
||||
final OnBackActionClick? onBackActionClick;
|
||||
@@ -37,29 +37,29 @@ class AppBarMailWidgetBuilder extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
key: const Key('app_bar_messenger_widget'),
|
||||
alignment: Alignment.center,
|
||||
color: Colors.transparent,
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
height: 52,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(children: [
|
||||
if (_supportDisplayMailboxNameTitle(context))
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () => onBackActionClick?.call(),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
customBorder: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: Tooltip(
|
||||
message: isSearchIsRunning
|
||||
? AppLocalizations.of(context).backToSearchResults
|
||||
: AppLocalizations.of(context).back,
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
height: 40,
|
||||
height: 32,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
SvgPicture.asset(
|
||||
_imagePaths.icBack,
|
||||
width: 18,
|
||||
height: 18,
|
||||
width: 14,
|
||||
height: 14,
|
||||
color: AppColor.colorTextButton,
|
||||
fit: BoxFit.fill),
|
||||
if (!isSearchIsRunning)
|
||||
@@ -80,7 +80,7 @@ class AppBarMailWidgetBuilder extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
if (_presentationEmail != null) _buildListOptionButton(context),
|
||||
_buildListOptionButton(context),
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -103,32 +103,38 @@ class AppBarMailWidgetBuilder extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(_imagePaths.icMoveEmail, fit: BoxFit.fill),
|
||||
icon: SvgPicture.asset(
|
||||
_imagePaths.icMoveEmail,
|
||||
width: IconUtils.defaultIconSize,
|
||||
height: IconUtils.defaultIconSize,
|
||||
fit: BoxFit.fill),
|
||||
tooltip: AppLocalizations.of(context).move_message,
|
||||
onTap: () => onEmailActionClick?.call(
|
||||
_presentationEmail!,
|
||||
_presentationEmail,
|
||||
EmailActionType.moveToMailbox)),
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(
|
||||
_presentationEmail!.hasStarred
|
||||
_presentationEmail.hasStarred
|
||||
? _imagePaths.icStar
|
||||
: _imagePaths.icUnStar,
|
||||
width: IconUtils.defaultIconSize,
|
||||
height: IconUtils.defaultIconSize,
|
||||
fit: BoxFit.fill),
|
||||
tooltip: _presentationEmail!.hasStarred
|
||||
tooltip: _presentationEmail.hasStarred
|
||||
? AppLocalizations.of(context).not_starred
|
||||
: AppLocalizations.of(context).mark_as_starred,
|
||||
onTap: () => onEmailActionClick?.call(_presentationEmail!,
|
||||
_presentationEmail!.hasStarred
|
||||
onTap: () => onEmailActionClick?.call(_presentationEmail,
|
||||
_presentationEmail.hasStarred
|
||||
? EmailActionType.unMarkAsStarred
|
||||
: EmailActionType.markAsStarred)),
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(
|
||||
currentMailbox?.role == PresentationMailbox.roleTrash
|
||||
? _imagePaths.icDeleteComposer
|
||||
: _imagePaths.icDelete,
|
||||
color: AppColor.colorDefaultButton,
|
||||
width: 24,
|
||||
height: 24,
|
||||
_imagePaths.icDeleteComposer,
|
||||
color: currentMailbox?.role != PresentationMailbox.roleTrash
|
||||
? AppColor.colorTextButton
|
||||
: AppColor.colorDeletePermanentlyButton,
|
||||
width: BuildUtils.isWeb ? 18 : 20,
|
||||
height: BuildUtils.isWeb ? 18 : 20,
|
||||
fit: BoxFit.fill),
|
||||
tooltip: currentMailbox?.role != PresentationMailbox.roleTrash
|
||||
? AppLocalizations.of(context).move_to_trash
|
||||
@@ -136,31 +142,34 @@ class AppBarMailWidgetBuilder extends StatelessWidget {
|
||||
onTap: () {
|
||||
if (currentMailbox?.role != PresentationMailbox.roleTrash) {
|
||||
onEmailActionClick?.call(
|
||||
_presentationEmail!,
|
||||
_presentationEmail,
|
||||
EmailActionType.moveToTrash);
|
||||
} else {
|
||||
onEmailActionClick?.call(
|
||||
_presentationEmail!,
|
||||
_presentationEmail,
|
||||
EmailActionType.deletePermanently);
|
||||
}
|
||||
}),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10, right: 16),
|
||||
child: buildIconWebHasPosition(
|
||||
context,
|
||||
tooltip: AppLocalizations.of(context).more,
|
||||
icon: SvgPicture.asset(_imagePaths.icMore, fit: BoxFit.fill),
|
||||
onTap: () {
|
||||
if (_presentationEmail != null && _responsiveUtils.isMobile(context)) {
|
||||
onMoreActionClick?.call(_presentationEmail!, null);
|
||||
}
|
||||
},
|
||||
onTapDown: (position) {
|
||||
if (_presentationEmail != null && !_responsiveUtils.isMobile(context)) {
|
||||
onMoreActionClick?.call(_presentationEmail!, position);
|
||||
}
|
||||
buildIconWebHasPosition(
|
||||
context,
|
||||
tooltip: AppLocalizations.of(context).more,
|
||||
icon: SvgPicture.asset(
|
||||
_imagePaths.icMore,
|
||||
width: IconUtils.defaultIconSize,
|
||||
height: IconUtils.defaultIconSize,
|
||||
fit: BoxFit.fill),
|
||||
onTap: () {
|
||||
if (_responsiveUtils.isPortraitMobile(context) ||
|
||||
_responsiveUtils.isLandscapeMobile(context)) {
|
||||
onMoreActionClick?.call(_presentationEmail, null);
|
||||
}
|
||||
)
|
||||
},
|
||||
onTapDown: (position) {
|
||||
if (!_responsiveUtils.isPortraitMobile(context) &&
|
||||
!_responsiveUtils.isLandscapeMobile(context)) {
|
||||
onMoreActionClick?.call(_presentationEmail, position);
|
||||
}
|
||||
}
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user