mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Recognize Fuchsia as a target platform (#5451)
Currently, we just treat Fuchsia as TargetPlatform.android, but we might want to do something more sophisticated in the future.
This commit is contained in:
parent
a60fefc131
commit
a4ea12c470
@ -11,6 +11,9 @@ enum TargetPlatform {
|
|||||||
/// Android: <https://www.android.com/>
|
/// Android: <https://www.android.com/>
|
||||||
android,
|
android,
|
||||||
|
|
||||||
|
/// Fuchsia: <https://fuchsia.googlesource.com/>
|
||||||
|
fuchsia,
|
||||||
|
|
||||||
/// iOS: <http://www.apple.com/ios/>
|
/// iOS: <http://www.apple.com/ios/>
|
||||||
iOS,
|
iOS,
|
||||||
}
|
}
|
||||||
@ -30,6 +33,8 @@ TargetPlatform get defaultTargetPlatform {
|
|||||||
result = TargetPlatform.iOS;
|
result = TargetPlatform.iOS;
|
||||||
} else if (Platform.isAndroid || Platform.isLinux) {
|
} else if (Platform.isAndroid || Platform.isLinux) {
|
||||||
result = TargetPlatform.android;
|
result = TargetPlatform.android;
|
||||||
|
} else if (Platform.operatingSystem == "fuchsia") {
|
||||||
|
result = TargetPlatform.fuchsia;
|
||||||
}
|
}
|
||||||
assert(() {
|
assert(() {
|
||||||
if (Platform.environment.containsKey('FLUTTER_TEST'))
|
if (Platform.environment.containsKey('FLUTTER_TEST'))
|
||||||
|
@ -157,10 +157,10 @@ class _ScrollLikeCupertinoDelegate extends ScrollConfigurationDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ScrollLikeMountainViewDelegate extends ScrollConfigurationDelegate {
|
class _ScrollLikeMountainViewDelegate extends ScrollConfigurationDelegate {
|
||||||
const _ScrollLikeMountainViewDelegate();
|
const _ScrollLikeMountainViewDelegate(this.platform);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TargetPlatform get platform => TargetPlatform.android;
|
final TargetPlatform platform;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ExtentScrollBehavior createScrollBehavior() => new OverscrollWhenScrollableBehavior(platform: TargetPlatform.android);
|
ExtentScrollBehavior createScrollBehavior() => new OverscrollWhenScrollableBehavior(platform: TargetPlatform.android);
|
||||||
@ -203,7 +203,9 @@ class _MaterialAppState extends State<MaterialApp> {
|
|||||||
ScrollConfigurationDelegate _getScrollDelegate(TargetPlatform platform) {
|
ScrollConfigurationDelegate _getScrollDelegate(TargetPlatform platform) {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case TargetPlatform.android:
|
case TargetPlatform.android:
|
||||||
return const _ScrollLikeMountainViewDelegate();
|
return const _ScrollLikeMountainViewDelegate(TargetPlatform.android);
|
||||||
|
case TargetPlatform.fuchsia:
|
||||||
|
return const _ScrollLikeMountainViewDelegate(TargetPlatform.fuchsia);
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
return const _ScrollLikeCupertinoDelegate();
|
return const _ScrollLikeCupertinoDelegate();
|
||||||
}
|
}
|
||||||
|
@ -254,6 +254,7 @@ class AppBar extends StatelessWidget {
|
|||||||
assert(themeData.platform != null);
|
assert(themeData.platform != null);
|
||||||
switch (themeData.platform) {
|
switch (themeData.platform) {
|
||||||
case TargetPlatform.android:
|
case TargetPlatform.android:
|
||||||
|
case TargetPlatform.fuchsia:
|
||||||
return false;
|
return false;
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
return true;
|
return true;
|
||||||
|
@ -64,6 +64,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
|
|||||||
assert(theme.platform != null);
|
assert(theme.platform != null);
|
||||||
switch (theme.platform) {
|
switch (theme.platform) {
|
||||||
case TargetPlatform.android:
|
case TargetPlatform.android:
|
||||||
|
case TargetPlatform.fuchsia:
|
||||||
return false;
|
return false;
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
return true;
|
return true;
|
||||||
|
@ -75,6 +75,7 @@ abstract class ScrollBehavior<T, U> {
|
|||||||
assert(platform != null);
|
assert(platform != null);
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case TargetPlatform.android:
|
case TargetPlatform.android:
|
||||||
|
case TargetPlatform.fuchsia:
|
||||||
return _kScrollDragMountainView;
|
return _kScrollDragMountainView;
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
return _kScrollDragCupertino;
|
return _kScrollDragCupertino;
|
||||||
|
Loading…
Reference in New Issue
Block a user