Skip to content

Commit a407dc9

Browse files
committed
Added SnackBar.action_color
Fix #364
1 parent b1a6eac commit a407dc9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

package/lib/src/controls/snack_bar.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class _SnackBarControlState extends State<SnackBarControl> {
4343
SnackBarAction? action = actionName != ""
4444
? SnackBarAction(
4545
label: actionName,
46+
textColor: HexColor.fromString(Theme.of(context),
47+
widget.control.attrString("actionColor", "")!),
4648
onPressed: () {
4749
debugPrint("SnackBar ${widget.control.id} clicked!");
4850
FletAppServices.of(context).ws.pageEventFromWeb(

sdk/python/flet/snack_bar.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class SnackBar(Control):
1010
def __init__(
1111
self,
12-
content: Optional[Control] = None,
12+
content: Control,
1313
ref: Optional[Ref] = None,
1414
disabled: Optional[bool] = None,
1515
visible: Optional[bool] = None,
@@ -20,6 +20,7 @@ def __init__(
2020
open: bool = False,
2121
# remove_current_snackbar: bool = False,
2222
action: Optional[str] = None,
23+
action_color: Optional[str] = None,
2324
bgcolor: Optional[str] = None,
2425
on_action=None,
2526
):
@@ -36,6 +37,7 @@ def __init__(
3637
# self.remove_current_snackbar = remove_current_snackbar
3738
self.content = content
3839
self.action = action
40+
self.action_color = action_color
3941
self.bgcolor = bgcolor
4042
self.on_action = on_action
4143

@@ -90,6 +92,15 @@ def action(self):
9092
def action(self, value):
9193
self._set_attr("action", value)
9294

95+
# action_color
96+
@property
97+
def action_color(self):
98+
return self._get_attr("actionColor")
99+
100+
@action_color.setter
101+
def action_color(self, value):
102+
self._set_attr("actionColor", value)
103+
93104
# bgcolor
94105
@property
95106
def bgcolor(self):

0 commit comments

Comments
 (0)