Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
96b49aae
Unverified
Commit
96b49aae
authored
Sep 14, 2022
by
Alex Wallen
Committed by
GitHub
Sep 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[macOS] Add `flutter_view` example. (#111326)
parent
5f9ad01e
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1467 additions
and
0 deletions
+1467
-0
.ci.yaml
.ci.yaml
+10
-0
TESTOWNERS
TESTOWNERS
+3
-0
flutter_view_macos__start_up.dart
dev/devicelab/bin/tasks/flutter_view_macos__start_up.dart
+12
-0
Flutter-Debug.xcconfig
examples/flutter_view/macos/Flutter/Flutter-Debug.xcconfig
+1
-0
Flutter-Release.xcconfig
examples/flutter_view/macos/Flutter/Flutter-Release.xcconfig
+1
-0
Main.storyboard
examples/flutter_view/macos/Main.storyboard
+161
-0
project.pbxproj
examples/flutter_view/macos/Runner.xcodeproj/project.pbxproj
+585
-0
IDEWorkspaceChecks.plist
...project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+8
-0
Runner.xcscheme
...s/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+87
-0
contents.xcworkspacedata
...er_view/macos/Runner.xcworkspace/contents.xcworkspacedata
+7
-0
IDEWorkspaceChecks.plist
.../Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+8
-0
AppDelegate.swift
examples/flutter_view/macos/Runner/AppDelegate.swift
+13
-0
MainMenu.xib
examples/flutter_view/macos/Runner/Base.lproj/MainMenu.xib
+344
-0
AppInfo.xcconfig
examples/flutter_view/macos/Runner/Configs/AppInfo.xcconfig
+14
-0
Debug.xcconfig
examples/flutter_view/macos/Runner/Configs/Debug.xcconfig
+2
-0
Release.xcconfig
examples/flutter_view/macos/Runner/Configs/Release.xcconfig
+2
-0
Warnings.xcconfig
examples/flutter_view/macos/Runner/Configs/Warnings.xcconfig
+13
-0
DebugProfile.entitlements
examples/flutter_view/macos/Runner/DebugProfile.entitlements
+12
-0
Info.plist
examples/flutter_view/macos/Runner/Info.plist
+32
-0
MainFlutterWindow.swift
examples/flutter_view/macos/Runner/MainFlutterWindow.swift
+25
-0
MainViewController.swift
examples/flutter_view/macos/Runner/MainViewController.swift
+69
-0
NativeViewController.swift
...ples/flutter_view/macos/Runner/NativeViewController.swift
+50
-0
Release.entitlements
examples/flutter_view/macos/Runner/Release.entitlements
+8
-0
No files found.
.ci.yaml
View file @
96b49aae
...
@@ -2502,6 +2502,16 @@ targets:
...
@@ -2502,6 +2502,16 @@ targets:
["devicelab", "hostonly"]
["devicelab", "hostonly"]
task_name: flutter_gallery_macos__start_up
task_name: flutter_gallery_macos__start_up
-
name
:
Mac flutter_view_macos__start_up
bringup
:
true
# New target https://github.com/flutter/flutter/issues/109633
presubmit
:
false
recipe
:
devicelab/devicelab_drone
timeout
:
60
properties
:
tags
:
>
["devicelab", "hostonly"]
task_name
:
flutter_view_macos__start_up
-
name
:
Mac framework_tests_libraries
-
name
:
Mac framework_tests_libraries
recipe
:
flutter/flutter_drone
recipe
:
flutter/flutter_drone
timeout
:
60
timeout
:
60
...
...
TESTOWNERS
View file @
96b49aae
...
@@ -249,6 +249,9 @@
...
@@ -249,6 +249,9 @@
/dev/devicelab/bin/tasks/web_benchmarks_html.dart @yjbanov @flutter/web
/dev/devicelab/bin/tasks/web_benchmarks_html.dart @yjbanov @flutter/web
/dev/devicelab/bin/tasks/windows_home_scroll_perf__timeline_summary.dart @jonahwilliams @flutter/engine
/dev/devicelab/bin/tasks/windows_home_scroll_perf__timeline_summary.dart @jonahwilliams @flutter/engine
/dev/devicelab/bin/tasks/windows_startup_test.dart @loic-sharma @flutter/desktop
/dev/devicelab/bin/tasks/windows_startup_test.dart @loic-sharma @flutter/desktop
/dev/devicelab/bin/tasks/complex_layout_macos__compile.dart @a-wallen @flutter/desktop
/dev/devicelab/bin/tasks/flutter_gallery_macos__compile.dart @a-wallen @flutter/desktop
/dev/devicelab/bin/tasks/flutter_view_macos__start_up.dart @a-wallen @flutter/desktop
## Host only framework tests
## Host only framework tests
# Linux analyze
# Linux analyze
...
...
dev/devicelab/bin/tasks/flutter_view_macos__start_up.dart
0 → 100644
View file @
96b49aae
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_devicelab/framework/devices.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/tasks/perf_tests.dart'
;
Future
<
void
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
macos
;
await
task
(
createFlutterViewStartupTest
());
}
examples/flutter_view/macos/Flutter/Flutter-Debug.xcconfig
0 → 100644
View file @
96b49aae
#include "ephemeral/Flutter-Generated.xcconfig"
examples/flutter_view/macos/Flutter/Flutter-Release.xcconfig
0 → 100644
View file @
96b49aae
#include "ephemeral/Flutter-Generated.xcconfig"
examples/flutter_view/macos/Main.storyboard
0 → 100644
View file @
96b49aae
This diff is collapsed.
Click to expand it.
examples/flutter_view/macos/Runner.xcodeproj/project.pbxproj
0 → 100644
View file @
96b49aae
This diff is collapsed.
Click to expand it.
examples/flutter_view/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
0 → 100644
View file @
96b49aae
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
IDEDidComputeMac32BitWarning
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
/plist
>
examples/flutter_view/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
0 → 100644
View file @
96b49aae
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"1300"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
buildImplicitDependencies =
"YES"
>
<BuildActionEntries>
<BuildActionEntry
buildForTesting =
"YES"
buildForRunning =
"YES"
buildForProfiling =
"YES"
buildForArchiving =
"YES"
buildForAnalyzing =
"YES"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"33CC10EC2044A3C60003C045"
BuildableName =
"flutter_view.app"
BlueprintName =
"Runner"
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration =
"Debug"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv =
"YES"
>
<MacroExpansion>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"33CC10EC2044A3C60003C045"
BuildableName =
"flutter_view.app"
BlueprintName =
"Runner"
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration =
"Debug"
selectedDebuggerIdentifier =
"Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier =
"Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle =
"0"
useCustomWorkingDirectory =
"NO"
ignoresPersistentStateOnLaunch =
"NO"
debugDocumentVersioning =
"YES"
debugServiceExtension =
"internal"
allowLocationSimulation =
"YES"
>
<BuildableProductRunnable
runnableDebuggingMode =
"0"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"33CC10EC2044A3C60003C045"
BuildableName =
"flutter_view.app"
BlueprintName =
"Runner"
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration =
"Profile"
shouldUseLaunchSchemeArgsEnv =
"YES"
savedToolIdentifier =
""
useCustomWorkingDirectory =
"NO"
debugDocumentVersioning =
"YES"
>
<BuildableProductRunnable
runnableDebuggingMode =
"0"
>
<BuildableReference
BuildableIdentifier =
"primary"
BlueprintIdentifier =
"33CC10EC2044A3C60003C045"
BuildableName =
"flutter_view.app"
BlueprintName =
"Runner"
ReferencedContainer =
"container:Runner.xcodeproj"
>
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration =
"Debug"
>
</AnalyzeAction>
<ArchiveAction
buildConfiguration =
"Release"
revealArchiveInOrganizer =
"YES"
>
</ArchiveAction>
</Scheme>
examples/flutter_view/macos/Runner.xcworkspace/contents.xcworkspacedata
0 → 100644
View file @
96b49aae
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version =
"1.0"
>
<FileRef
location =
"group:Runner.xcodeproj"
>
</FileRef>
</Workspace>
examples/flutter_view/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
0 → 100644
View file @
96b49aae
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
IDEDidComputeMac32BitWarning
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
/plist
>
examples/flutter_view/macos/Runner/AppDelegate.swift
0 → 100644
View file @
96b49aae
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
Cocoa
import
FlutterMacOS
@NSApplicationMain
class
AppDelegate
:
FlutterAppDelegate
{
override
func
applicationShouldTerminateAfterLastWindowClosed
(
_
sender
:
NSApplication
)
->
Bool
{
return
true
}
}
examples/flutter_view/macos/Runner/Base.lproj/MainMenu.xib
0 → 100644
View file @
96b49aae
This diff is collapsed.
Click to expand it.
examples/flutter_view/macos/Runner/Configs/AppInfo.xcconfig
0 → 100644
View file @
96b49aae
// Application-level settings for the Runner target.
//
// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
// future. If not, the values below would default to using the project name when this becomes a
// 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = flutter_view
// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = io.flutter.examples.flutterView
// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2022 io.flutter.examples. All rights reserved.
examples/flutter_view/macos/Runner/Configs/Debug.xcconfig
0 → 100644
View file @
96b49aae
#include "../../Flutter/Flutter-Debug.xcconfig"
#include "Warnings.xcconfig"
examples/flutter_view/macos/Runner/Configs/Release.xcconfig
0 → 100644
View file @
96b49aae
#include "../../Flutter/Flutter-Release.xcconfig"
#include "Warnings.xcconfig"
examples/flutter_view/macos/Runner/Configs/Warnings.xcconfig
0 → 100644
View file @
96b49aae
WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
CLANG_WARN_PRAGMA_PACK = YES
CLANG_WARN_STRICT_PROTOTYPES = YES
CLANG_WARN_COMMA = YES
GCC_WARN_STRICT_SELECTOR_MATCH = YES
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
GCC_WARN_SHADOW = YES
CLANG_WARN_UNREACHABLE_CODE = YES
examples/flutter_view/macos/Runner/DebugProfile.entitlements
0 → 100644
View file @
96b49aae
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
com.apple.security.app-sandbox
</key>
<true/>
<key>
com.apple.security.cs.allow-jit
</key>
<true/>
<key>
com.apple.security.network.server
</key>
<true/>
</dict>
</plist>
examples/flutter_view/macos/Runner/Info.plist
0 → 100644
View file @
96b49aae
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
$
(
DEVELOPMENT_LANGUAGE
)<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
$
(
EXECUTABLE_NAME
)<
/string
>
<
k
e
y
>
CFBundleIconFile
<
/k
e
y
>
<
string
><
/string
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
<
string
>
$
(
PRODUCT_BUNDLE_IDENTIFIER
)<
/string
>
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
string
>
6.0
<
/string
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
$
(
PRODUCT_NAME
)<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
$
(
FLUTTER_BUILD_NAME
)<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
$
(
FLUTTER_BUILD_NUMBER
)<
/string
>
<
k
e
y
>
LSMinimumSystemVersion
<
/k
e
y
>
<
string
>
$
(
MACOSX_DEPLOYMENT_TARGET
)<
/string
>
<
k
e
y
>
NSHumanReadableCopyright
<
/k
e
y
>
<
string
>
$
(
PRODUCT_COPYRIGHT
)<
/string
>
<
k
e
y
>
NSMainNibFile
<
/k
e
y
>
<
string
>
MainMenu
<
/string
>
<
k
e
y
>
NSPrincipalClass
<
/k
e
y
>
<
string
>
NSApplication
<
/string
>
<
/
d
i
c
t
>
<
/plist
>
examples/flutter_view/macos/Runner/MainFlutterWindow.swift
0 → 100644
View file @
96b49aae
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
Cocoa
import
FlutterMacOS
/**
The window that is automatically generated when `flutter create --target=macos`
on a project. `MainFlutterWindow` uses a FlutterViewController as it's content
view controller by default.
*/
class
MainFlutterWindow
:
NSWindow
{
override
func
awakeFromNib
()
{
let
windowFrame
=
self
.
frame
let
storyboard
=
NSStoryboard
(
name
:
NSStoryboard
.
Name
(
"Main"
),
bundle
:
Bundle
.
main
)
// `flutter create --target=macos` uses this class (`self`) as an entrypoint
// for drawing on a surface. The line below intercepts that and uses
// the storyboard from `Main.storyboard`.
self
.
contentViewController
=
storyboard
.
instantiateController
(
withIdentifier
:
"MainViewController"
)
as!
NSViewController
self
.
setFrame
(
windowFrame
,
display
:
true
)
super
.
awakeFromNib
()
}
}
examples/flutter_view/macos/Runner/MainViewController.swift
0 → 100644
View file @
96b49aae
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
Foundation
import
AppKit
import
FlutterMacOS
/**
The code behind a storyboard view which splits a flutter view and a macOS view.
*/
class
MainViewController
:
NSViewController
,
NativeViewControllerDelegate
{
static
let
emptyString
:
String
=
""
static
let
ping
:
String
=
"ping"
static
let
channel
:
String
=
"increment"
var
nativeViewController
:
NativeViewController
?
var
flutterViewController
:
FlutterViewController
?
var
messageChannel
:
FlutterBasicMessageChannel
?
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
}
override
func
prepare
(
for
segue
:
NSStoryboardSegue
,
sender
:
Any
?)
{
if
segue
.
identifier
==
"NativeViewControllerSegue"
{
self
.
nativeViewController
=
segue
.
destinationController
as?
NativeViewController
// Since`MainViewController` owns the platform channel, but not the
// UI elements that trigger an action, those UI elements need a reference
// to this controller to send messages on the platform channel.
self
.
nativeViewController
?
.
delegate
=
self
}
if
segue
.
identifier
==
"FlutterViewControllerSegue"
{
self
.
flutterViewController
=
segue
.
destinationController
as?
FlutterViewController
RegisterMethodChannel
(
registry
:
self
.
flutterViewController
!
)
weak
var
weakSelf
=
self
messageChannel
?
.
setMessageHandler
({
(
message
,
reply
)
in
// Dispatch an event, incrementing the counter in this case, when *any*
// message is received.
// Depending on the order of initialization, the nativeViewController
// might not be initialized until this point.
weakSelf
?
.
nativeViewController
?
.
didReceiveIncrement
()
reply
(
MainViewController
.
emptyString
)
})
}
}
func
RegisterMethodChannel
(
registry
:
FlutterPluginRegistry
)
{
let
registrar
=
registry
.
registrar
(
forPlugin
:
""
)
messageChannel
=
FlutterBasicMessageChannel
(
name
:
MainViewController
.
channel
,
binaryMessenger
:
registrar
.
messenger
,
codec
:
FlutterStringCodec
.
sharedInstance
())
}
// Call in any instance where `ping` is to be sent through the `increment`
// channel.
func
didTapIncrementButton
()
{
self
.
messageChannel
?
.
sendMessage
(
MainViewController
.
ping
)
}
}
examples/flutter_view/macos/Runner/NativeViewController.swift
0 → 100644
View file @
96b49aae
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
Foundation
import
AppKit
protocol
NativeViewControllerDelegate
:
NSObjectProtocol
{
func
didTapIncrementButton
()
}
/**
The code behind a native view to be displayed in the `MainFlutterViewController`
as an embed segue. If any storyboard view inherits from this class definition,
it should contain a function to handle for `handleIncrement`
*/
class
NativeViewController
:
NSViewController
{
var
count
:
Int
?
var
labelText
:
String
{
get
{
let
count
=
self
.
count
??
0
return
"Flutter button tapped
\(
count
)
time
\(
count
==
1
?
""
:
"s"
)
"
}
}
var
delegate
:
NativeViewControllerDelegate
?
@IBOutlet
weak
var
incrementLabel
:
NSTextField
!
@IBAction
func
handleIncrement
(
_
sender
:
Any
)
{
self
.
delegate
?
.
didTapIncrementButton
()
}
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setState
(
for
:
0
)
}
func
didReceiveIncrement
()
{
setState
(
for
:
(
self
.
count
??
0
)
+
1
)
}
func
setState
(
for
count
:
Int
)
{
self
.
count
=
count
self
.
incrementLabel
.
stringValue
=
labelText
}
}
examples/flutter_view/macos/Runner/Release.entitlements
0 → 100644
View file @
96b49aae
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
com.apple.security.app-sandbox
</key>
<true/>
</dict>
</plist>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment