@@ -7,8 +7,8 @@ import 'window_manager_model.dart';
7
7
8
8
class MainWindow extends StatefulWidget {
9
9
MainWindow ({super .key, required WindowController mainController}) {
10
- _windowManagerModel.add (
11
- KeyedWindowController ( isMainWindow: true , controller: mainController));
10
+ _windowManagerModel.add (KeyedWindowController (
11
+ isMainWindow: true , key : UniqueKey () , controller: mainController));
12
12
}
13
13
14
14
final WindowManagerModel _windowManagerModel = WindowManagerModel ();
@@ -70,9 +70,9 @@ class _MainWindowState extends State<MainWindow> {
70
70
windowSettings: widget._settings,
71
71
windowManagerModel: widget._windowManagerModel,
72
72
onDestroyed: () =>
73
- widget._windowManagerModel.remove (controller),
73
+ widget._windowManagerModel.remove (controller.key ),
74
74
onError: () =>
75
- widget._windowManagerModel.remove (controller),
75
+ widget._windowManagerModel.remove (controller.key ),
76
76
));
77
77
}
78
78
}
@@ -134,10 +134,7 @@ class _ActiveWindowsTable extends StatelessWidget {
134
134
key: controller.key,
135
135
color: WidgetStateColor .resolveWith ((states) {
136
136
if (states.contains (WidgetState .selected)) {
137
- return Theme .of (context)
138
- .colorScheme
139
- .primary
140
- .withAlpha (20 );
137
+ return Theme .of (context).colorScheme.primary.withAlpha (20 );
141
138
}
142
139
return Colors .transparent;
143
140
}),
@@ -153,8 +150,8 @@ class _ActiveWindowsTable extends StatelessWidget {
153
150
ListenableBuilder (
154
151
listenable: controller.controller,
155
152
builder: (BuildContext context, Widget ? _) => Text (
156
- controller.controller.view != null
157
- ? '${controller .controller .view ? .viewId }'
153
+ controller.controller.isReady
154
+ ? '${controller .controller .view .viewId }'
158
155
: 'Loading...' )),
159
156
),
160
157
DataCell (
@@ -218,8 +215,15 @@ class _WindowCreatorCard extends StatelessWidget {
218
215
children: [
219
216
OutlinedButton (
220
217
onPressed: () async {
218
+ final UniqueKey key = UniqueKey ();
221
219
windowManagerModel.add (KeyedWindowController (
222
- controller: RegularWindowController ()));
220
+ key: key,
221
+ controller: RegularWindowController (
222
+ onDestroyed: () => windowManagerModel.remove (key),
223
+ onError: (String error) =>
224
+ windowManagerModel.remove (key),
225
+ title: "Regular" ,
226
+ size: windowSettings.regularSize)));
223
227
},
224
228
child: const Text ('Regular' ),
225
229
),
0 commit comments