Skip to content

Commit

Permalink
Added SnackBar.action_color
Browse files Browse the repository at this point in the history
Fix #364
  • Loading branch information
FeodorFitsner committed Oct 5, 2022
1 parent b1a6eac commit a407dc9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package/lib/src/controls/snack_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class _SnackBarControlState extends State<SnackBarControl> {
SnackBarAction? action = actionName != ""
? SnackBarAction(
label: actionName,
textColor: HexColor.fromString(Theme.of(context),
widget.control.attrString("actionColor", "")!),
onPressed: () {
debugPrint("SnackBar ${widget.control.id} clicked!");
FletAppServices.of(context).ws.pageEventFromWeb(
Expand Down
13 changes: 12 additions & 1 deletion sdk/python/flet/snack_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class SnackBar(Control):
def __init__(
self,
content: Optional[Control] = None,
content: Control,
ref: Optional[Ref] = None,
disabled: Optional[bool] = None,
visible: Optional[bool] = None,
Expand All @@ -20,6 +20,7 @@ def __init__(
open: bool = False,
# remove_current_snackbar: bool = False,
action: Optional[str] = None,
action_color: Optional[str] = None,
bgcolor: Optional[str] = None,
on_action=None,
):
Expand All @@ -36,6 +37,7 @@ def __init__(
# self.remove_current_snackbar = remove_current_snackbar
self.content = content
self.action = action
self.action_color = action_color
self.bgcolor = bgcolor
self.on_action = on_action

Expand Down Expand Up @@ -90,6 +92,15 @@ def action(self):
def action(self, value):
self._set_attr("action", value)

# action_color
@property
def action_color(self):
return self._get_attr("actionColor")

@action_color.setter
def action_color(self, value):
self._set_attr("actionColor", value)

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

0 comments on commit a407dc9

Please sign in to comment.