From 42beb78bb4b5dacd69f3527f286eefe9b7249b5c Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 6 Sep 2023 11:47:14 +0700 Subject: [PATCH] TF-2116 Create SubjectComposer widget and style (cherry picked from commit 9458edb30bbd23db3484d71c9d4caff695008f7f) --- .../styles/subject_composer_widget_style.dart | 21 +++++++ .../widgets/subject_composer_widget.dart | 59 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 lib/features/composer/presentation/styles/subject_composer_widget_style.dart create mode 100644 lib/features/composer/presentation/widgets/subject_composer_widget.dart diff --git a/lib/features/composer/presentation/styles/subject_composer_widget_style.dart b/lib/features/composer/presentation/styles/subject_composer_widget_style.dart new file mode 100644 index 000000000..8fb27e85d --- /dev/null +++ b/lib/features/composer/presentation/styles/subject_composer_widget_style.dart @@ -0,0 +1,21 @@ + +import 'package:core/presentation/extensions/color_extension.dart'; +import 'package:flutter/material.dart'; + +class SubjectComposerWidgetStyle { + static const double space = 12; + + static const Color cursorColor = AppColor.primaryColor; + static const Color borderColor = AppColor.colorLineComposer; + + static const TextStyle labelTextStyle = TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: AppColor.colorLabelComposer + ); + static const TextStyle inputTextStyle = TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.w500 + ); +} \ No newline at end of file diff --git a/lib/features/composer/presentation/widgets/subject_composer_widget.dart b/lib/features/composer/presentation/widgets/subject_composer_widget.dart new file mode 100644 index 000000000..cfc4d8a7a --- /dev/null +++ b/lib/features/composer/presentation/widgets/subject_composer_widget.dart @@ -0,0 +1,59 @@ +import 'package:core/presentation/views/text/text_field_builder.dart'; +import 'package:core/utils/direction_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:tmail_ui_user/features/composer/presentation/styles/subject_composer_widget_style.dart'; +import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; + +class SubjectComposerWidget extends StatelessWidget { + + final FocusNode? focusNode; + final TextEditingController textController; + final ValueChanged? onTextChange; + final EdgeInsetsGeometry? margin; + final EdgeInsetsGeometry? padding; + + const SubjectComposerWidget({ + super.key, + required this.focusNode, + required this.textController, + required this.onTextChange, + this.margin, + this.padding, + }); + + @override + Widget build(BuildContext context) { + return Container( + decoration: const BoxDecoration( + border: Border( + bottom: BorderSide( + color: SubjectComposerWidgetStyle.borderColor, + width: 1 + ) + ), + ), + margin: margin, + padding: padding, + child: Row( + children: [ + Text( + '${AppLocalizations.of(context).subject_email}:', + style: SubjectComposerWidgetStyle.labelTextStyle + ), + const SizedBox(width:SubjectComposerWidgetStyle.space), + Expanded( + child: TextFieldBuilder( + cursorColor: SubjectComposerWidgetStyle.cursorColor, + focusNode: focusNode, + onTextChange: onTextChange, + maxLines: 1, + textDirection: DirectionUtils.getDirectionByLanguage(context), + textStyle: SubjectComposerWidgetStyle.inputTextStyle, + controller: textController, + ) + ) + ] + ), + ); + } +} \ No newline at end of file