TF-4174 Display tag in opened email view on mobile
This commit is contained in:
@@ -241,7 +241,6 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
ScrollController? scrollController,
|
||||
}) {
|
||||
final isMobileResponsive = controller.responsiveUtils.isMobile(context);
|
||||
final isWebDesktop = controller.responsiveUtils.isWebDesktop(context);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -258,7 +257,6 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
subject: threadSubject,
|
||||
),
|
||||
isMobileResponsive: isMobileResponsive,
|
||||
isWebDesktop: isWebDesktop,
|
||||
labels: emailLabels,
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -7,46 +7,55 @@ import 'package:tmail_ui_user/features/labels/presentation/widgets/label_widget.
|
||||
class EmailSubjectWidget extends StatelessWidget {
|
||||
final PresentationEmail presentationEmail;
|
||||
final bool isMobileResponsive;
|
||||
final bool isWebDesktop;
|
||||
final List<Label>? labels;
|
||||
|
||||
const EmailSubjectWidget({
|
||||
super.key,
|
||||
required this.presentationEmail,
|
||||
this.isMobileResponsive = false,
|
||||
this.isWebDesktop = false,
|
||||
this.labels,
|
||||
});
|
||||
|
||||
bool get _hasLabels => labels?.isNotEmpty == true;
|
||||
|
||||
String get _title => presentationEmail.getEmailTitle();
|
||||
|
||||
bool get _hasLabels => labels?.isNotEmpty == true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final padding = isMobileResponsive
|
||||
? EmailSubjectStyles.mobilePadding
|
||||
: EmailSubjectStyles.padding;
|
||||
|
||||
if (_title.isEmpty) {
|
||||
return _hasLabels && isWebDesktop
|
||||
? Padding(
|
||||
padding: padding,
|
||||
child: _buildLabelsOnly(),
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
}
|
||||
|
||||
if (_hasLabels && isWebDesktop) {
|
||||
return Padding(
|
||||
padding: padding,
|
||||
child: _buildTitleWithLabels(),
|
||||
);
|
||||
if (_title.isEmpty && !_hasLabels) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: padding,
|
||||
child: _buildTitle(),
|
||||
child: _buildContent(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContent() {
|
||||
final hasTitle = _title.isNotEmpty;
|
||||
final hasLabels = _hasLabels;
|
||||
|
||||
if (hasTitle && !hasLabels) {
|
||||
return _buildTitle();
|
||||
}
|
||||
|
||||
if (!hasTitle && hasLabels) {
|
||||
return _buildLabels();
|
||||
}
|
||||
|
||||
return Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
_buildTitle(),
|
||||
..._buildLabelWidgets(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,24 +67,16 @@ class EmailSubjectWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLabelsOnly() {
|
||||
Widget _buildLabels() {
|
||||
return Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: labels!.map(LabelWidget.create).toList(),
|
||||
children: _buildLabelWidgets(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTitleWithLabels() {
|
||||
return Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
_buildTitle(),
|
||||
...labels!.map(LabelWidget.create),
|
||||
],
|
||||
);
|
||||
List<Widget> _buildLabelWidgets() {
|
||||
return labels?.map(LabelWidget.create).toList() ?? const [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ class ThreadDetailCollapsedEmail extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isMobileResponsive = responsiveUtils.isMobile(context);
|
||||
final isWebDesktop = responsiveUtils.isWebDesktop(context);
|
||||
|
||||
return DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
@@ -65,7 +64,6 @@ class ThreadDetailCollapsedEmail extends StatelessWidget {
|
||||
EmailSubjectWidget(
|
||||
presentationEmail: presentationEmail,
|
||||
isMobileResponsive: isMobileResponsive,
|
||||
isWebDesktop: isWebDesktop,
|
||||
labels: labels,
|
||||
),
|
||||
InformationSenderAndReceiverBuilder(
|
||||
|
||||
Reference in New Issue
Block a user