Compose email with text style for mobile

This commit is contained in:
ManhNTX
2022-07-15 16:16:56 +07:00
committed by Dat H. Pham
parent e52617fd24
commit a9a85ba621
4 changed files with 89 additions and 3 deletions
@@ -0,0 +1,37 @@
import 'package:enough_html_editor/enough_html_editor.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/composer/presentation/model/rich_text_style_type.dart';
class RichTextMobileTabletController extends GetxController {
HtmlEditorApi? htmlEditorApi;
final listTextStyleApply = RxList<RichTextStyleType>();
void listenHtmlEditorApi() {
htmlEditorApi?.onFormatSettingsChanged = (formatSettings) {
listTextStyleApply.clear();
if (formatSettings.isBold) {
listTextStyleApply.add(RichTextStyleType.bold);
}
if (formatSettings.isItalic) {
listTextStyleApply.add(RichTextStyleType.italic);
}
if (formatSettings.isUnderline) {
listTextStyleApply.add(RichTextStyleType.underline);
}
};
}
selectTextStyleType(RichTextStyleType richTextStyleType) {
if (listTextStyleApply.contains(richTextStyleType)) {
listTextStyleApply.remove(richTextStyleType);
} else {
listTextStyleApply.add(richTextStyleType);
}
}
bool isTextStyleTypeSelected(RichTextStyleType richTextStyleType) {
return listTextStyleApply.contains(richTextStyleType);
}
}