TF-233 Create mailbox location
This commit is contained in:
+37
-14
@@ -2,7 +2,7 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_action.dart';
|
||||
|
||||
typedef OnCloseActionClick = void Function();
|
||||
|
||||
@@ -12,8 +12,14 @@ class AppBarDestinationPickerBuilder {
|
||||
final BuildContext _context;
|
||||
final ImagePaths _imagePaths;
|
||||
final ResponsiveUtils _responsiveUtils;
|
||||
final MailboxAction? _mailboxAction;
|
||||
|
||||
AppBarDestinationPickerBuilder(this._context, this._imagePaths, this._responsiveUtils);
|
||||
AppBarDestinationPickerBuilder(
|
||||
this._context,
|
||||
this._imagePaths,
|
||||
this._responsiveUtils,
|
||||
this._mailboxAction,
|
||||
);
|
||||
|
||||
void addCloseActionClick(OnCloseActionClick onCloseActionClick) {
|
||||
_onCloseActionClick = onCloseActionClick;
|
||||
@@ -23,7 +29,7 @@ class AppBarDestinationPickerBuilder {
|
||||
return Container(
|
||||
key: Key('app_bar_destination_picker'),
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
||||
color: Colors.white),
|
||||
@@ -34,7 +40,7 @@ class AppBarDestinationPickerBuilder {
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
_buildBackButton(),
|
||||
Expanded(child: _buildCountItemSelected())
|
||||
Expanded(child: _buildTitle())
|
||||
]
|
||||
)
|
||||
)
|
||||
@@ -45,24 +51,41 @@ class AppBarDestinationPickerBuilder {
|
||||
return Material(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.transparent,
|
||||
child: IconButton(
|
||||
color: AppColor.baseTextColor,
|
||||
icon: SvgPicture.asset(_imagePaths.icComposerClose, fit: BoxFit.fill),
|
||||
onPressed: () => _onCloseActionClick?.call()
|
||||
)
|
||||
child: _responsiveUtils.isMobile(_context)
|
||||
? IconButton(
|
||||
color: _mailboxAction == MailboxAction.create ? AppColor.colorTextButton : AppColor.baseTextColor,
|
||||
icon: _getBackIcon(),
|
||||
onPressed: () => _onCloseActionClick?.call())
|
||||
: SizedBox(width: 40, height: 40)
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCountItemSelected() {
|
||||
Widget _buildTitle() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 12,
|
||||
right: _responsiveUtils.isMobile(_context) ? 0 : 47),
|
||||
right: 47),
|
||||
child: Text(
|
||||
AppLocalizations.of(_context).move_to_mailbox,
|
||||
_mailboxAction?.getTitle(_context) ?? '',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: _responsiveUtils.isMobile(_context) ? TextAlign.start : TextAlign.center,
|
||||
style: TextStyle(fontSize: 18, color: AppColor.nameUserColor, fontWeight: FontWeight.w500)));
|
||||
textAlign: _getAlignTitle(),
|
||||
style: TextStyle(fontSize: 17, color: AppColor.colorNameEmail, fontWeight: FontWeight.w700)));
|
||||
}
|
||||
|
||||
TextAlign _getAlignTitle() {
|
||||
if (_mailboxAction == MailboxAction.create) {
|
||||
return TextAlign.center;
|
||||
} else {
|
||||
return _responsiveUtils.isMobile(_context) ? TextAlign.start : TextAlign.center;
|
||||
}
|
||||
}
|
||||
|
||||
Widget _getBackIcon() {
|
||||
if (_mailboxAction == MailboxAction.create) {
|
||||
return SvgPicture.asset(_imagePaths.icBack, fit: BoxFit.fill);
|
||||
} else {
|
||||
return SvgPicture.asset(_imagePaths.icComposerClose, fit: BoxFit.fill);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user