Add macOS to TargetPlatform (#43457)
This PR adds TargetPlatform.macOS to the TargetPlatform enum. This allows us to begin implementation of some adaptive UI based on which target platform is desired. I haven't updated the tests here, that will come in a follow-up PR.
This commit is contained in:
@@ -8,13 +8,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(const MaterialApp(
|
||||
title: 'Actions Demo',
|
||||
home: FocusDemo(),
|
||||
|
||||
@@ -108,11 +108,16 @@ class IconSample {
|
||||
final String description;
|
||||
}
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(AnimatedIconsTestApp());
|
||||
}
|
||||
|
||||
@@ -296,13 +296,17 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(MaterialApp(
|
||||
title: 'Drag and Drop Flutter Demo',
|
||||
home: DragAndDropApp(),
|
||||
|
||||
@@ -8,13 +8,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(const MaterialApp(
|
||||
title: 'Focus Demo',
|
||||
home: FocusDemo(),
|
||||
|
||||
@@ -8,13 +8,17 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(const MaterialApp(
|
||||
title: 'Hover Demo',
|
||||
home: HoverDemo(),
|
||||
|
||||
@@ -7,13 +7,17 @@ import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Center(
|
||||
|
||||
@@ -475,13 +475,17 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(const MaterialApp(
|
||||
home: AnimationDemo(),
|
||||
));
|
||||
|
||||
@@ -206,13 +206,17 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(MaterialApp(
|
||||
theme: ThemeData(
|
||||
brightness: Brightness.light,
|
||||
|
||||
@@ -141,12 +141,17 @@ class PageViewAppState extends State<PageViewApp> {
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(MaterialApp(
|
||||
title: 'PageView',
|
||||
theme: ThemeData(
|
||||
|
||||
@@ -8,13 +8,17 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(MaterialApp(
|
||||
title: 'Hardware Key Demo',
|
||||
home: Scaffold(
|
||||
|
||||
@@ -12,13 +12,17 @@ import 'package:flutter/scheduler.dart';
|
||||
|
||||
int seed = 0;
|
||||
|
||||
void main() {
|
||||
if (!kIsWeb && Platform.isMacOS) {
|
||||
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366
|
||||
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override
|
||||
// Sets a platform override for desktop to avoid exceptions. See
|
||||
// https://flutter.dev/desktop#target-platform-override for more info.
|
||||
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
||||
void _enablePlatformOverrideForDesktop() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
_enablePlatformOverrideForDesktop();
|
||||
runApp(MaterialApp(
|
||||
title: 'Text tester',
|
||||
home: const Home(),
|
||||
|
||||
Reference in New Issue
Block a user