TF-386 Rework the select items in a message list in edit mode
This commit is contained in:
@@ -396,10 +396,9 @@ class EmailController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleEmailAction(BuildContext context, PresentationEmail presentationEmail, EmailActionType actionType) {
|
void handleEmailAction(BuildContext context, PresentationEmail presentationEmail, EmailActionType actionType) {
|
||||||
popBack();
|
|
||||||
|
|
||||||
switch(actionType) {
|
switch(actionType) {
|
||||||
case EmailActionType.markAsUnread:
|
case EmailActionType.markAsUnread:
|
||||||
|
popBack();
|
||||||
markAsEmailRead(presentationEmail, ReadActions.markAsUnread);
|
markAsEmailRead(presentationEmail, ReadActions.markAsUnread);
|
||||||
break;
|
break;
|
||||||
case EmailActionType.markAsStar:
|
case EmailActionType.markAsStar:
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:core/core.dart';
|
import 'package:core/core.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -83,11 +81,18 @@ class EmailTileBuilder {
|
|||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
onTap: () => _onOpenEmailActionClick?.call(_presentationEmail),
|
onTap: () => _onOpenEmailActionClick?.call(_presentationEmail),
|
||||||
onLongPress: () => _onSelectEmailActionClick!.call(_presentationEmail),
|
onLongPress: () => _onSelectEmailActionClick!.call(_presentationEmail),
|
||||||
leading: Transform(
|
leading: GestureDetector(
|
||||||
transform: Matrix4.translationValues(-5.0, 0.0, 0.0),
|
onTap: () {
|
||||||
child: _buildAvatarIcon()),
|
if (_selectModeAll == SelectMode.ACTIVE) {
|
||||||
|
_onSelectEmailActionClick?.call(_presentationEmail);
|
||||||
|
} else {
|
||||||
|
_onOpenEmailActionClick?.call(_presentationEmail);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: _buildAvatarIcon(),
|
||||||
|
),
|
||||||
title: Transform(
|
title: Transform(
|
||||||
transform: Matrix4.translationValues(-8.0, 0.0, 0.0),
|
transform: Matrix4.translationValues(0.0, 0.0, 0.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (_presentationEmail.isUnReadEmail())
|
if (_presentationEmail.isUnReadEmail())
|
||||||
@@ -129,7 +134,7 @@ class EmailTileBuilder {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
subtitle: Transform(
|
subtitle: Transform(
|
||||||
transform: Matrix4.translationValues(-8.0, 8.0, 0.0),
|
transform: Matrix4.translationValues(0.0, 8.0, 0.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -222,10 +227,19 @@ class EmailTileBuilder {
|
|||||||
tooltip: _presentationEmail.isFlaggedEmail() ? AppLocalizations.of(_context).starred : AppLocalizations.of(_context).not_starred,
|
tooltip: _presentationEmail.isFlaggedEmail() ? AppLocalizations.of(_context).starred : AppLocalizations.of(_context).not_starred,
|
||||||
onTap: () => _onMarkAsStarActionClick?.call(_presentationEmail)),
|
onTap: () => _onMarkAsStarActionClick?.call(_presentationEmail)),
|
||||||
if (_selectModeAll == SelectMode.INACTIVE) SizedBox(width: 8),
|
if (_selectModeAll == SelectMode.INACTIVE) SizedBox(width: 8),
|
||||||
_buildAvatarIcon(
|
GestureDetector(
|
||||||
iconSize: 32,
|
onTap: () {
|
||||||
textStyle: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white),
|
if (_selectModeAll == SelectMode.ACTIVE) {
|
||||||
paddingIconSelect: EdgeInsets.all(5)),
|
_onSelectEmailActionClick?.call(_presentationEmail);
|
||||||
|
} else {
|
||||||
|
_onOpenEmailActionClick?.call(_presentationEmail);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: _buildAvatarIcon(
|
||||||
|
iconSize: 32,
|
||||||
|
textStyle: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white),
|
||||||
|
paddingIconSelect: EdgeInsets.all(5)),
|
||||||
|
),
|
||||||
if (_selectModeAll == SelectMode.INACTIVE) SizedBox(width: 10),
|
if (_selectModeAll == SelectMode.INACTIVE) SizedBox(width: 10),
|
||||||
Container(width: 180, child: _isSearchEnabled
|
Container(width: 180, child: _isSearchEnabled
|
||||||
? RichTextBuilder(
|
? RichTextBuilder(
|
||||||
@@ -301,18 +315,11 @@ class EmailTileBuilder {
|
|||||||
TextStyle? textStyle
|
TextStyle? textStyle
|
||||||
}) {
|
}) {
|
||||||
if (_selectModeAll == SelectMode.ACTIVE) {
|
if (_selectModeAll == SelectMode.ACTIVE) {
|
||||||
return AnimatedSwitcher(
|
return Tooltip(
|
||||||
duration: Duration(milliseconds: 600),
|
child: Padding(
|
||||||
transitionBuilder: _transitionBuilder,
|
padding: EdgeInsets.all(12),
|
||||||
child: buildIconWeb(
|
child: SvgPicture.asset(_presentationEmail.selectMode == SelectMode.ACTIVE ? _imagePaths.icSelected : _imagePaths.icUnSelected, fit: BoxFit.fill)),
|
||||||
icon: SvgPicture.asset(_presentationEmail.selectMode == SelectMode.ACTIVE ? _imagePaths.icSelected : _imagePaths.icUnSelected, fit: BoxFit.fill),
|
message: AppLocalizations.of(_context).select);
|
||||||
iconPadding: paddingIconSelect ?? EdgeInsets.all(12),
|
|
||||||
tooltip: AppLocalizations.of(_context).select,
|
|
||||||
onTap: () {
|
|
||||||
if (_selectModeAll == SelectMode.ACTIVE && _onSelectEmailActionClick != null) {
|
|
||||||
_onSelectEmailActionClick!(_presentationEmail);
|
|
||||||
}}),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return (AvatarBuilder()
|
return (AvatarBuilder()
|
||||||
..text('${_presentationEmail.getAvatarText()}')
|
..text('${_presentationEmail.getAvatarText()}')
|
||||||
@@ -324,23 +331,6 @@ class EmailTileBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _transitionBuilder(Widget widget, Animation<double> animation) {
|
|
||||||
final rotateAnim = Tween(begin: pi, end: 0.0).animate(animation);
|
|
||||||
return AnimatedBuilder(
|
|
||||||
animation: rotateAnim,
|
|
||||||
child: widget,
|
|
||||||
builder: (context, widget) {
|
|
||||||
final isUnder = _presentationEmail.selectMode == SelectMode.ACTIVE;
|
|
||||||
final value = isUnder ? min(rotateAnim.value, pi / 2) : rotateAnim.value;
|
|
||||||
return Transform(
|
|
||||||
transform: Matrix4.rotationY(value),
|
|
||||||
child: widget,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String _getInformationSender() {
|
String _getInformationSender() {
|
||||||
if (_mailboxRole == PresentationMailbox.roleSent
|
if (_mailboxRole == PresentationMailbox.roleSent
|
||||||
|| _mailboxRole == PresentationMailbox.roleDrafts
|
|| _mailboxRole == PresentationMailbox.roleDrafts
|
||||||
|
|||||||
Reference in New Issue
Block a user