add rich text style strike through

This commit is contained in:
Liz Bui
2022-07-21 14:50:29 +07:00
committed by Dat H. Pham
parent e6f1ced4cd
commit 75133f05f2
5 changed files with 23 additions and 1 deletions
@@ -0,0 +1,3 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.9668 21C15.044 21 15.9795 20.8288 16.7734 20.4863C17.5672 20.1439 18.1836 19.6598 18.6226 19.034C19.0616 18.4083 19.281 17.6782 19.281 16.8439C19.281 15.8352 18.9619 15.0429 18.3237 14.467C17.6855 13.891 16.6722 13.4474 15.2837 13.1361L13.6866 12.7718C12.7776 12.5602 12.1191 12.3064 11.7113 12.0107C11.3035 11.7149 11.0996 11.3211 11.0996 10.8292C11.0996 10.4307 11.2225 10.0758 11.4685 9.76451C11.7144 9.45319 12.0522 9.21192 12.4818 9.04069C12.9115 8.86947 13.4033 8.78386 13.9575 8.78386C14.4556 8.78386 14.9039 8.8539 15.3024 8.994C15.7009 9.13409 16.0433 9.34267 16.3297 9.61975C16.6161 9.89682 16.8465 10.2377 17.0209 10.6424C17.2263 11.0036 17.5252 11.1841 17.9175 11.1841C18.2039 11.1841 18.4311 11.1032 18.5992 10.9413C18.7674 10.7794 18.8514 10.5646 18.8514 10.2969C18.8514 10.2221 18.8467 10.1459 18.8374 10.068C18.8281 9.99022 18.8109 9.91083 18.786 9.82989C18.6366 9.26951 18.3377 8.77763 17.8894 8.35424C17.4411 7.93084 16.8792 7.59929 16.2036 7.35957C15.5281 7.11986 14.7794 7 13.9575 7C12.9799 7 12.1114 7.16967 11.3517 7.50901C10.5921 7.84834 9.99595 8.31999 9.56322 8.92395C9.13049 9.52791 8.91412 10.2221 8.91412 11.0067C8.91412 11.9593 9.22388 12.7298 9.84341 13.3182C10.4629 13.9066 11.414 14.344 12.6966 14.6304L14.4525 15.032C15.3927 15.2562 16.0682 15.5255 16.4792 15.8399C16.8901 16.1543 17.0956 16.573 17.0956 17.0961C17.0956 17.507 16.9633 17.8728 16.6986 18.1935C16.434 18.5141 16.0667 18.7663 15.5966 18.95C15.1265 19.1336 14.5832 19.2255 13.9668 19.2255C13.4251 19.2255 12.9301 19.1477 12.4818 18.992C12.0335 18.8363 11.6475 18.6106 11.3237 18.3149C11 18.0191 10.7509 17.6689 10.5766 17.2642C10.4645 17.0587 10.3415 16.9093 10.2076 16.8159C10.0738 16.7225 9.901 16.6758 9.6893 16.6758C9.39666 16.6758 9.16473 16.7598 8.99351 16.928C8.82228 17.0961 8.73667 17.3202 8.73667 17.6004C8.73667 17.7934 8.76469 17.9864 8.82072 18.1795C8.99506 18.7585 9.32039 19.2582 9.79671 19.6785C10.273 20.0987 10.8676 20.4241 11.5806 20.6544C12.2935 20.8848 13.0889 21 13.9668 21ZM6.56055 14.4343H21.4385C21.5817 14.4343 21.7031 14.3829 21.8027 14.2802C21.9023 14.1775 21.9521 14.0576 21.9521 13.9206C21.9521 13.7836 21.9023 13.6638 21.8027 13.561C21.7031 13.4583 21.5817 13.4069 21.4385 13.4069H6.56055C6.41734 13.4069 6.29593 13.4583 6.19631 13.561C6.09669 13.6638 6.04688 13.7836 6.04688 13.9206C6.04688 14.0576 6.09669 14.1775 6.19631 14.2802C6.29593 14.3829 6.41734 14.4343 6.56055 14.4343Z" fill="#99A2AD"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@@ -132,6 +132,7 @@ class ImagePaths {
String get icStyleItalic => _getImagePath('ic_style_italic.svg');
String get icStyleUnderline => _getImagePath('ic_style_underline.svg');
String get icInsertImage => _getImagePath('ic_insert_image.svg');
String get icStyleStrikeThrough => _getImagePath('ic_style_strikethroughs.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
@@ -514,6 +514,15 @@ class ComposerView extends GetWidget<ComposerController> with AppLoaderMixin, Ri
});
}
),
buildIconStyleText(
path: RichTextStyleType.strikeThrough.getIcon(imagePaths),
isSelected: controller.richTextMobileTabletController.isTextStyleTypeSelected(RichTextStyleType.strikeThrough),
onTap: () async {
await controller.htmlEditorApi?.formatStrikeThrough().then((value) {
controller.richTextMobileTabletController.selectTextStyleType(RichTextStyleType.strikeThrough);
});
}
),
buildIconStyleText(
path: RichTextStyleType.underline.getIcon(imagePaths),
isSelected: controller.richTextMobileTabletController.isTextStyleTypeSelected(RichTextStyleType.underline),
@@ -20,6 +20,10 @@ class RichTextMobileTabletController extends GetxController {
if (formatSettings.isUnderline) {
listTextStyleApply.add(RichTextStyleType.underline);
}
if (formatSettings.isStrikeThrough) {
listTextStyleApply.add(RichTextStyleType.strikeThrough);
}
};
}
@@ -4,7 +4,8 @@ import 'package:core/presentation/resources/image_paths.dart';
enum RichTextStyleType {
bold,
italic,
underline;
underline,
strikeThrough;
String get commandAction {
switch (this) {
@@ -14,6 +15,8 @@ enum RichTextStyleType {
return 'italic';
case underline:
return 'underline';
case strikeThrough:
return 'strikeThrough';
default:
return '';
}
@@ -27,6 +30,8 @@ enum RichTextStyleType {
return imagePaths.icStyleItalic;
case underline:
return imagePaths.icStyleUnderline;
case strikeThrough:
return imagePaths.icStyleStrikeThrough;
default:
return '';
}