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
0f68a2ba
Commit
0f68a2ba
authored
Jul 26, 2016
by
Adam Barth
Committed by
GitHub
Jul 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be more explicit about the default TargetPlatform (#5034)
parent
e4e6b01a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
platform.dart
packages/flutter/lib/src/foundation/platform.dart
+17
-0
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+1
-2
No files found.
packages/flutter/lib/src/foundation/platform.dart
View file @
0f68a2ba
...
...
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'assertions.dart'
;
/// The platform that user interaction should adapt to target.
enum
TargetPlatform
{
/// Android: <https://www.android.com/>
...
...
@@ -10,3 +14,16 @@ enum TargetPlatform {
/// iOS: <http://www.apple.com/ios/>
iOS
,
}
/// The [TargetPlatform] that matches the platform on which the framework is currently executing.
TargetPlatform
get
defaultTargetPlatform
{
if
(
Platform
.
isIOS
||
Platform
.
isMacOS
)
return
TargetPlatform
.
iOS
;
if
(
Platform
.
isAndroid
||
Platform
.
isLinux
)
return
TargetPlatform
.
android
;
throw
new
FlutterError
(
'Unknown platform
\n
'
'
${Platform.operatingSystem}
was not recognized as a target platform. '
'Consider updating the list of TargetPlatforms to include this platform.'
);
}
packages/flutter/lib/src/material/theme_data.dart
View file @
0f68a2ba
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'dart:ui'
show
Color
,
hashValues
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -125,7 +124,7 @@ class ThemeData {
primaryTextTheme
??=
primaryIsDark
?
Typography
.
white
:
Typography
.
black
;
iconTheme
??=
isDark
?
const
IconThemeData
(
color:
Colors
.
white
)
:
const
IconThemeData
(
color:
Colors
.
black
);
primaryIconTheme
??=
primaryIsDark
?
const
IconThemeData
(
color:
Colors
.
white
)
:
const
IconThemeData
(
color:
Colors
.
black
);
platform
??=
(
Platform
.
isIOS
||
Platform
.
isMacOS
)
?
TargetPlatform
.
iOS
:
TargetPlatform
.
android
;
platform
??=
defaultTargetPlatform
;
return
new
ThemeData
.
raw
(
brightness:
brightness
,
primaryColor:
primaryColor
,
...
...
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