Skip to content

Commit ed54140

Browse files
committed
Remove warning when Text.style is set to None
1 parent 88e3f37 commit ed54140

File tree

1 file changed

+9
-6
lines changed
  • sdk/python/packages/flet-core/src/flet_core

1 file changed

+9
-6
lines changed

sdk/python/packages/flet-core/src/flet_core/text.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,12 @@ def style(self, value: Union[TextThemeStyle, TextStyle, None]):
271271
self._set_attr(
272272
"style", value.value if isinstance(value, TextThemeStyle) else value
273273
)
274-
warn(
275-
"If you wish to set the TextThemeStyle, use `Text.theme_style` instead. "
276-
"The `Text.style` property should be used to set the TextStyle only.",
277-
stacklevel=2,
278-
)
274+
if value is not None:
275+
warn(
276+
"If you wish to set the TextThemeStyle, use `Text.theme_style` instead. "
277+
"The `Text.style` property should be used to set the TextStyle only.",
278+
stacklevel=2,
279+
)
279280

280281
# theme_style
281282
@property
@@ -284,7 +285,9 @@ def theme_style(self):
284285

285286
@theme_style.setter
286287
def theme_style(self, value: Optional[TextThemeStyle]):
287-
self._set_attr("theme_style", value.value if isinstance(value, TextThemeStyle) else value)
288+
self._set_attr(
289+
"theme_style", value.value if isinstance(value, TextThemeStyle) else value
290+
)
288291

289292
# italic
290293
@property

0 commit comments

Comments
 (0)