Skip to content

Commit

Permalink
Added BottomSheet. is_scroll_controlled property
Browse files Browse the repository at this point in the history
Allows expanding bottom sheet on the entire screen.
Close #2087
  • Loading branch information
FeodorFitsner committed Nov 14, 2023
1 parent d2d0f37 commit 12a2605
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions package/lib/src/controls/bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class _BottomSheetControlState extends State<BottomSheetControl> {
var enableDrag = widget.control.attrBool("enableDrag", false)!;
var showDragHandle = widget.control.attrBool("showDragHandle", false)!;
var useSafeArea = widget.control.attrBool("useSafeArea", true)!;
var isScrollControlled =
widget.control.attrBool("isScrollControlled", false)!;

void resetOpenState() {
List<Map<String, String>> props = [
Expand All @@ -80,6 +82,7 @@ class _BottomSheetControlState extends State<BottomSheetControl> {
return bottomSheet;
},
isDismissible: dismissible,
isScrollControlled: isScrollControlled,
enableDrag: enableDrag,
showDragHandle: showDragHandle,
useSafeArea: useSafeArea)
Expand Down
13 changes: 11 additions & 2 deletions sdk/python/packages/flet-core/src/flet_core/bottom_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(
enable_drag: Optional[bool] = None,
show_drag_handle: Optional[bool] = None,
use_safe_area: Optional[bool] = None,
is_scroll_controlled: Optional[bool] = None,
on_dismiss=None,
):
Control.__init__(
Expand All @@ -74,15 +75,14 @@ def __init__(
data=data,
)

self.__title: Optional[Control] = None
self.__content: Optional[Control] = None
self.__actions: List[Control] = []

self.open = open
self.dismissible = dismissible
self.enable_drag = enable_drag
self.show_drag_handle = show_drag_handle
self.use_safe_area = use_safe_area
self.is_scroll_controlled = is_scroll_controlled
self.content = content
self.on_dismiss = on_dismiss

Expand Down Expand Up @@ -141,6 +141,15 @@ def use_safe_area(self) -> Optional[bool]:
def use_safe_area(self, value: Optional[bool]):
self._set_attr("useSafeArea", value)

# is_scroll_controlled
@property
def is_scroll_controlled(self) -> Optional[bool]:
return self._get_attr("isScrollControlled", data_type="bool", def_value=False)

@is_scroll_controlled.setter
def is_scroll_controlled(self, value: Optional[bool]):
self._set_attr("isScrollControlled", value)

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

0 comments on commit 12a2605

Please sign in to comment.