Skip to content

Commit

Permalink
Added AlertDialog.inset_padding property (#1899)
Browse files Browse the repository at this point in the history
* insetPadding property of AlertDialog

* fixed error with nullable padding
  • Loading branch information
all-mute authored Oct 5, 2023
1 parent 7ee0885 commit 4bfdb62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package/lib/src/controls/alert_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class _AlertDialogControlState extends State<AlertDialogControl> {
actionsPadding: parseEdgeInsets(widget.control, "actionsPadding"),
actionsAlignment: actionsAlignment,
shape: parseOutlinedBorder(widget.control, "shape"),
insetPadding: parseEdgeInsets(widget.control, "insetPadding") ??
const EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0),
);
}

Expand Down
12 changes: 12 additions & 0 deletions sdk/python/packages/flet-core/src/flet_core/alert_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(
actions_padding: PaddingValue = None,
actions_alignment: MainAxisAlignment = MainAxisAlignment.NONE,
shape: Optional[OutlinedBorder] = None,
inset_padding: PaddingValue = None,
on_dismiss=None,
):

Expand All @@ -103,6 +104,7 @@ def __init__(
self.actions_padding = actions_padding
self.actions_alignment = actions_alignment
self.shape = shape
self.inset_padding = inset_padding
self.on_dismiss = on_dismiss

def _get_control_name(self):
Expand All @@ -114,6 +116,7 @@ def _before_build_command(self):
self._set_attr_json("contentPadding", self.__content_padding)
self._set_attr_json("titlePadding", self.__title_padding)
self._set_attr_json("shape", self.__shape)
self._set_attr_json("insetPadding", self.__inset_padding)

def _get_children(self):
children = []
Expand Down Expand Up @@ -225,6 +228,15 @@ def shape(self) -> Optional[OutlinedBorder]:
def shape(self, value: Optional[OutlinedBorder]):
self.__shape = value

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

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

# on_dismiss
@property
def on_dismiss(self):
Expand Down

0 comments on commit 4bfdb62

Please sign in to comment.