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
92df6f50
Unverified
Commit
92df6f50
authored
May 01, 2020
by
Ferhat
Committed by
GitHub
May 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check for iOS/MacOS for target platform (#56081)
parent
d6cbf259
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
_platform_web.dart
packages/flutter/lib/src/foundation/_platform_web.dart
+15
-1
No files found.
packages/flutter/lib/src/foundation/_platform_web.dart
View file @
92df6f50
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:html'
as
html
;
import
'platform.dart'
as
platform
;
/// The dart:html implementation of [platform.defaultTargetPlatform].
...
...
@@ -9,8 +10,21 @@ platform.TargetPlatform get defaultTargetPlatform {
// To getter a better guess at the targetPlatform we need to be able to
// reference the window, but that won't be availible until we fix the
// platforms configuration for Flutter.
platform
.
TargetPlatform
result
=
platform
.
TargetPlatform
.
android
;
platform
.
TargetPlatform
result
=
_browserPlatform
()
;
if
(
platform
.
debugDefaultTargetPlatformOverride
!=
null
)
result
=
platform
.
debugDefaultTargetPlatformOverride
;
return
result
;
}
platform
.
TargetPlatform
_browserPlatform
(
)
{
final
String
navigatorPlatform
=
html
.
window
.
navigator
.
platform
.
toLowerCase
();
if
(
navigatorPlatform
.
startsWith
(
'mac'
))
{
return
platform
.
TargetPlatform
.
macOS
;
}
if
(
navigatorPlatform
.
contains
(
'iphone'
)
||
navigatorPlatform
.
contains
(
'ipad'
)
||
navigatorPlatform
.
contains
(
'ipod'
))
{
return
platform
.
TargetPlatform
.
iOS
;
}
return
platform
.
TargetPlatform
.
android
;
}
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