@@ -10,26 +10,30 @@ class VoicesSinglePaneDialog extends StatelessWidget {
10
10
final BoxConstraints constraints;
11
11
final Color ? backgroundColor;
12
12
final bool showBorder;
13
+ final VoidCallback ? onCancel;
13
14
final Widget child;
14
15
15
16
const VoicesSinglePaneDialog ({
16
17
super .key,
17
18
this .constraints = const BoxConstraints (minWidth: 900 , minHeight: 600 ),
18
19
this .backgroundColor,
19
20
this .showBorder = false ,
21
+ this .onCancel,
20
22
required this .child,
21
23
});
22
24
23
25
@override
24
26
Widget build (BuildContext context) {
25
27
return _VoicesDesktopDialog (
26
- backgroundColor: Theme . of (context).colors.iconsBackground ,
27
- showBorder: true ,
28
+ backgroundColor: backgroundColor ,
29
+ showBorder: showBorder ,
28
30
constraints: constraints,
29
31
child: Stack (
30
32
children: [
31
33
child,
32
- const _DialogCloseButton (),
34
+ _DialogCloseButton (
35
+ onCancel: onCancel,
36
+ ),
33
37
],
34
38
),
35
39
);
@@ -121,7 +125,11 @@ class _VoicesDesktopDialog extends StatelessWidget {
121
125
}
122
126
123
127
class _DialogCloseButton extends StatelessWidget {
124
- const _DialogCloseButton ();
128
+ final VoidCallback ? onCancel;
129
+
130
+ const _DialogCloseButton ({
131
+ this .onCancel,
132
+ });
125
133
126
134
@override
127
135
Widget build (BuildContext context) {
@@ -134,7 +142,10 @@ class _DialogCloseButton extends StatelessWidget {
134
142
child: IconButtonTheme (
135
143
data: const IconButtonThemeData (style: buttonStyle),
136
144
child: XButton (
137
- onTap: () => Navigator .of (context).pop (),
145
+ onTap: () {
146
+ onCancel? .call ();
147
+ Navigator .of (context).pop ();
148
+ },
138
149
),
139
150
),
140
151
);
0 commit comments