Skip to content

Commit 94f37a1

Browse files
Drop transparent titlebar on macOS (#2284)
Simplifying the codelab, reducing unrequired complexity. Even if looks better. If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. [Effective Dart: Style]: https://dart.dev/guides/language/effective-dart/style
1 parent 1016cc6 commit 94f37a1

File tree

37 files changed

+27
-306
lines changed

37 files changed

+27
-306
lines changed

intro_flutter_gpu/codelab_rebuild.yaml

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ steps:
66
rmdir: step_01
77
- name: Create project
88
flutter: create --empty intro_flutter_gpu --platforms android,ios,macos,windows,linux
9-
- name: Make the macOS titlebar transparent, content full window, and hide the title bar.
10-
full-screen-macos-main-menu-xib: intro_flutter_gpu/macos/Runner/Base.lproj/MainMenu.xib
119
- name: Strip DEVELOPMENT_TEAM
1210
strip-lines-containing: DEVELOPMENT_TEAM =
1311
path: intro_flutter_gpu/ios/Runner.xcodeproj/project.pbxproj
@@ -52,13 +50,13 @@ steps:
5250
flutter: pub add flutter_gpu --sdk=flutter
5351
- name: Add dependencies
5452
path: intro_flutter_gpu
55-
flutter: pub add flutter_gpu_shaders native_assets_cli vector_math xml
53+
flutter: pub add flutter_gpu_shaders native_assets_cli vector_math
5654
- name: Patch pubspec.yaml
5755
path: intro_flutter_gpu/pubspec.yaml
5856
patch-u : |
5957
--- b/intro_flutter_gpu/step_01/pubspec.yaml
6058
+++ a/intro_flutter_gpu/step_01/pubspec.yaml
61-
@@ -23,3 +23,6 @@ dev_dependencies:
59+
@@ -22,3 +22,6 @@ dev_dependencies:
6260
6361
flutter:
6462
uses-material-design: true
@@ -195,31 +193,6 @@ steps:
195193
@override
196194
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
197195
}
198-
- name: mkdir bin
199-
mkdir: intro_flutter_gpu/bin
200-
- name: Add bin/modify_macos_config.dart
201-
path: intro_flutter_gpu/bin/modify_macos_config.dart
202-
replace-contents: |
203-
// Copyright 2024 The Flutter Authors. All rights reserved.
204-
// Use of this source code is governed by a BSD-style license that can be
205-
// found in the LICENSE file.
206-
207-
import 'dart:io';
208-
import 'package:xml/xml.dart';
209-
import 'package:xml/xpath.dart';
210-
211-
void main() {
212-
final file = File('macos/Runner/Base.lproj/MainMenu.xib');
213-
var document = XmlDocument.parse(file.readAsStringSync());
214-
document.xpath('//document/objects/window').first
215-
..setAttribute('titlebarAppearsTransparent', 'YES')
216-
..setAttribute('titleVisibility', 'hidden');
217-
document
218-
.xpath('//document/objects/window/windowStyleMask')
219-
.first
220-
.setAttribute('fullSizeContentView', 'YES');
221-
file.writeAsStringSync(document.toString());
222-
}
223196
- name: Add my_first_triangle.shaderbundle.json
224197
path: intro_flutter_gpu/my_first_triangle.shaderbundle.json
225198
replace-contents: |
@@ -1162,7 +1135,7 @@ steps:
11621135
patch-u: |
11631136
--- b/intro_flutter_gpu/step_12/pubspec.yaml
11641137
+++ a/intro_flutter_gpu/step_12/pubspec.yaml
1165-
@@ -24,4 +24,4 @@ flutter:
1138+
@@ -23,4 +23,4 @@ flutter:
11661139
uses-material-design: true
11671140
11681141
assets:

intro_flutter_gpu/step_01/bin/modify_macos_config.dart

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

intro_flutter_gpu/step_01/macos/Runner/Base.lproj/MainMenu.xib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@
330330
</items>
331331
<point key="canvasLocation" x="142" y="-258"/>
332332
</menu>
333-
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target" titlebarAppearsTransparent="YES" titleVisibility="hidden">
334-
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
333+
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target">
334+
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
335335
<rect key="contentRect" x="335" y="390" width="800" height="600"/>
336336
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/>
337337
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">

intro_flutter_gpu/step_01/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
flutter_gpu_shaders: ^0.2.0
1515
native_assets_cli: ^0.9.0
1616
vector_math: ^2.1.4
17-
xml: ^6.5.0
1817

1918
dev_dependencies:
2019
flutter_test:

intro_flutter_gpu/step_02/bin/modify_macos_config.dart

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

intro_flutter_gpu/step_02/macos/Runner/Base.lproj/MainMenu.xib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@
330330
</items>
331331
<point key="canvasLocation" x="142" y="-258"/>
332332
</menu>
333-
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target" titlebarAppearsTransparent="YES" titleVisibility="hidden">
334-
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
333+
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target">
334+
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
335335
<rect key="contentRect" x="335" y="390" width="800" height="600"/>
336336
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/>
337337
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">

intro_flutter_gpu/step_02/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
flutter_gpu_shaders: ^0.2.0
1515
native_assets_cli: ^0.9.0
1616
vector_math: ^2.1.4
17-
xml: ^6.5.0
1817

1918
dev_dependencies:
2019
flutter_test:

intro_flutter_gpu/step_03/bin/modify_macos_config.dart

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

intro_flutter_gpu/step_03/macos/Runner/Base.lproj/MainMenu.xib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@
330330
</items>
331331
<point key="canvasLocation" x="142" y="-258"/>
332332
</menu>
333-
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target" titlebarAppearsTransparent="YES" titleVisibility="hidden">
334-
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
333+
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target">
334+
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
335335
<rect key="contentRect" x="335" y="390" width="800" height="600"/>
336336
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/>
337337
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">

intro_flutter_gpu/step_03/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
flutter_gpu_shaders: ^0.2.0
1515
native_assets_cli: ^0.9.0
1616
vector_math: ^2.1.4
17-
xml: ^6.5.0
1817

1918
dev_dependencies:
2019
flutter_test:

0 commit comments

Comments
 (0)