Skip to content

Commit

Permalink
fix: Setting CheckBox.border_side.stroke_align to an Enum fails (#4526
Browse files Browse the repository at this point in the history
)

* `BorderSideStrokeAlign` should inherit from float

* properly parse `Chip.border_side`
  • Loading branch information
ndonkoHenri authored Dec 12, 2024
1 parent 506d995 commit 0378434
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sdk/python/packages/flet/src/flet/core/border.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from dataclasses import dataclass, field
from dataclasses import dataclass
from enum import Enum
from typing import Optional, Union

from flet.core.types import ColorValue, OptionalNumber


class BorderSideStrokeAlign(Enum):
class BorderSideStrokeAlign(float, Enum):
INSIDE = -1.0
CENTER = 0.0
OUTSIDE = 1.0
Expand All @@ -14,16 +14,16 @@ class BorderSideStrokeAlign(Enum):
@dataclass
class BorderSide:
width: OptionalNumber
color: Optional[ColorValue] = field(default=None)
stroke_align: Union[BorderSideStrokeAlign, OptionalNumber] = field(default=None)
color: Optional[ColorValue] = None
stroke_align: Union[BorderSideStrokeAlign, OptionalNumber] = None


@dataclass
class Border:
top: Optional[BorderSide] = field(default=None)
right: Optional[BorderSide] = field(default=None)
bottom: Optional[BorderSide] = field(default=None)
left: Optional[BorderSide] = field(default=None)
top: Optional[BorderSide] = None
right: Optional[BorderSide] = None
bottom: Optional[BorderSide] = None
left: Optional[BorderSide] = None


def all(width: Optional[float] = None, color: Optional[ColorValue] = None) -> Border:
Expand Down
1 change: 1 addition & 0 deletions sdk/python/packages/flet/src/flet/core/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def before_update(self):
self._set_attr_json("labelStyle", self.__label_style)
self._set_attr_json("padding", self.__padding)
self._set_attr_json("shape", self.__shape)
self._set_attr_json("borderSide", self.__border_side)
self._set_attr_json("color", self.__color, wrap_attr_dict=True)

def _get_children(self):
Expand Down

0 comments on commit 0378434

Please sign in to comment.