TF-2196 Add 'From; field fow mobile
(cherry picked from commit 2e754c1331ce4833b20a21e52f736ccd8fcbb207)
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
|||||||
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class FromComposerMobileWidgetStyle {
|
||||||
|
static const double space = 8.0;
|
||||||
|
static const double identityButtonHeight = 32.0;
|
||||||
|
static const double identityButtonWidthMobileLandscape = 421.0;
|
||||||
|
|
||||||
|
static const EdgeInsetsGeometry identityButtonInkWellPadding = EdgeInsets.symmetric(vertical: 8.0);
|
||||||
|
static const EdgeInsetsGeometry identityButtonPadding = EdgeInsets.only(
|
||||||
|
top: 4,
|
||||||
|
bottom: 4,
|
||||||
|
right: 4,
|
||||||
|
left: 8,
|
||||||
|
);
|
||||||
|
|
||||||
|
static const BorderRadius identityButtonInkWellBorderRadius = BorderRadius.all(Radius.circular(10));
|
||||||
|
static const BoxDecoration identityButtonDecoration = BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||||
|
color: AppColor.colorComposerAppBar,
|
||||||
|
);
|
||||||
|
static const Border border = Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: AppColor.colorLineComposer,
|
||||||
|
width: 1,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
static const TextStyle prefixTextStyle = TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: AppColor.colorLabelComposer
|
||||||
|
);
|
||||||
|
static const TextStyle buttonTitleTextStyle = TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColor.colorCalendarEventUnread
|
||||||
|
);
|
||||||
|
static const TextStyle buttonSubTitleTextStyle = TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColor.colorLabelComposer
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
|
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||||
|
import 'package:core/presentation/utils/style_utils.dart';
|
||||||
|
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/composer/presentation/extensions/prefix_email_address_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/features/composer/presentation/styles/mobile/from_composer_mobile_widget_style.dart';
|
||||||
|
|
||||||
|
class FromComposerMobileWidget extends StatelessWidget {
|
||||||
|
|
||||||
|
final Identity? selectedIdentity;
|
||||||
|
final ImagePaths imagePaths;
|
||||||
|
final ResponsiveUtils responsiveUtils;
|
||||||
|
final EdgeInsetsGeometry? padding;
|
||||||
|
final EdgeInsetsGeometry? margin;
|
||||||
|
final void Function()? onTap;
|
||||||
|
|
||||||
|
const FromComposerMobileWidget({
|
||||||
|
super.key,
|
||||||
|
required this.imagePaths,
|
||||||
|
required this.responsiveUtils,
|
||||||
|
this.selectedIdentity,
|
||||||
|
this.padding,
|
||||||
|
this.margin,
|
||||||
|
this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
border: FromComposerMobileWidgetStyle.border
|
||||||
|
),
|
||||||
|
padding: padding,
|
||||||
|
margin: margin,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.only(top: 16),
|
||||||
|
child: Text(
|
||||||
|
'${PrefixEmailAddress.from.asName(context)}:',
|
||||||
|
style: FromComposerMobileWidgetStyle.prefixTextStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: FromComposerMobileWidgetStyle.space),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
padding: FromComposerMobileWidgetStyle.identityButtonInkWellPadding,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: FromComposerMobileWidgetStyle.identityButtonInkWellBorderRadius,
|
||||||
|
onTap: onTap,
|
||||||
|
child: Container(
|
||||||
|
height: FromComposerMobileWidgetStyle.identityButtonHeight,
|
||||||
|
width: responsiveUtils.isLandscapeMobile(context)
|
||||||
|
? FromComposerMobileWidgetStyle.identityButtonWidthMobileLandscape
|
||||||
|
: 0,
|
||||||
|
padding: FromComposerMobileWidgetStyle.identityButtonPadding,
|
||||||
|
decoration: FromComposerMobileWidgetStyle.identityButtonDecoration,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if (selectedIdentity != null)
|
||||||
|
Expanded(
|
||||||
|
child: RichText(
|
||||||
|
maxLines: 1,
|
||||||
|
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||||
|
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)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user