@@ -84,6 +84,56 @@ async def close_dialog(_):
84
84
close_confirm_dialog .open = False
85
85
page .update ()
86
86
87
+ close_confirm_controls = [
88
+ ft .Text (
89
+ _ ["confirm_exit_content" ],
90
+ size = 14 ,
91
+ text_align = ft .TextAlign .CENTER ,
92
+ ),
93
+ ft .Container (height = 10 )
94
+ ]
95
+
96
+ if page .platform .value != 'macos' :
97
+ close_confirm_controls .append (
98
+ ft .Container (
99
+ content = ft .Text (
100
+ _ ["minimize_to_tray_tip" ],
101
+ size = 12 ,
102
+ color = ft .colors .GREY_500 ,
103
+ text_align = ft .TextAlign .CENTER ,
104
+ ),
105
+ padding = ft .padding .all (8 ),
106
+ border_radius = 5 ,
107
+ bgcolor = ft .colors .with_opacity (0.1 , ft .colors .BLUE_GREY ),
108
+ )
109
+ )
110
+
111
+ close_confirm_actions = [
112
+ ft .TextButton (
113
+ content = ft .Text (_ ["cancel" ], size = 14 ),
114
+ on_click = close_dialog ,
115
+ style = ft .ButtonStyle (
116
+ color = ft .colors .PRIMARY ,
117
+ ),
118
+ ),
119
+ ft .OutlinedButton (
120
+ content = ft .Text (_ ["exit_program" ], size = 14 ),
121
+ on_click = close_dialog_dismissed ,
122
+ style = ft .ButtonStyle (
123
+ color = ft .colors .ERROR ,
124
+ ),
125
+ ),
126
+ ]
127
+ if page .platform .value != 'macos' :
128
+ close_confirm_actions .insert (
129
+ 1 , ft .TextButton (
130
+ content = ft .Text (_ ["minimize_to_tray" ], size = 14 ),
131
+ on_click = minimize_to_tray ,
132
+ style = ft .ButtonStyle (
133
+ color = ft .colors .PRIMARY ,
134
+ ),
135
+ ))
136
+
87
137
close_confirm_dialog = ft .AlertDialog (
88
138
modal = True ,
89
139
title = ft .Text (
@@ -94,55 +144,15 @@ async def close_dialog(_):
94
144
),
95
145
content = ft .Container (
96
146
content = ft .Column (
97
- controls = [
98
- ft .Text (
99
- _ ["confirm_exit_content" ],
100
- size = 14 ,
101
- text_align = ft .TextAlign .CENTER ,
102
- ),
103
- ft .Container (height = 10 ),
104
- ft .Container (
105
- content = ft .Text (
106
- _ ["minimize_to_tray_tip" ],
107
- size = 12 ,
108
- color = ft .colors .GREY_500 ,
109
- text_align = ft .TextAlign .CENTER ,
110
- ),
111
- padding = ft .padding .all (8 ),
112
- border_radius = 5 ,
113
- bgcolor = ft .colors .with_opacity (0.1 , ft .colors .BLUE_GREY ),
114
- ),
115
- ],
147
+ controls = close_confirm_controls ,
116
148
spacing = 5 ,
117
149
tight = True ,
118
150
horizontal_alignment = ft .CrossAxisAlignment .CENTER ,
119
151
),
120
152
padding = ft .padding .symmetric (horizontal = 20 , vertical = 10 ),
121
- width = 400 ,
153
+ width = 400 if page . platform . value != 'macos' else None ,
122
154
),
123
- actions = [
124
- ft .TextButton (
125
- content = ft .Text (_ ["cancel" ], size = 14 ),
126
- on_click = close_dialog ,
127
- style = ft .ButtonStyle (
128
- color = ft .colors .PRIMARY ,
129
- ),
130
- ),
131
- ft .TextButton (
132
- content = ft .Text (_ ["minimize_to_tray" ], size = 14 ),
133
- on_click = minimize_to_tray ,
134
- style = ft .ButtonStyle (
135
- color = ft .colors .PRIMARY ,
136
- ),
137
- ),
138
- ft .OutlinedButton (
139
- content = ft .Text (_ ["exit_program" ], size = 14 ),
140
- on_click = close_dialog_dismissed ,
141
- style = ft .ButtonStyle (
142
- color = ft .colors .ERROR ,
143
- ),
144
- ),
145
- ],
155
+ actions = close_confirm_actions ,
146
156
actions_alignment = ft .MainAxisAlignment .END ,
147
157
shape = ft .RoundedRectangleBorder (radius = 10 ),
148
158
)
0 commit comments