Skip to content

Commit

Permalink
Revert "Text.rtl"
Browse files Browse the repository at this point in the history
This reverts commit e73c426.
  • Loading branch information
ndonkoHenri committed Feb 8, 2024
1 parent e73c426 commit 5f9d302
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 34 deletions.
5 changes: 0 additions & 5 deletions package/lib/src/controls/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class TextControl extends StatelessWidget with FletStoreMixin {
);
String? semanticsLabel = control.attrString("semanticsLabel");
bool noWrap = control.attrBool("noWrap", false)!;
bool rtl = control.attrBool("rtl", false)!;
int? maxLines = control.attrInt("maxLines");

TextStyle? style;
Expand Down Expand Up @@ -114,30 +113,26 @@ class TextControl extends StatelessWidget with FletStoreMixin {
? SelectableText.rich(
TextSpan(text: text, style: style, children: spans),
maxLines: maxLines,
textDirection: rtl ? TextDirection.rtl : null,
textAlign: textAlign,
)
: SelectableText(
text,
semanticsLabel: semanticsLabel,
maxLines: maxLines,
textDirection: rtl ? TextDirection.rtl : null,
style: style,
textAlign: textAlign,
)
: (spans.isNotEmpty)
? RichText(
text: TextSpan(text: text, style: style, children: spans),
maxLines: maxLines,
textDirection: rtl ? TextDirection.rtl : null,
softWrap: !noWrap,
textAlign: textAlign,
overflow: overflow,
)
: Text(
text,
semanticsLabel: semanticsLabel,
textDirection: rtl ? TextDirection.rtl : null,
maxLines: maxLines,
softWrap: !noWrap,
style: style,
Expand Down
47 changes: 18 additions & 29 deletions sdk/python/packages/flet-core/src/flet_core/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,6 @@ def main(page: ft.Page):
def __init__(
self,
value: Optional[str] = None,
style: Union[TextThemeStyle, TextStyle, None] = None,
spans: Optional[List[TextSpan]] = None,
size: OptionalNumber = None,
color: Optional[str] = None,
text_align: TextAlign = TextAlign.NONE,
font_family: Optional[str] = None,
weight: Optional[FontWeight] = None,
italic: Optional[bool] = None,
theme_style: Optional[TextThemeStyle] = None,
max_lines: Optional[int] = None,
overflow: TextOverflow = TextOverflow.NONE,
selectable: Optional[bool] = None,
no_wrap: Optional[bool] = None,
bgcolor: Optional[str] = None,
semantics_label: Optional[str] = None,
rtl: Optional[bool] = None,
#
# Common
#
ref: Optional[Ref] = None,
key: Optional[str] = None,
width: OptionalNumber = None,
Expand Down Expand Up @@ -132,6 +113,24 @@ def __init__(
visible: Optional[bool] = None,
disabled: Optional[bool] = None,
data: Any = None,
#
# text-specific
#
spans: Optional[List[TextSpan]] = None,
text_align: TextAlign = TextAlign.NONE,
font_family: Optional[str] = None,
size: OptionalNumber = None,
weight: Optional[FontWeight] = None,
italic: Optional[bool] = None,
style: Union[TextThemeStyle, TextStyle, None] = None,
theme_style: Optional[TextThemeStyle] = None,
max_lines: Optional[int] = None,
overflow: TextOverflow = TextOverflow.NONE,
selectable: Optional[bool] = None,
no_wrap: Optional[bool] = None,
color: Optional[str] = None,
bgcolor: Optional[str] = None,
semantics_label: Optional[str] = None,
):
ConstrainedControl.__init__(
self,
Expand Down Expand Up @@ -180,7 +179,6 @@ def __init__(
self.color = color
self.bgcolor = bgcolor
self.semantics_label = semantics_label
self.rtl = rtl

def _get_control_name(self):
return "text"
Expand Down Expand Up @@ -238,15 +236,6 @@ def font_family(self):
def font_family(self, value):
self._set_attr("fontFamily", value)

# rtl
@property
def rtl(self) -> Optional[bool]:
return self._get_attr("rtl", data_type="bool", def_value=False)

@rtl.setter
def rtl(self, value: Optional[bool]):
self._set_attr("rtl", value)

# size
@property
def size(self) -> OptionalNumber:
Expand Down

0 comments on commit 5f9d302

Please sign in to comment.