Fix: manual checking of directionality (#2063)

* fix: removed manual directionality checking

* chore: run before push script

---------

Co-authored-by: CatHood0 <santiagowmar@gmail.com>
pull/2066/head v10.0.9
Cat 8 months ago committed by GitHub
parent 522cb3f1d4
commit 493bdbc54d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 25
      lib/src/common/utils/directionality.dart
  2. 4
      lib/src/editor/raw_editor/raw_editor_state.dart
  3. 4
      lib/src/editor/widgets/text/text_block.dart

@ -1,25 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
bool isRTLLanguage(Locale locale) {
final rtlLanguages = [
'ar', // Arabic
'dv', // Divehi (Maldivian)
'fa', // Persian (Farsi)
'ha', // Hausa (in Ajami script)
'he', // Hebrew
'khw', // Khowar (in Arabic script)
'ks', // Kashmiri (in Arabic script)
'ku', // Kurdish (Sorani)
'ps', // Pashto
'ur', // Urdu
'yi', // Yiddish
'sd', // Sindhi
'ug', // Uyghur
];
return rtlLanguages.contains(locale.languageCode);
}
bool isRTL(BuildContext context) {
return isRTLLanguage(Localizations.localeOf(context));
}

@ -23,7 +23,6 @@ import '../../common/structs/horizontal_spacing.dart';
import '../../common/structs/offset_value.dart';
import '../../common/structs/vertical_spacing.dart';
import '../../common/utils/cast.dart';
import '../../common/utils/directionality.dart';
import '../../common/utils/platform.dart';
import '../../controller/quill_controller.dart';
import '../../delta/delta_diff.dart';
@ -981,7 +980,8 @@ class QuillRawEditorState extends EditorState
// and watch if the system language is a RTL language and avoid putting
// to the edge of the left side any checkbox or list point/number if is a
// RTL language
if (nodeTextDirection == TextDirection.ltr && isRTL(context)) {
if (nodeTextDirection == TextDirection.ltr &&
_textDirection == TextDirection.rtl) {
nodeTextDirection = TextDirection.rtl;
}
if (node is Line) {

@ -3,7 +3,6 @@ import 'package:flutter/rendering.dart';
import '../../../common/structs/horizontal_spacing.dart';
import '../../../common/structs/vertical_spacing.dart';
import '../../../common/utils/directionality.dart';
import '../../../common/utils/font.dart';
import '../../../controller/quill_controller.dart';
import '../../../delta/delta_diff.dart';
@ -199,7 +198,8 @@ class EditableTextBlock extends StatelessWidget {
// and watch if the system language is a RTL language and avoid putting
// to the edge of the left side any checkbox or list point/number if is a
// RTL language
if (nodeTextDirection == TextDirection.ltr && isRTL(context)) {
if (nodeTextDirection == TextDirection.ltr &&
textDirection == TextDirection.rtl) {
nodeTextDirection = TextDirection.rtl;
}
children.add(

Loading…
Cancel
Save