Skip to content

Commit

Permalink
Add semantics to from/cc/bcc fields
Browse files Browse the repository at this point in the history
  • Loading branch information
tddang-linagora committed Sep 16, 2024
1 parent 2511fcb commit c40dbf1
Show file tree
Hide file tree
Showing 5 changed files with 278 additions and 234 deletions.
9 changes: 9 additions & 0 deletions lib/features/base/key_values/composer_key_values.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,13 @@ class ComposerKeyValues {
static const String composerSubjectField = 'tmail_composer_subject_field';
static const String composerContentField = 'tmail_composer_content_field';
static const String composerSendButton = 'tmail_composer_send_button';
// Added on 16/09/2024
static const String openWebFromFieldButton = 'tmail_composer_open_web_from_field_button';
static const String openWebCcFieldButton = 'tmail_composer_open_web_cc_field_button';
static const String openWebBccFieldButton = 'tmail_composer_open_web_bcc_field_button';
static const String openMobileSecondaryFieldsButton = 'tmail_composer_open_mobile_secondary_fields_button'; // Mobile only has one button to open all above 3 fields
static const String openFromEmailSelector = 'tmail_composer_open_from_email_selector';
static const String fromEmailSelectorOption = 'tmail_composer_from_email_selector_option';
static const String composerCcField = 'tmail_composer_cc_field';
static const String composerBccField = 'tmail_composer_bcc_field';
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/identities/identity.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:tmail_ui_user/features/base/key_values/composer_key_values.dart';
import 'package:tmail_ui_user/features/composer/presentation/styles/mobile/from_composer_bottom_sheet_style.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';

Expand Down Expand Up @@ -155,58 +156,62 @@ class FromComposerBottomSheetBuilder {
final Identity identity = _identities[index];
return Material(
color: Colors.transparent,
child: InkWell(
borderRadius: FromComposerBottomSheetStyle.borderRadius,
onTap: () => _onChangeIdentity?.call(identity),
child: Padding(
padding: FromComposerBottomSheetStyle.searchTextInputPadding,
child: Row(
children: [
Container(
width: FromComposerBottomSheetStyle.identityItemSize,
height: FromComposerBottomSheetStyle.identityItemSize,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.avatarColor,
border: Border.all(
color: AppColor.colorShadowBgContentEmail,
width: FromComposerBottomSheetStyle.identityItemBorderWidth
)
child: Semantics(
container: true,
identifier: ComposerKeyValues.fromEmailSelectorOption,
child: InkWell(
borderRadius: FromComposerBottomSheetStyle.borderRadius,
onTap: () => _onChangeIdentity?.call(identity),
child: Padding(
padding: FromComposerBottomSheetStyle.searchTextInputPadding,
child: Row(
children: [
Container(
width: FromComposerBottomSheetStyle.identityItemSize,
height: FromComposerBottomSheetStyle.identityItemSize,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.avatarColor,
border: Border.all(
color: AppColor.colorShadowBgContentEmail,
width: FromComposerBottomSheetStyle.identityItemBorderWidth
)
),
child: Text(
identity.name!.isNotEmpty
? identity.name!.firstLetterToUpperCase
: identity.email!.firstLetterToUpperCase,
style: FromComposerBottomSheetStyle.searchBarTextStyle,
),
),
child: Text(
identity.name!.isNotEmpty
? identity.name!.firstLetterToUpperCase
: identity.email!.firstLetterToUpperCase,
style: FromComposerBottomSheetStyle.searchBarTextStyle,
),
),
const SizedBox(width: FromComposerBottomSheetStyle.identityItemSpace),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (identity.name!.isNotEmpty)
Text(
identity.name!,
maxLines: 1,
softWrap: CommonTextStyle.defaultSoftWrap,
overflow: CommonTextStyle.defaultTextOverFlow,
style: FromComposerBottomSheetStyle.identityItemTitleTextStyle,
),
if (identity.email!.isNotEmpty)
Text(
identity.email!,
maxLines: 1,
softWrap: CommonTextStyle.defaultSoftWrap,
overflow: CommonTextStyle.defaultTextOverFlow,
style: FromComposerBottomSheetStyle.identityItemSubTitleTextStyle,
)
],
),
)
],
const SizedBox(width: FromComposerBottomSheetStyle.identityItemSpace),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (identity.name!.isNotEmpty)
Text(
identity.name!,
maxLines: 1,
softWrap: CommonTextStyle.defaultSoftWrap,
overflow: CommonTextStyle.defaultTextOverFlow,
style: FromComposerBottomSheetStyle.identityItemTitleTextStyle,
),
if (identity.email!.isNotEmpty)
Text(
identity.email!,
maxLines: 1,
softWrap: CommonTextStyle.defaultSoftWrap,
overflow: CommonTextStyle.defaultTextOverFlow,
style: FromComposerBottomSheetStyle.identityItemSubTitleTextStyle,
)
],
),
)
],
),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:jmap_dart_client/jmap/identities/identity.dart';
import 'package:model/email/prefix_email_address.dart';
import 'package:tmail_ui_user/features/base/key_values/composer_key_values.dart';
import 'package:tmail_ui_user/features/composer/presentation/extensions/prefix_email_address_extension.dart';
import 'package:tmail_ui_user/features/composer/presentation/styles/mobile/from_composer_mobile_widget_style.dart';

Expand Down Expand Up @@ -49,43 +50,47 @@ class FromComposerMobileWidget extends StatelessWidget {
Flexible(
child: Padding(
padding: FromComposerMobileWidgetStyle.identityButtonInkWellPadding,
child: InkWell(
borderRadius: FromComposerMobileWidgetStyle.identityButtonInkWellBorderRadius,
onTap: onTap,
child: Container(
height: FromComposerMobileWidgetStyle.identityButtonHeight,
padding: FromComposerMobileWidgetStyle.identityButtonPadding,
decoration: FromComposerMobileWidgetStyle.identityButtonDecoration,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (selectedIdentity != null)
Flexible(
child: RichText(
maxLines: 1,
softWrap: false,
overflow: CommonTextStyle.defaultTextOverFlow,
text: TextSpan(
children: [
if (selectedIdentity!.name!.isNotEmpty)
TextSpan(
text: '${selectedIdentity!.name} ',
style: FromComposerMobileWidgetStyle.buttonTitleTextStyle,
),
TextSpan(
text: '(${selectedIdentity!.email})',
style: selectedIdentity!.name!.isNotEmpty
? FromComposerMobileWidgetStyle.buttonSubTitleTextStyle
: FromComposerMobileWidgetStyle.buttonTitleTextStyle
)
]
child: Semantics(
container: true,
identifier: ComposerKeyValues.openFromEmailSelector,
child: InkWell(
borderRadius: FromComposerMobileWidgetStyle.identityButtonInkWellBorderRadius,
onTap: onTap,
child: Container(
height: FromComposerMobileWidgetStyle.identityButtonHeight,
padding: FromComposerMobileWidgetStyle.identityButtonPadding,
decoration: FromComposerMobileWidgetStyle.identityButtonDecoration,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (selectedIdentity != null)
Flexible(
child: RichText(
maxLines: 1,
softWrap: false,
overflow: CommonTextStyle.defaultTextOverFlow,
text: TextSpan(
children: [
if (selectedIdentity!.name!.isNotEmpty)
TextSpan(
text: '${selectedIdentity!.name} ',
style: FromComposerMobileWidgetStyle.buttonTitleTextStyle,
),
TextSpan(
text: '(${selectedIdentity!.email})',
style: selectedIdentity!.name!.isNotEmpty
? FromComposerMobileWidgetStyle.buttonSubTitleTextStyle
: FromComposerMobileWidgetStyle.buttonTitleTextStyle
)
]
),
),
),
)
else
const SizedBox.shrink(),
SvgPicture.asset(imagePaths.icDropDown),
],
)
else
const SizedBox.shrink(),
SvgPicture.asset(imagePaths.icDropDown),
],
),
),
),
),
Expand Down
Loading

0 comments on commit c40dbf1

Please sign in to comment.