TF-1301 Handle select font size while compose email
Signed-off-by: dab246 <tdvu@linagora.com> Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 194ccd3a0cf1da161607daf2506bdf524daaf305)
This commit is contained in:
@@ -23,12 +23,16 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
|
||||
class RichTextWebController extends BaseRichTextController {
|
||||
|
||||
static const List<int> fontSizeList = [10, 12, 14, 15, 16, 18, 24, 36, 48, 64];
|
||||
static const int fontSizeDefault = 16;
|
||||
|
||||
final editorController = HtmlEditorController();
|
||||
|
||||
final listTextStyleApply = RxList<RichTextStyleType>();
|
||||
final selectedTextColor = Colors.black.obs;
|
||||
final selectedTextBackgroundColor = Colors.white.obs;
|
||||
final selectedFontName = FontNameType.sansSerif.obs;
|
||||
final selectedFontSize = RxInt(fontSizeDefault);
|
||||
final codeViewState = CodeViewState.disabled.obs;
|
||||
final selectedParagraph = ParagraphType.alignLeft.obs;
|
||||
final selectedOrderList = OrderListType.bulletedList.obs;
|
||||
@@ -61,6 +65,10 @@ class RichTextWebController extends BaseRichTextController {
|
||||
_updateParagraph(settings);
|
||||
}
|
||||
|
||||
void onEditorTextSizeChanged(int? size) {
|
||||
_updateFontSize(size);
|
||||
}
|
||||
|
||||
void _updateTextStyle(EditorSettings settings) {
|
||||
listTextStyleApply.clear();
|
||||
|
||||
@@ -92,11 +100,20 @@ class RichTextWebController extends BaseRichTextController {
|
||||
}
|
||||
}
|
||||
|
||||
void _updateFontSize(int? size) {
|
||||
log('RichTextWebController::_updateFontSize():size: $size');
|
||||
if (size != null && fontSizeList.contains(size)) {
|
||||
selectedFontSize.value = size;
|
||||
}
|
||||
}
|
||||
|
||||
void _updateTextColor(EditorSettings settings) {
|
||||
log('RichTextWebController::_updateTextColor():foregroundColor: ${settings.foregroundColor}');
|
||||
selectedTextColor.value = settings.foregroundColor;
|
||||
}
|
||||
|
||||
void _updateBackgroundTextColor(EditorSettings settings) {
|
||||
log('RichTextWebController::_updateBackgroundTextColor():backgroundColor: ${settings.backgroundColor}');
|
||||
selectedTextBackgroundColor.value = settings.backgroundColor;
|
||||
}
|
||||
|
||||
@@ -199,6 +216,11 @@ class RichTextWebController extends BaseRichTextController {
|
||||
value: fontSelected.value);
|
||||
}
|
||||
|
||||
void applyNewFontSize(int? newSize) {
|
||||
selectedFontSize.value = newSize ?? fontSizeDefault;
|
||||
editorController.setFontSize(newSize ?? fontSizeDefault);
|
||||
}
|
||||
|
||||
bool get isMenuFontOpen => menuFontStatus.value == DropdownMenuFontStatus.open;
|
||||
|
||||
bool get isMenuHeaderStyleOpen => menuHeaderStyleStatus.value == DropdownMenuFontStatus.open;
|
||||
|
||||
Reference in New Issue
Block a user