|
1 | 1 | import dataclasses |
2 | | -import time |
3 | 2 | from dataclasses import field |
4 | 3 | from enum import Enum |
5 | 4 | from typing import Any, Optional, Union |
6 | 5 |
|
| 6 | +import time |
| 7 | + |
7 | 8 | from flet_core.control import Control, OptionalNumber |
8 | 9 | from flet_core.form_field_control import FormFieldControl, InputBorder |
9 | 10 | from flet_core.ref import Ref |
|
17 | 18 | RotateValue, |
18 | 19 | ScaleValue, |
19 | 20 | TextAlign, |
20 | | - TextAlignString, |
| 21 | + VerticalAlignment, |
21 | 22 | ) |
22 | 23 |
|
23 | 24 | try: |
@@ -141,6 +142,7 @@ def __init__( |
141 | 142 | # |
142 | 143 | text_size: OptionalNumber = None, |
143 | 144 | text_style: Optional[TextStyle] = None, |
| 145 | + text_vertical_align: Union[VerticalAlignment, OptionalNumber] = None, |
144 | 146 | label: Optional[str] = None, |
145 | 147 | label_style: Optional[TextStyle] = None, |
146 | 148 | icon: Optional[str] = None, |
@@ -179,6 +181,7 @@ def __init__( |
179 | 181 | adaptive: Optional[bool] = None, |
180 | 182 | value: Optional[str] = None, |
181 | 183 | keyboard_type: Optional[KeyboardType] = None, |
| 184 | + rtl: Optional[bool] = None, |
182 | 185 | multiline: Optional[bool] = None, |
183 | 186 | min_lines: Optional[int] = None, |
184 | 187 | max_lines: Optional[int] = None, |
@@ -235,6 +238,7 @@ def __init__( |
235 | 238 | # |
236 | 239 | text_size=text_size, |
237 | 240 | text_style=text_style, |
| 241 | + text_vertical_align=text_vertical_align, |
238 | 242 | label=label, |
239 | 243 | label_style=label_style, |
240 | 244 | icon=icon, |
@@ -272,6 +276,7 @@ def __init__( |
272 | 276 | self.text_style = text_style |
273 | 277 | self.keyboard_type = keyboard_type |
274 | 278 | self.text_align = text_align |
| 279 | + self.rtl = rtl |
275 | 280 | self.multiline = multiline |
276 | 281 | self.min_lines = min_lines |
277 | 282 | self.max_lines = max_lines |
@@ -349,13 +354,16 @@ def text_align(self) -> TextAlign: |
349 | 354 | @text_align.setter |
350 | 355 | def text_align(self, value: TextAlign): |
351 | 356 | self.__text_align = value |
352 | | - if isinstance(value, TextAlign): |
353 | | - self._set_attr("textAlign", value.value) |
354 | | - else: |
355 | | - self.__set_text_align(value) |
| 357 | + self._set_attr("textAlign", value.value if isinstance(value, TextAlign) else value) |
| 358 | + |
| 359 | + # rtl |
| 360 | + @property |
| 361 | + def rtl(self) -> Optional[bool]: |
| 362 | + return self._get_attr("rtl", data_type="bool", def_value=False) |
356 | 363 |
|
357 | | - def __set_text_align(self, value: TextAlignString): |
358 | | - self._set_attr("textAlign", value) |
| 364 | + @rtl.setter |
| 365 | + def rtl(self, value: Optional[bool]): |
| 366 | + self._set_attr("rtl", value) |
359 | 367 |
|
360 | 368 | # multiline |
361 | 369 | @property |
|
0 commit comments