Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Optional[] from predefined typing *Values #4702

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdk/python/packages/flet/src/flet/core/ads/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def __init__(
expand_loose: Optional[bool] = None,
col: Optional[ResponsiveNumber] = None,
opacity: OptionalNumber = None,
rotate: RotateValue = None,
scale: ScaleValue = None,
offset: OffsetValue = None,
rotate: Optional[RotateValue] = None,
scale: Optional[ScaleValue] = None,
offset: Optional[OffsetValue] = None,
aspect_ratio: OptionalNumber = None,
animate_opacity: AnimationValue = None,
animate_size: AnimationValue = None,
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/packages/flet/src/flet/core/ads/base_ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def __init__(
expand_loose: Optional[bool] = None,
col: Optional[ResponsiveNumber] = None,
opacity: OptionalNumber = None,
rotate: RotateValue = None,
scale: ScaleValue = None,
offset: OffsetValue = None,
rotate: Optional[RotateValue] = None,
scale: Optional[ScaleValue] = None,
offset: Optional[OffsetValue] = None,
aspect_ratio: OptionalNumber = None,
animate_opacity: AnimationValue = None,
animate_size: AnimationValue = None,
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/packages/flet/src/flet/core/ads/interstitial.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def __init__(
expand_loose: Optional[bool] = None,
col: Optional[ResponsiveNumber] = None,
opacity: OptionalNumber = None,
rotate: RotateValue = None,
scale: ScaleValue = None,
offset: OffsetValue = None,
rotate: Optional[RotateValue] = None,
scale: Optional[ScaleValue] = None,
offset: Optional[OffsetValue] = None,
aspect_ratio: OptionalNumber = None,
animate_opacity: AnimationValue = None,
animate_size: AnimationValue = None,
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/packages/flet/src/flet/core/ads/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def __init__(
expand_loose: Optional[bool] = None,
col: Optional[ResponsiveNumber] = None,
opacity: OptionalNumber = None,
rotate: RotateValue = None,
scale: ScaleValue = None,
offset: OffsetValue = None,
rotate: Optional[RotateValue] = None,
scale: Optional[ScaleValue] = None,
offset: Optional[OffsetValue] = None,
aspect_ratio: OptionalNumber = None,
animate_opacity: AnimationValue = None,
animate_size: AnimationValue = None,
Expand Down
36 changes: 18 additions & 18 deletions sdk/python/packages/flet/src/flet/core/alert_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ def __init__(
elevation: OptionalNumber = None,
icon: Optional[Control] = None,
open: bool = False,
title_padding: PaddingValue = None,
content_padding: PaddingValue = None,
actions_padding: PaddingValue = None,
title_padding: Optional[PaddingValue] = None,
content_padding: Optional[PaddingValue] = None,
actions_padding: Optional[PaddingValue] = None,
actions_alignment: Optional[MainAxisAlignment] = None,
shape: Optional[OutlinedBorder] = None,
inset_padding: PaddingValue = None,
icon_padding: PaddingValue = None,
action_button_padding: PaddingValue = None,
inset_padding: Optional[PaddingValue] = None,
icon_padding: Optional[PaddingValue] = None,
action_button_padding: Optional[PaddingValue] = None,
surface_tint_color: Optional[ColorValue] = None,
shadow_color: Optional[ColorValue] = None,
icon_color: Optional[ColorValue] = None,
Expand Down Expand Up @@ -322,11 +322,11 @@ def icon(self, value: Optional[Control]):

# title_padding
@property
def title_padding(self) -> PaddingValue:
def title_padding(self) -> Optional[PaddingValue]:
return self.__title_padding

@title_padding.setter
def title_padding(self, value: PaddingValue):
def title_padding(self, value: Optional[PaddingValue]):
self.__title_padding = value

# content
Expand All @@ -340,11 +340,11 @@ def content(self, value: Optional[Control]):

# content_padding
@property
def content_padding(self) -> PaddingValue:
def content_padding(self) -> Optional[PaddingValue]:
return self.__content_padding

@content_padding.setter
def content_padding(self, value: PaddingValue):
def content_padding(self, value: Optional[PaddingValue]):
self.__content_padding = value

# actions
Expand All @@ -358,11 +358,11 @@ def actions(self, value: Optional[List[Control]]):

# actions_padding
@property
def actions_padding(self) -> PaddingValue:
def actions_padding(self) -> Optional[PaddingValue]:
return self.__actions_padding

@actions_padding.setter
def actions_padding(self, value: PaddingValue):
def actions_padding(self, value: Optional[PaddingValue]):
self.__actions_padding = value

# actions_alignment
Expand All @@ -389,29 +389,29 @@ def shape(self, value: Optional[OutlinedBorder]):

# inset_padding
@property
def inset_padding(self) -> PaddingValue:
def inset_padding(self) -> Optional[PaddingValue]:
return self.__inset_padding

@inset_padding.setter
def inset_padding(self, value: PaddingValue):
def inset_padding(self, value: Optional[PaddingValue]):
self.__inset_padding = value

# icon_padding
@property
def icon_padding(self) -> PaddingValue:
def icon_padding(self) -> Optional[PaddingValue]:
return self.__icon_padding

@icon_padding.setter
def icon_padding(self, value: PaddingValue):
def icon_padding(self, value: Optional[PaddingValue]):
self.__icon_padding = value

# action_button_padding
@property
def action_button_padding(self) -> PaddingValue:
def action_button_padding(self) -> Optional[PaddingValue]:
return self.__action_button_padding

@action_button_padding.setter
def action_button_padding(self, value: PaddingValue):
def action_button_padding(self, value: Optional[PaddingValue]):
self.__action_button_padding = value

# semantics_label
Expand Down
8 changes: 4 additions & 4 deletions sdk/python/packages/flet/src/flet/core/animated_switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def __init__(
expand_loose: Optional[bool] = None,
col: Optional[ResponsiveNumber] = None,
opacity: OptionalNumber = None,
rotate: RotateValue = None,
scale: ScaleValue = None,
offset: OffsetValue = None,
rotate: Optional[RotateValue] = None,
scale: Optional[ScaleValue] = None,
offset: Optional[OffsetValue] = None,
aspect_ratio: OptionalNumber = None,
animate_opacity: Optional[AnimationValue] = None,
animate_size: Optional[AnimationValue] = None,
Expand All @@ -112,7 +112,7 @@ def __init__(
animate_scale: Optional[AnimationValue] = None,
animate_offset: Optional[AnimationValue] = None,
on_animation_end: OptionalControlEventCallable = None,
tooltip: TooltipValue = None,
tooltip: Optional[TooltipValue] = None,
badge: Optional[BadgeValue] = None,
visible: Optional[bool] = None,
disabled: Optional[bool] = None,
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/packages/flet/src/flet/core/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class Animation:

@dataclass
class AnimationStyle:
duration: DurationValue = None
reverse_duration: DurationValue = None
duration: Optional[DurationValue] = None
reverse_duration: Optional[DurationValue] = None
curve: Optional[AnimationCurve] = None
reverse_curve: Optional[AnimationCurve] = None

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet/src/flet/core/badge.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Badge:
or a button's icon."""

text: Optional[str] = None
offset: OffsetValue = None
offset: Optional[OffsetValue] = None
alignment: Optional[Alignment] = None
bgcolor: Optional[ColorValue] = None
label_visible: Optional[bool] = None
Expand Down
14 changes: 7 additions & 7 deletions sdk/python/packages/flet/src/flet/core/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(
shadow_color: Optional[ColorValue] = None,
divider_color: Optional[ColorValue] = None,
elevation: OptionalNumber = None,
margin: MarginValue = None,
margin: Optional[MarginValue] = None,
content_text_style: Optional[TextStyle] = None,
on_visible: OptionalControlEventCallable = None,
#
Expand Down Expand Up @@ -161,11 +161,11 @@ def leading(self, value: Optional[Control]):

# leading_padding
@property
def leading_padding(self) -> PaddingValue:
def leading_padding(self) -> Optional[PaddingValue]:
return self.__leading_padding

@leading_padding.setter
def leading_padding(self, value: PaddingValue):
def leading_padding(self, value: Optional[PaddingValue]):
self.__leading_padding = value

# content
Expand All @@ -179,20 +179,20 @@ def content(self, value: Control):

# content_padding
@property
def content_padding(self) -> PaddingValue:
def content_padding(self) -> Optional[PaddingValue]:
return self.__content_padding

@content_padding.setter
def content_padding(self, value: PaddingValue):
def content_padding(self, value: Optional[PaddingValue]):
self.__content_padding = value

# margin
@property
def margin(self) -> MarginValue:
def margin(self) -> Optional[MarginValue]:
return self.__margin

@margin.setter
def margin(self, value: MarginValue):
def margin(self, value: Optional[MarginValue]):
self.__margin = value

# actions
Expand Down
12 changes: 6 additions & 6 deletions sdk/python/packages/flet/src/flet/core/bottom_app_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
surface_tint_color: Optional[ColorValue] = None,
bgcolor: Optional[ColorValue] = None,
shadow_color: Optional[ColorValue] = None,
padding: PaddingValue = None,
padding: Optional[PaddingValue] = None,
clip_behavior: Optional[ClipBehavior] = None,
shape: Optional[NotchShape] = None,
notch_margin: OptionalNumber = None,
Expand All @@ -52,9 +52,9 @@ def __init__(
expand_loose: Optional[bool] = None,
col: Optional[ResponsiveNumber] = None,
opacity: OptionalNumber = None,
rotate: RotateValue = None,
scale: ScaleValue = None,
offset: OffsetValue = None,
rotate: Optional[RotateValue] = None,
scale: Optional[ScaleValue] = None,
offset: Optional[OffsetValue] = None,
aspect_ratio: OptionalNumber = None,
animate_opacity: Optional[AnimationValue] = None,
animate_size: Optional[AnimationValue] = None,
Expand Down Expand Up @@ -160,11 +160,11 @@ def shadow_color(self, value: Optional[ColorValue]):

# padding
@property
def padding(self) -> PaddingValue:
def padding(self) -> Optional[PaddingValue]:
return self.__padding

@padding.setter
def padding(self, value: PaddingValue):
def padding(self, value: Optional[PaddingValue]):
self.__padding = value

# shape
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/packages/flet/src/flet/core/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class BoxShadow:
spread_radius: Optional[float] = None
blur_radius: Optional[float] = None
color: Optional[ColorValue] = None
offset: OffsetValue = None
offset: Optional[OffsetValue] = None
blur_style: ShadowBlurStyle = field(default=ShadowBlurStyle.NORMAL)


Expand Down Expand Up @@ -72,7 +72,7 @@ class BoxDecoration:
bgcolor: Optional[ColorValue] = None
image: Optional[DecorationImage] = None
border: Optional[Border] = None
border_radius: BorderRadiusValue = None
border_radius: Optional[BorderRadiusValue] = None
shadow: Union[None, BoxShadow, List[BoxShadow]] = None
gradient: Optional[Gradient] = None
shape: Optional[BoxShape] = None
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/packages/flet/src/flet/core/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __post_init__(self):

@dataclass
class RoundedRectangleBorder(OutlinedBorder):
radius: BorderRadiusValue = None
radius: Optional[BorderRadiusValue] = None

def __post_init__(self):
self.type = "roundedRectangle"
Expand All @@ -43,15 +43,15 @@ def __post_init__(self):

@dataclass
class BeveledRectangleBorder(OutlinedBorder):
radius: BorderRadiusValue = None
radius: Optional[BorderRadiusValue] = None

def __post_init__(self):
self.type = "beveledRectangle"


@dataclass
class ContinuousRectangleBorder(OutlinedBorder):
radius: BorderRadiusValue = None
radius: Optional[BorderRadiusValue] = None

def __post_init__(self):
self.type = "continuousRectangle"
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/packages/flet/src/flet/core/canvas/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def __init__(
expand_loose: Optional[bool] = None,
col: Optional[ResponsiveNumber] = None,
opacity: OptionalNumber = None,
rotate: RotateValue = None,
scale: ScaleValue = None,
offset: OffsetValue = None,
rotate: Optional[RotateValue] = None,
scale: Optional[ScaleValue] = None,
offset: Optional[OffsetValue] = None,
aspect_ratio: OptionalNumber = None,
animate_opacity: Optional[AnimationValue] = None,
animate_size: Optional[AnimationValue] = None,
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet/src/flet/core/canvas/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Rect(PathElement):
y: float
width: float
height: float
border_radius: BorderRadiusValue = dataclasses.field(default=None)
border_radius: Optional[BorderRadiusValue] = None
type: str = dataclasses.field(default="rect")

@dataclasses.dataclass
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/packages/flet/src/flet/core/canvas/rect.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ def height(self, value: OptionalNumber):

# border_radius
@property
def border_radius(self) -> BorderRadiusValue:
def border_radius(self) -> Optional[BorderRadiusValue]:
return self.__border_radius

@border_radius.setter
def border_radius(self, value: BorderRadiusValue):
def border_radius(self, value: Optional[BorderRadiusValue]):
self.__border_radius = value

# paint
Expand Down
Loading