From 761c2560ff71446fb9e1018bc8e8168368e121c3 Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 6 Sep 2023 11:47:04 +0700 Subject: [PATCH] TF-2116 Create TitleComposer widget and style (cherry picked from commit e56b2c28728ddc44e19d8cdbe4865ea0ba5e3d9a) --- .../styles/title_composer_widget_style.dart | 10 +++++++ .../widgets/title_composer_widget.dart | 29 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 lib/features/composer/presentation/styles/title_composer_widget_style.dart create mode 100644 lib/features/composer/presentation/widgets/title_composer_widget.dart diff --git a/lib/features/composer/presentation/styles/title_composer_widget_style.dart b/lib/features/composer/presentation/styles/title_composer_widget_style.dart new file mode 100644 index 000000000..9dc8c1841 --- /dev/null +++ b/lib/features/composer/presentation/styles/title_composer_widget_style.dart @@ -0,0 +1,10 @@ + +import 'package:flutter/material.dart'; + +class TitleComposerWidgetStyle { + static const TextStyle textStyle = TextStyle( + fontSize: 17, + fontWeight: FontWeight.w600, + color: Colors.black + ); +} \ No newline at end of file diff --git a/lib/features/composer/presentation/widgets/title_composer_widget.dart b/lib/features/composer/presentation/widgets/title_composer_widget.dart new file mode 100644 index 000000000..bcf8d049f --- /dev/null +++ b/lib/features/composer/presentation/widgets/title_composer_widget.dart @@ -0,0 +1,29 @@ +import 'package:core/presentation/extensions/capitalize_extension.dart'; +import 'package:core/presentation/utils/style_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:tmail_ui_user/features/composer/presentation/styles/title_composer_widget_style.dart'; +import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; + +class TitleComposerWidget extends StatelessWidget { + + final String emailSubject; + + const TitleComposerWidget({ + super.key, + required this.emailSubject, + }); + + @override + Widget build(BuildContext context) { + return Text( + emailSubject.isNotEmpty == true + ? emailSubject + : AppLocalizations.of(context).new_message.capitalizeFirstEach, + maxLines: 1, + textAlign: TextAlign.center, + overflow: CommonTextStyle.defaultTextOverFlow, + softWrap: CommonTextStyle.defaultSoftWrap, + style: TitleComposerWidgetStyle.textStyle, + ); + } +} \ No newline at end of file