diff --git a/client/lib/controls/create_control.dart b/client/lib/controls/create_control.dart index bac7e7813..ee924fda4 100644 --- a/client/lib/controls/create_control.dart +++ b/client/lib/controls/create_control.dart @@ -252,8 +252,11 @@ Widget baseControl(Widget widget, Control? parent, Control control) { Widget constrainedControl(Widget widget, Control? parent, Control control) { return _expandable( - _sizedControl( - _tooltip(_opacity(widget, parent, control), parent, control), + _positionedControl( + _sizedControl( + _tooltip(_opacity(widget, parent, control), parent, control), + parent, + control), parent, control), parent, @@ -282,6 +285,25 @@ Widget _tooltip(Widget widget, Control? parent, Control control) { : widget; } +Widget _positionedControl(Widget widget, Control? parent, Control control) { + var left = control.attrDouble("left", null); + var top = control.attrDouble("top", null); + var right = control.attrDouble("right", null); + var bottom = control.attrDouble("bottom", null); + + if (left != null || top != null || right != null || bottom != null) { + debugPrint("Positioned"); + return Positioned( + left: left, + top: top, + right: right, + bottom: bottom, + child: widget, + ); + } + return widget; +} + Widget _sizedControl(Widget widget, Control? parent, Control control) { var width = control.attrDouble("width", null); var height = control.attrDouble("height", null); diff --git a/sdk/python/flet/card.py b/sdk/python/flet/card.py index 5842be98d..505bcc2be 100644 --- a/sdk/python/flet/card.py +++ b/sdk/python/flet/card.py @@ -14,6 +14,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -32,6 +36,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/checkbox.py b/sdk/python/flet/checkbox.py index fd1b7e8a2..1b1cbd7f8 100644 --- a/sdk/python/flet/checkbox.py +++ b/sdk/python/flet/checkbox.py @@ -21,6 +21,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -44,6 +48,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/circle_avatar.py b/sdk/python/flet/circle_avatar.py index 75c572f58..e87682be0 100644 --- a/sdk/python/flet/circle_avatar.py +++ b/sdk/python/flet/circle_avatar.py @@ -14,6 +14,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -37,6 +41,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/column.py b/sdk/python/flet/column.py index 91d45573a..e184a123e 100644 --- a/sdk/python/flet/column.py +++ b/sdk/python/flet/column.py @@ -20,6 +20,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, visible: bool = None, @@ -42,6 +46,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, visible=visible, diff --git a/sdk/python/flet/constrained_control.py b/sdk/python/flet/constrained_control.py index adaded169..9ede73bf6 100644 --- a/sdk/python/flet/constrained_control.py +++ b/sdk/python/flet/constrained_control.py @@ -1,8 +1,8 @@ -from typing import Optional, Union +from typing import Union from beartype import beartype -from flet.control import Control, InputBorder, OptionalNumber +from flet.control import Control, OptionalNumber from flet.ref import Ref @@ -21,6 +21,10 @@ def __init__( # width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, ): Control.__init__( self, @@ -35,6 +39,10 @@ def __init__( self.width = width self.height = height + self.left = left + self.top = top + self.right = right + self.bottom = bottom # width @property @@ -55,3 +63,43 @@ def height(self) -> OptionalNumber: @beartype def height(self, value: OptionalNumber): self._set_attr("height", value) + + # left + @property + def left(self) -> OptionalNumber: + return self._get_attr("left") + + @left.setter + @beartype + def left(self, value: OptionalNumber): + self._set_attr("left", value) + + # top + @property + def top(self) -> OptionalNumber: + return self._get_attr("top") + + @top.setter + @beartype + def top(self, value: OptionalNumber): + self._set_attr("top", value) + + # right + @property + def right(self) -> OptionalNumber: + return self._get_attr("right") + + @right.setter + @beartype + def right(self, value: OptionalNumber): + self._set_attr("right", value) + + # bottom + @property + def bottom(self) -> OptionalNumber: + return self._get_attr("bottom") + + @bottom.setter + @beartype + def bottom(self, value: OptionalNumber): + self._set_attr("bottom", value) diff --git a/sdk/python/flet/container.py b/sdk/python/flet/container.py index bc7bf688e..de343d6bb 100644 --- a/sdk/python/flet/container.py +++ b/sdk/python/flet/container.py @@ -29,6 +29,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -52,6 +56,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/elevated_button.py b/sdk/python/flet/elevated_button.py index 9df7ec0e3..8b4e6e6a7 100644 --- a/sdk/python/flet/elevated_button.py +++ b/sdk/python/flet/elevated_button.py @@ -14,6 +14,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -37,6 +41,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/floating_action_button.py b/sdk/python/flet/floating_action_button.py index 9b32ff9ef..6c1a03b42 100644 --- a/sdk/python/flet/floating_action_button.py +++ b/sdk/python/flet/floating_action_button.py @@ -14,6 +14,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -34,6 +38,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/form_field_control.py b/sdk/python/flet/form_field_control.py index e67079888..09fb7ede3 100644 --- a/sdk/python/flet/form_field_control.py +++ b/sdk/python/flet/form_field_control.py @@ -14,6 +14,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -44,6 +48,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/grid_view.py b/sdk/python/flet/grid_view.py index 6f6e949aa..4d41a1f67 100644 --- a/sdk/python/flet/grid_view.py +++ b/sdk/python/flet/grid_view.py @@ -15,6 +15,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, visible: bool = None, @@ -36,6 +40,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, visible=visible, diff --git a/sdk/python/flet/icon_button.py b/sdk/python/flet/icon_button.py index 8f86f2f50..175bc57d5 100644 --- a/sdk/python/flet/icon_button.py +++ b/sdk/python/flet/icon_button.py @@ -14,6 +14,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -35,6 +39,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/list_tile.py b/sdk/python/flet/list_tile.py index d51dec345..a2a7e8116 100644 --- a/sdk/python/flet/list_tile.py +++ b/sdk/python/flet/list_tile.py @@ -15,6 +15,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -40,6 +44,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/list_view.py b/sdk/python/flet/list_view.py index b773b15a3..f4bdd0759 100644 --- a/sdk/python/flet/list_view.py +++ b/sdk/python/flet/list_view.py @@ -15,6 +15,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, visible: bool = None, @@ -36,6 +40,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, visible=visible, diff --git a/sdk/python/flet/navigation_rail.py b/sdk/python/flet/navigation_rail.py index b7ad368eb..a362b8c9d 100644 --- a/sdk/python/flet/navigation_rail.py +++ b/sdk/python/flet/navigation_rail.py @@ -135,6 +135,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, visible: bool = None, @@ -160,6 +164,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, visible=visible, diff --git a/sdk/python/flet/outlined_button.py b/sdk/python/flet/outlined_button.py index 801b2ef0c..4653165b0 100644 --- a/sdk/python/flet/outlined_button.py +++ b/sdk/python/flet/outlined_button.py @@ -15,6 +15,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -35,6 +39,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/popup_menu_button.py b/sdk/python/flet/popup_menu_button.py index f7d373c5f..ef0762cf8 100644 --- a/sdk/python/flet/popup_menu_button.py +++ b/sdk/python/flet/popup_menu_button.py @@ -90,6 +90,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -108,6 +112,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/progress_bar.py b/sdk/python/flet/progress_bar.py index 6a1298fd7..27e940240 100644 --- a/sdk/python/flet/progress_bar.py +++ b/sdk/python/flet/progress_bar.py @@ -13,6 +13,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -32,6 +36,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/progress_ring.py b/sdk/python/flet/progress_ring.py index 8dd7c5613..02d47ac63 100644 --- a/sdk/python/flet/progress_ring.py +++ b/sdk/python/flet/progress_ring.py @@ -13,6 +13,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -32,6 +36,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/radio.py b/sdk/python/flet/radio.py index 302941b97..2fddd049b 100644 --- a/sdk/python/flet/radio.py +++ b/sdk/python/flet/radio.py @@ -21,6 +21,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -42,6 +46,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/row.py b/sdk/python/flet/row.py index e2f24160d..b50abfa12 100644 --- a/sdk/python/flet/row.py +++ b/sdk/python/flet/row.py @@ -20,6 +20,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, visible: bool = None, @@ -42,6 +46,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, visible=visible, diff --git a/sdk/python/flet/slider.py b/sdk/python/flet/slider.py index d8b22fe40..375c0d603 100644 --- a/sdk/python/flet/slider.py +++ b/sdk/python/flet/slider.py @@ -13,6 +13,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -37,6 +41,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/stack.py b/sdk/python/flet/stack.py index 079578a6d..75fc1a581 100644 --- a/sdk/python/flet/stack.py +++ b/sdk/python/flet/stack.py @@ -12,6 +12,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, visible: bool = None, @@ -23,6 +27,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, visible=visible, diff --git a/sdk/python/flet/switch.py b/sdk/python/flet/switch.py index 4967ddce8..98a8f38f6 100644 --- a/sdk/python/flet/switch.py +++ b/sdk/python/flet/switch.py @@ -22,6 +22,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -44,6 +48,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/tabs.py b/sdk/python/flet/tabs.py index 4dfa49684..49525fb18 100644 --- a/sdk/python/flet/tabs.py +++ b/sdk/python/flet/tabs.py @@ -81,6 +81,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, visible: bool = None, @@ -99,6 +103,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, visible=visible, diff --git a/sdk/python/flet/text.py b/sdk/python/flet/text.py index 2cbe8b935..15b0d105a 100644 --- a/sdk/python/flet/text.py +++ b/sdk/python/flet/text.py @@ -36,6 +36,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -64,6 +68,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip, diff --git a/sdk/python/flet/text_button.py b/sdk/python/flet/text_button.py index b681cc6c6..45e510b3d 100644 --- a/sdk/python/flet/text_button.py +++ b/sdk/python/flet/text_button.py @@ -14,6 +14,10 @@ def __init__( ref: Ref = None, width: OptionalNumber = None, height: OptionalNumber = None, + left: OptionalNumber = None, + top: OptionalNumber = None, + right: OptionalNumber = None, + bottom: OptionalNumber = None, expand: Union[bool, int] = None, opacity: OptionalNumber = None, tooltip: str = None, @@ -34,6 +38,10 @@ def __init__( ref=ref, width=width, height=height, + left=left, + top=top, + right=right, + bottom=bottom, expand=expand, opacity=opacity, tooltip=tooltip,