diff --git a/client/pubspec.lock b/client/pubspec.lock index d1c7bed50..c1a54c621 100644 --- a/client/pubspec.lock +++ b/client/pubspec.lock @@ -196,9 +196,11 @@ packages: flutter_svg: dependency: transitive description: - name: flutter_svg - url: "https://pub.dartlang.org" - source: hosted + path: "." + ref: flet-fixes + resolved-ref: "71166dc07d39b686f117319a04479d26e44c2a24" + url: "https://github.com/flet-dev/flutter_svg.git" + source: git version: "1.1.5" flutter_test: dependency: "direct dev" diff --git a/package/lib/src/controls/create_control.dart b/package/lib/src/controls/create_control.dart index 00bfe3320..70a46a9ce 100644 --- a/package/lib/src/controls/create_control.dart +++ b/package/lib/src/controls/create_control.dart @@ -326,15 +326,20 @@ Widget constrainedControl( return _expandable( _positionedControl( context, - _offsetControl( - context, - _scaledControl( + _aspectRatio( + _offsetControl( context, - _rotatedControl( + _scaledControl( context, - _sizedControl( - _tooltip(_opacity(context, widget, parent, control), - parent, control), + _rotatedControl( + context, + _sizedControl( + _tooltip( + _opacity(context, widget, parent, control), + parent, + control), + parent, + control), parent, control), parent, @@ -391,6 +396,16 @@ Widget _tooltip(Widget widget, Control? parent, Control control) { : widget; } +Widget _aspectRatio(Widget widget, Control? parent, Control control) { + var aspectRatio = control.attrDouble("aspectRatio"); + return aspectRatio != null + ? AspectRatio( + aspectRatio: aspectRatio, + child: widget, + ) + : widget; +} + Widget _rotatedControl( BuildContext context, Widget widget, Control? parent, Control control) { var rotationDetails = parseRotate(control, "rotate"); diff --git a/package/pubspec.yaml b/package/pubspec.yaml index 7103c972b..65fdc83ee 100644 --- a/package/pubspec.yaml +++ b/package/pubspec.yaml @@ -23,7 +23,10 @@ dependencies: markdown: ^6.0.1 file_picker: ^5.0.1 shared_preferences: ^2.0.15 - flutter_svg: ^1.1.5 + flutter_svg: + git: + url: https://github.com/flet-dev/flutter_svg.git + ref: flet-fixes window_to_front: ^0.0.3 audioplayers: ^1.1.0 diff --git a/sdk/python/flet/animated_switcher.py b/sdk/python/flet/animated_switcher.py index f3ec138b4..f551fb5cf 100644 --- a/sdk/python/flet/animated_switcher.py +++ b/sdk/python/flet/animated_switcher.py @@ -25,6 +25,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -59,6 +60,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/card.py b/sdk/python/flet/card.py index dc1eb2ebc..401323b35 100644 --- a/sdk/python/flet/card.py +++ b/sdk/python/flet/card.py @@ -24,6 +24,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -55,6 +56,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/checkbox.py b/sdk/python/flet/checkbox.py index 4d48b9186..1fdf92b09 100644 --- a/sdk/python/flet/checkbox.py +++ b/sdk/python/flet/checkbox.py @@ -33,6 +33,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -72,6 +73,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/circle_avatar.py b/sdk/python/flet/circle_avatar.py index ddcc89665..5ae0c9e9f 100644 --- a/sdk/python/flet/circle_avatar.py +++ b/sdk/python/flet/circle_avatar.py @@ -24,6 +24,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -61,6 +62,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/column.py b/sdk/python/flet/column.py index e215dcee0..914fd0818 100644 --- a/sdk/python/flet/column.py +++ b/sdk/python/flet/column.py @@ -30,6 +30,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -66,6 +67,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/constrained_control.py b/sdk/python/flet/constrained_control.py index 78993cf01..3a0caf51e 100644 --- a/sdk/python/flet/constrained_control.py +++ b/sdk/python/flet/constrained_control.py @@ -29,6 +29,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -57,6 +58,7 @@ def __init__( self.scale = scale self.rotate = rotate self.offset = offset + self.aspect_ratio = aspect_ratio self.animate_opacity = animate_opacity self.animate_size = animate_size self.animate_position = animate_position @@ -169,6 +171,16 @@ def offset(self) -> OffsetValue: def offset(self, value: OffsetValue): self.__offset = value + # aspect_ratio + @property + def aspect_ratio(self) -> OptionalNumber: + return self._get_attr("aspectRatio") + + @aspect_ratio.setter + @beartype + def aspect_ratio(self, value: OptionalNumber): + self._set_attr("aspectRatio", value) + # animate_opacity @property def animate_opacity(self) -> AnimationValue: diff --git a/sdk/python/flet/container.py b/sdk/python/flet/container.py index 9c304e8e9..6f978cd48 100644 --- a/sdk/python/flet/container.py +++ b/sdk/python/flet/container.py @@ -55,6 +55,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -104,6 +105,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/dropdown.py b/sdk/python/flet/dropdown.py index 31f7a3a8a..4b91e022d 100644 --- a/sdk/python/flet/dropdown.py +++ b/sdk/python/flet/dropdown.py @@ -28,6 +28,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -94,6 +95,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/elevated_button.py b/sdk/python/flet/elevated_button.py index ba98f7ed3..ff0cdcaa9 100644 --- a/sdk/python/flet/elevated_button.py +++ b/sdk/python/flet/elevated_button.py @@ -25,6 +25,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -65,6 +66,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/floating_action_button.py b/sdk/python/flet/floating_action_button.py index baf0612dc..5a9a09fc3 100644 --- a/sdk/python/flet/floating_action_button.py +++ b/sdk/python/flet/floating_action_button.py @@ -24,6 +24,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -58,6 +59,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/form_field_control.py b/sdk/python/flet/form_field_control.py index 3ea6a750b..976d50dd9 100644 --- a/sdk/python/flet/form_field_control.py +++ b/sdk/python/flet/form_field_control.py @@ -31,6 +31,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -92,6 +93,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/gesture_detector.py b/sdk/python/flet/gesture_detector.py index ebe0b6a82..8f40b281c 100644 --- a/sdk/python/flet/gesture_detector.py +++ b/sdk/python/flet/gesture_detector.py @@ -67,6 +67,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -126,6 +127,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/grid_view.py b/sdk/python/flet/grid_view.py index 6e8664844..e23c302ca 100644 --- a/sdk/python/flet/grid_view.py +++ b/sdk/python/flet/grid_view.py @@ -30,6 +30,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -65,6 +66,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/icon.py b/sdk/python/flet/icon.py index 499123058..42607ba71 100644 --- a/sdk/python/flet/icon.py +++ b/sdk/python/flet/icon.py @@ -18,6 +18,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -44,6 +45,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/icon_button.py b/sdk/python/flet/icon_button.py index 3ad211d15..56ea769ad 100644 --- a/sdk/python/flet/icon_button.py +++ b/sdk/python/flet/icon_button.py @@ -25,6 +25,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -64,6 +65,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/image.py b/sdk/python/flet/image.py index 6119a71c2..147c91753 100644 --- a/sdk/python/flet/image.py +++ b/sdk/python/flet/image.py @@ -42,6 +42,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -80,6 +81,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/list_tile.py b/sdk/python/flet/list_tile.py index 9f3042e7d..3843a6199 100644 --- a/sdk/python/flet/list_tile.py +++ b/sdk/python/flet/list_tile.py @@ -29,6 +29,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -69,6 +70,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/list_view.py b/sdk/python/flet/list_view.py index f160a9c1f..ca98aad87 100644 --- a/sdk/python/flet/list_view.py +++ b/sdk/python/flet/list_view.py @@ -30,6 +30,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -65,6 +66,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/markdown.py b/sdk/python/flet/markdown.py index 8d1975f77..1ae08283f 100644 --- a/sdk/python/flet/markdown.py +++ b/sdk/python/flet/markdown.py @@ -33,6 +33,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -65,6 +66,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/matplotlib_chart.py b/sdk/python/flet/matplotlib_chart.py new file mode 100644 index 000000000..a7b27a57c --- /dev/null +++ b/sdk/python/flet/matplotlib_chart.py @@ -0,0 +1,135 @@ +import io +import re +import xml.etree.ElementTree as ET +from typing import Any, Optional, Union + +from beartype import beartype + +from flet import alignment +from flet.container import Container +from flet.control import OptionalNumber +from flet.image import Image +from flet.ref import Ref +from flet.types import AnimationValue, OffsetValue, RotateValue, ScaleValue + +try: + from matplotlib.figure import Figure +except ImportError: + raise Exception( + 'Install "matplotlib" Python package to use MatplotlibChart control.' + ) + + +class MatplotlibChart(Container): + def __init__( + self, + figure: Optional[Figure] = None, + ref: Optional[Ref] = None, + expand: Union[None, bool, int] = None, + opacity: OptionalNumber = None, + rotate: RotateValue = None, + scale: ScaleValue = None, + offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, + animate_opacity: AnimationValue = None, + animate_size: AnimationValue = None, + animate_position: AnimationValue = None, + animate_rotation: AnimationValue = None, + animate_scale: AnimationValue = None, + animate_offset: AnimationValue = None, + on_animation_end=None, + tooltip: Optional[str] = None, + visible: Optional[bool] = None, + disabled: Optional[bool] = None, + data: Any = None, + # + # Specific + # + isolated: bool = False, + original_size: bool = False, + ): + + Container.__init__( + self, + ref=ref, + expand=expand, + opacity=opacity, + rotate=rotate, + scale=scale, + offset=offset, + aspect_ratio=aspect_ratio, + animate_opacity=animate_opacity, + animate_size=animate_size, + animate_position=animate_position, + animate_rotation=animate_rotation, + animate_scale=animate_scale, + animate_offset=animate_offset, + on_animation_end=on_animation_end, + tooltip=tooltip, + visible=visible, + disabled=disabled, + data=data, + ) + + self.figure = figure + self.isolated = isolated + self.original_size = original_size + + def _is_isolated(self): + return self.__isolated + + def _build(self): + self.alignment = alignment.center + self.__img = Image(fit="fill") + self.content = self.__img + + def _before_build_command(self): + super()._before_build_command() + if self.__figure is not None: + s = io.StringIO() + self.__figure.savefig(s, format="svg") + svg = s.getvalue() + + if not self.__original_size: + root = ET.fromstring(svg) + w = float(re.findall(r"\d+", root.attrib["width"])[0]) + h = float(re.findall(r"\d+", root.attrib["height"])[0]) + self.__img.aspect_ratio = w / h + self.__img.src = svg + + # original_size + @property + def original_size(self): + return self.__original_size + + @original_size.setter + def original_size(self, value): + self.__original_size = value + + # isolated + @property + def isolated(self): + return self.__isolated + + @isolated.setter + def isolated(self, value): + self.__isolated = value + + # figure + @property + def figure(self): + return self.__figure + + @figure.setter + def figure(self, value): + self.__figure = value + + # maintain_aspect_ratio + @property + def maintain_aspect_ratio(self) -> bool: + return self.__maintain_aspect_ratio + + @maintain_aspect_ratio.setter + @beartype + def maintain_aspect_ratio(self, value: bool): + self.__maintain_aspect_ratio = value diff --git a/sdk/python/flet/navigation_rail.py b/sdk/python/flet/navigation_rail.py index 7c76c8cec..41d0cc251 100644 --- a/sdk/python/flet/navigation_rail.py +++ b/sdk/python/flet/navigation_rail.py @@ -151,6 +151,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -190,6 +191,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/outlined_button.py b/sdk/python/flet/outlined_button.py index e11e2cded..14ef7b22f 100644 --- a/sdk/python/flet/outlined_button.py +++ b/sdk/python/flet/outlined_button.py @@ -25,6 +25,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -62,6 +63,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/plotly_chart.py b/sdk/python/flet/plotly_chart.py new file mode 100644 index 000000000..db984b76d --- /dev/null +++ b/sdk/python/flet/plotly_chart.py @@ -0,0 +1,131 @@ +import io +import re +import xml.etree.ElementTree as ET +from typing import Any, Optional, Union + +from beartype import beartype + +from flet import alignment +from flet.container import Container +from flet.control import OptionalNumber +from flet.image import Image +from flet.ref import Ref +from flet.types import AnimationValue, OffsetValue, RotateValue, ScaleValue + +try: + from plotly.graph_objects import Figure +except ImportError: + raise Exception('Install "plotly" Python package to use PlotlyChart control.') + + +class PlotlyChart(Container): + def __init__( + self, + figure: Optional[Figure] = None, + ref: Optional[Ref] = None, + expand: Union[None, bool, int] = None, + opacity: OptionalNumber = None, + rotate: RotateValue = None, + scale: ScaleValue = None, + offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, + animate_opacity: AnimationValue = None, + animate_size: AnimationValue = None, + animate_position: AnimationValue = None, + animate_rotation: AnimationValue = None, + animate_scale: AnimationValue = None, + animate_offset: AnimationValue = None, + on_animation_end=None, + tooltip: Optional[str] = None, + visible: Optional[bool] = None, + disabled: Optional[bool] = None, + data: Any = None, + # + # Specific + # + isolated: bool = False, + original_size: bool = False, + ): + + Container.__init__( + self, + ref=ref, + expand=expand, + opacity=opacity, + rotate=rotate, + scale=scale, + offset=offset, + aspect_ratio=aspect_ratio, + animate_opacity=animate_opacity, + animate_size=animate_size, + animate_position=animate_position, + animate_rotation=animate_rotation, + animate_scale=animate_scale, + animate_offset=animate_offset, + on_animation_end=on_animation_end, + tooltip=tooltip, + visible=visible, + disabled=disabled, + data=data, + ) + + self.figure = figure + self.isolated = isolated + self.original_size = original_size + + def _is_isolated(self): + return self.__isolated + + def _build(self): + self.alignment = alignment.center + self.__img = Image(fit="fill") + self.content = self.__img + + def _before_build_command(self): + super()._before_build_command() + if self.__figure is not None: + svg = self.__figure.to_image(format="svg").decode("utf-8") + + if not self.__original_size: + root = ET.fromstring(svg) + w = float(re.findall(r"\d+", root.attrib["width"])[0]) + h = float(re.findall(r"\d+", root.attrib["height"])[0]) + self.__img.aspect_ratio = w / h + self.__img.src = svg + + # original_size + @property + def original_size(self): + return self.__original_size + + @original_size.setter + def original_size(self, value): + self.__original_size = value + + # isolated + @property + def isolated(self): + return self.__isolated + + @isolated.setter + def isolated(self, value): + self.__isolated = value + + # figure + @property + def figure(self): + return self.__figure + + @figure.setter + def figure(self, value): + self.__figure = value + + # maintain_aspect_ratio + @property + def maintain_aspect_ratio(self) -> bool: + return self.__maintain_aspect_ratio + + @maintain_aspect_ratio.setter + @beartype + def maintain_aspect_ratio(self, value: bool): + self.__maintain_aspect_ratio = value diff --git a/sdk/python/flet/popup_menu_button.py b/sdk/python/flet/popup_menu_button.py index 1c24e88a0..e5d9831a9 100644 --- a/sdk/python/flet/popup_menu_button.py +++ b/sdk/python/flet/popup_menu_button.py @@ -103,6 +103,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -135,6 +136,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/progress_bar.py b/sdk/python/flet/progress_bar.py index 1530fe44a..f990f1124 100644 --- a/sdk/python/flet/progress_bar.py +++ b/sdk/python/flet/progress_bar.py @@ -23,6 +23,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -56,6 +57,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/progress_ring.py b/sdk/python/flet/progress_ring.py index 96c66d255..7420b565b 100644 --- a/sdk/python/flet/progress_ring.py +++ b/sdk/python/flet/progress_ring.py @@ -23,6 +23,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -56,6 +57,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/radio.py b/sdk/python/flet/radio.py index 9e318d363..3db7b6ad8 100644 --- a/sdk/python/flet/radio.py +++ b/sdk/python/flet/radio.py @@ -33,6 +33,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -69,6 +70,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/row.py b/sdk/python/flet/row.py index f34f9d432..76342c066 100644 --- a/sdk/python/flet/row.py +++ b/sdk/python/flet/row.py @@ -30,6 +30,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -66,6 +67,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/shader_mask.py b/sdk/python/flet/shader_mask.py index 8eb74512a..fce8a8e00 100644 --- a/sdk/python/flet/shader_mask.py +++ b/sdk/python/flet/shader_mask.py @@ -31,6 +31,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -63,6 +64,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/slider.py b/sdk/python/flet/slider.py index 1be046049..524372a33 100644 --- a/sdk/python/flet/slider.py +++ b/sdk/python/flet/slider.py @@ -23,6 +23,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -61,6 +62,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/stack.py b/sdk/python/flet/stack.py index a8150032b..3c6ff27a9 100644 --- a/sdk/python/flet/stack.py +++ b/sdk/python/flet/stack.py @@ -29,6 +29,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -58,6 +59,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/switch.py b/sdk/python/flet/switch.py index ad4330748..f11ee17e1 100644 --- a/sdk/python/flet/switch.py +++ b/sdk/python/flet/switch.py @@ -31,6 +31,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -67,6 +68,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/tabs.py b/sdk/python/flet/tabs.py index 9424f94a5..10c9148cc 100644 --- a/sdk/python/flet/tabs.py +++ b/sdk/python/flet/tabs.py @@ -91,6 +91,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -123,6 +124,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/text.py b/sdk/python/flet/text.py index 9274bca6b..e45a26abf 100644 --- a/sdk/python/flet/text.py +++ b/sdk/python/flet/text.py @@ -49,6 +49,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -92,6 +93,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/text_button.py b/sdk/python/flet/text_button.py index f9a96001c..969fac2e8 100644 --- a/sdk/python/flet/text_button.py +++ b/sdk/python/flet/text_button.py @@ -25,6 +25,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -62,6 +63,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/textfield.py b/sdk/python/flet/textfield.py index 9a95ca01e..d63a82475 100644 --- a/sdk/python/flet/textfield.py +++ b/sdk/python/flet/textfield.py @@ -50,6 +50,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -132,6 +133,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position, diff --git a/sdk/python/flet/window_drag_area.py b/sdk/python/flet/window_drag_area.py index df30f4969..7ddc2c6f5 100644 --- a/sdk/python/flet/window_drag_area.py +++ b/sdk/python/flet/window_drag_area.py @@ -22,6 +22,7 @@ def __init__( rotate: RotateValue = None, scale: ScaleValue = None, offset: OffsetValue = None, + aspect_ratio: OptionalNumber = None, animate_opacity: AnimationValue = None, animate_size: AnimationValue = None, animate_position: AnimationValue = None, @@ -49,6 +50,7 @@ def __init__( rotate=rotate, scale=scale, offset=offset, + aspect_ratio=aspect_ratio, animate_opacity=animate_opacity, animate_size=animate_size, animate_position=animate_position,