Skip to content

Commit 3fcfaf5

Browse files
committed
Remove CocoaPods from macOS example project
Migrates the macOS window_example project from CocoaPods to Swift Package Manager for plugin integration. Removes Podfile, Podfile.lock, and related Xcode project references, updates build configs, and adds FlutterGeneratedPluginSwiftPackage. Also refactors Dart code for improved readability and disables the test window creation feature.
1 parent 6f98619 commit 3fcfaf5

File tree

8 files changed

+82
-207
lines changed

8 files changed

+82
-207
lines changed

examples/window_example/lib/main.dart

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ class _WindowManagerPageState extends State<WindowManagerPage> {
114114
_windows = windows;
115115
// Update selected window reference if it still exists
116116
if (_selectedWindow != null) {
117-
final updatedWindow =
118-
windows.firstWhere((w) => w.id == _selectedWindow!.id, orElse: () => _selectedWindow!);
117+
final updatedWindow = windows.firstWhere(
118+
(w) => w.id == _selectedWindow!.id,
119+
orElse: () => _selectedWindow!,
120+
);
119121
_selectedWindow = updatedWindow;
120122
}
121123
});
@@ -177,24 +179,7 @@ class _WindowManagerPageState extends State<WindowManagerPage> {
177179
}
178180

179181
void _createTestWindow() {
180-
try {
181-
final windowManager = WindowManager.instance;
182-
final window = windowManager.create(
183-
title: 'Test Window ${_windows.length + 1}',
184-
width: 600 + (_windows.length * 50),
185-
height: 400 + (_windows.length * 50),
186-
centered: true,
187-
);
188-
189-
if (window != null) {
190-
window.show();
191-
_updateWindows();
192-
}
193-
} catch (e) {
194-
setState(() {
195-
_errorMessage = 'Failed to create window: $e';
196-
});
197-
}
182+
throw UnimplementedError('Create test window not implemented');
198183
}
199184

200185
void _selectWindow(Window window) {
@@ -272,7 +257,7 @@ class _WindowManagerPageState extends State<WindowManagerPage> {
272257
children: [
273258
const Icon(Icons.error, color: Colors.red, size: 48),
274259
const SizedBox(height: 16),
275-
Text(
260+
Text(
276261
_errorMessage!,
277262
textAlign: TextAlign.center,
278263
style: const TextStyle(color: Colors.red),
@@ -742,8 +727,9 @@ class _WindowCanvasState extends State<WindowCanvas> {
742727
),
743728
boxShadow: [
744729
BoxShadow(
745-
color: (isSelected ? Colors.blue : Colors.orange)
746-
.withOpacity(0.3),
730+
color: (isSelected ? Colors.blue : Colors.orange).withOpacity(
731+
0.3,
732+
),
747733
blurRadius: isSelected ? 8 : 4,
748734
offset: const Offset(0, 2),
749735
),
@@ -753,8 +739,9 @@ class _WindowCanvasState extends State<WindowCanvas> {
753739
children: [
754740
// Window background (semi-transparent)
755741
Container(
756-
color: (isSelected ? Colors.blue : Colors.orange)
757-
.withOpacity(0.1),
742+
color: (isSelected ? Colors.blue : Colors.orange).withOpacity(
743+
0.1,
744+
),
758745
),
759746
// Window title bar
760747
Container(
@@ -777,15 +764,19 @@ class _WindowCanvasState extends State<WindowCanvas> {
777764
Icon(
778765
Icons.window,
779766
size: (12 * scale).clamp(8.0, 12.0),
780-
color: isSelected ? Colors.blue[900] : Colors.orange[900],
767+
color: isSelected
768+
? Colors.blue[900]
769+
: Colors.orange[900],
781770
),
782771
SizedBox(width: (4 * scale).clamp(2.0, 4.0)),
783772
Expanded(
784773
child: Text(
785774
window.title.isNotEmpty ? window.title : 'Window',
786775
style: TextStyle(
787776
fontSize: (10 * scale).clamp(6.0, 10.0),
788-
color: isSelected ? Colors.blue[900] : Colors.orange[900],
777+
color: isSelected
778+
? Colors.blue[900]
779+
: Colors.orange[900],
789780
fontWeight: FontWeight.bold,
790781
overflow: TextOverflow.ellipsis,
791782
),
@@ -943,11 +934,7 @@ class WindowDetails extends StatelessWidget {
943934
color: Colors.white.withOpacity(0.9),
944935
borderRadius: BorderRadius.circular(8),
945936
),
946-
child: Icon(
947-
Icons.window,
948-
size: 28,
949-
color: Colors.blue[700],
950-
),
937+
child: Icon(Icons.window, size: 28, color: Colors.blue[700]),
951938
),
952939
const SizedBox(width: 16),
953940
Expanded(
@@ -1011,8 +998,16 @@ class WindowDetails extends StatelessWidget {
1011998
),
1012999
]),
10131000
_buildSection('Window Properties', [
1014-
_DetailItem(Icons.visibility, 'Visible', window.isVisible ? 'Yes' : 'No'),
1015-
_DetailItem(Icons.center_focus_strong, 'Focused', window.isFocused ? 'Yes' : 'No'),
1001+
_DetailItem(
1002+
Icons.visibility,
1003+
'Visible',
1004+
window.isVisible ? 'Yes' : 'No',
1005+
),
1006+
_DetailItem(
1007+
Icons.center_focus_strong,
1008+
'Focused',
1009+
window.isFocused ? 'Yes' : 'No',
1010+
),
10161011
_DetailItem(
10171012
Icons.open_in_full,
10181013
'Maximized',
@@ -1030,8 +1025,16 @@ class WindowDetails extends StatelessWidget {
10301025
),
10311026
]),
10321027
_buildSection('Window Capabilities', [
1033-
_DetailItem(Icons.open_with, 'Resizable', window.isResizable ? 'Yes' : 'No'),
1034-
_DetailItem(Icons.drag_handle, 'Movable', window.isMovable ? 'Yes' : 'No'),
1028+
_DetailItem(
1029+
Icons.open_with,
1030+
'Resizable',
1031+
window.isResizable ? 'Yes' : 'No',
1032+
),
1033+
_DetailItem(
1034+
Icons.drag_handle,
1035+
'Movable',
1036+
window.isMovable ? 'Yes' : 'No',
1037+
),
10351038
_DetailItem(
10361039
Icons.unfold_less,
10371040
'Minimizable',
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
21
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
21
#include "ephemeral/Flutter-Generated.xcconfig"

examples/window_example/macos/Podfile

Lines changed: 0 additions & 42 deletions
This file was deleted.

examples/window_example/macos/Podfile.lock

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)