Skip to content

Commit e08d05a

Browse files
committed
feat: initialize macos platform
1 parent 3392f8e commit e08d05a

35 files changed

+1591
-41
lines changed

.metadata

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
8-
channel: stable
7+
revision: "fcf2c11572af6f390246c056bc905eca609533a0"
8+
channel: "stable"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
17-
base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
18-
- platform: linux
19-
create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
20-
base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
16+
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
17+
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
18+
- platform: macos
19+
create_revision: fcf2c11572af6f390246c056bc905eca609533a0
20+
base_revision: fcf2c11572af6f390246c056bc905eca609533a0
2121

2222
# User provided section
2323

lib/common/platform.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ final class PlatformHelper {
3737
return io.Platform.isWindows;
3838
}
3939

40+
static bool isMacOSApp() {
41+
return !kIsWeb && io.Platform.isMacOS;
42+
}
43+
44+
static bool isMacOSWeb() {
45+
return kIsWeb && io.Platform.isMacOS;
46+
}
47+
48+
static bool isMacOS() {
49+
return io.Platform.isMacOS;
50+
}
51+
4052
static bool isWeb() {
4153
return kIsWeb;
4254
}
@@ -46,6 +58,8 @@ final class PlatformHelper {
4658
return SystemType.SYSTEM_TYPE_ANDROID;
4759
} else if (isWindows()) {
4860
return SystemType.SYSTEM_TYPE_WINDOWS;
61+
} else if (isMacOS()) {
62+
return SystemType.SYSTEM_TYPE_MACOS;
4963
} else if (isWeb()) {
5064
return SystemType.SYSTEM_TYPE_WEB;
5165
} else {

lib/route.dart

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class ImageViewerRoute extends GoRouteData with _$ImageViewerRoute {
200200
),
201201
],
202202
)
203-
class ModuleRoute extends StatefulShellRouteData {
203+
class ModuleRoute extends StatefulShellRouteData {
204204
const ModuleRoute();
205205

206206
@override
@@ -224,7 +224,7 @@ class ModuleRoute extends StatefulShellRouteData {
224224
}
225225
}
226226

227-
class TipherethRoute extends StatefulShellBranchData {
227+
class TipherethRoute extends StatefulShellBranchData {
228228
const TipherethRoute();
229229

230230
static final GlobalKey<NavigatorState> $navigatorKey = _tipherethNavigateKey;
@@ -243,7 +243,7 @@ class TipherethRootRoute extends GoRouteData with _$TipherethRootRoute {
243243
}
244244
}
245245

246-
class YesodRoute extends StatefulShellBranchData {
246+
class YesodRoute extends StatefulShellBranchData {
247247
const YesodRoute();
248248

249249
static final GlobalKey<NavigatorState> $navigatorKey = _yesodNavigateKey;
@@ -328,7 +328,7 @@ class YesodFunctionRoute extends GoRouteData with _$YesodFunctionRoute {
328328
}
329329
}
330330

331-
class GeburaRoute extends StatefulShellBranchData {
331+
class GeburaRoute extends StatefulShellBranchData {
332332
const GeburaRoute();
333333

334334
static final GlobalKey<NavigatorState> $navigatorKey = _geburaNavigateKey;
@@ -379,7 +379,8 @@ enum GeburaLibrarySettingsActions {
379379
appScanResult,
380380
}
381381

382-
class GeburaLibrarySettingsRoute extends GoRouteData with _$GeburaLibrarySettingsRoute {
382+
class GeburaLibrarySettingsRoute extends GoRouteData
383+
with _$GeburaLibrarySettingsRoute {
383384
const GeburaLibrarySettingsRoute({this.action, this.$extra});
384385

385386
final GeburaLibrarySettingsActions? action;
@@ -413,7 +414,8 @@ enum GeburaLibraryDetailActions {
413414
appInstLauncherEdit,
414415
}
415416

416-
class GeburaLibraryDetailRoute extends GoRouteData with _$GeburaLibraryDetailRoute {
417+
class GeburaLibraryDetailRoute extends GoRouteData
418+
with _$GeburaLibraryDetailRoute {
417419
const GeburaLibraryDetailRoute(this.uuid, {this.action, this.$extra});
418420

419421
final GeburaLibraryDetailActions? action;
@@ -463,7 +465,7 @@ class GeburaLibraryDetailRoute extends GoRouteData with _$GeburaLibraryDetailRou
463465
}
464466
}
465467

466-
class ChesedRoute extends StatefulShellBranchData {
468+
class ChesedRoute extends StatefulShellBranchData {
467469
const ChesedRoute();
468470

469471
static final GlobalKey<NavigatorState> $navigatorKey = _chesedNavigateKey;
@@ -483,7 +485,7 @@ class ChesedRootRoute extends GoRouteData with _$ChesedRootRoute {
483485
}
484486
}
485487

486-
class NotificationRoute extends StatefulShellBranchData {
488+
class NotificationRoute extends StatefulShellBranchData {
487489
const NotificationRoute();
488490

489491
static final GlobalKey<NavigatorState> $navigatorKey =
@@ -503,7 +505,7 @@ class NotificationRootRoute extends GoRouteData with _$NotificationRootRoute {
503505
}
504506
}
505507

506-
class SettingsRoute extends StatefulShellBranchData {
508+
class SettingsRoute extends StatefulShellBranchData {
507509
const SettingsRoute();
508510

509511
static final GlobalKey<NavigatorState> $navigatorKey = _settingsNavigateKey;

macos/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Flutter-related
2+
**/Flutter/ephemeral/
3+
**/Pods/
4+
5+
# Xcode-related
6+
**/dgph
7+
**/xcuserdata/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"

macos/Podfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
platform :osx, '10.14'
2+
3+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5+
6+
project 'Runner', {
7+
'Debug' => :debug,
8+
'Profile' => :release,
9+
'Release' => :release,
10+
}
11+
12+
def flutter_root
13+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14+
unless File.exist?(generated_xcode_build_settings_path)
15+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16+
end
17+
18+
File.foreach(generated_xcode_build_settings_path) do |line|
19+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
20+
return matches[1].strip if matches
21+
end
22+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23+
end
24+
25+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26+
27+
flutter_macos_podfile_setup
28+
29+
target 'Runner' do
30+
use_frameworks!
31+
32+
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
33+
target 'RunnerTests' do
34+
inherit! :search_paths
35+
end
36+
end
37+
38+
post_install do |installer|
39+
installer.pods_project.targets.each do |target|
40+
flutter_additional_macos_build_settings(target)
41+
end
42+
end

0 commit comments

Comments
 (0)