Add Linux and Windows target platforms (#51519)
This PR adds the linux and windows target platform enum values, along with automatically setting the defaultTargetPlatform to the appropriate value on those platforms. Fixes #31366
This commit is contained in:
@@ -83,10 +83,14 @@ class _MyHomePageState extends State<_MyHomePage> {
|
||||
return (await deviceInfo.androidInfo).model;
|
||||
case TargetPlatform.fuchsia:
|
||||
return 'fuchsia';
|
||||
default:
|
||||
case TargetPlatform.macOS:
|
||||
case TargetPlatform.linux:
|
||||
case TargetPlatform.windows:
|
||||
return 'unsupported';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
assert(false, 'Unhandled Theme target platform ${Theme.of(context).platform}.');
|
||||
return 'unsupported';
|
||||
}
|
||||
return 'unknown message: "$message"';
|
||||
}
|
||||
|
||||
@@ -2,24 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
// 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(),
|
||||
|
||||
@@ -2,9 +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';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AnimatedIconsTestApp extends StatelessWidget {
|
||||
@@ -108,16 +105,4 @@ class IconSample {
|
||||
final String description;
|
||||
}
|
||||
|
||||
// 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());
|
||||
}
|
||||
void main() => runApp(AnimatedIconsTestApp());
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/scheduler.dart' show timeDilation;
|
||||
@@ -24,19 +23,7 @@ final Map<int, Color> m2SwatchColors = <int, Color>{
|
||||
};
|
||||
final MaterialColor m2Swatch = MaterialColor(m2SwatchColors[500].value, m2SwatchColors);
|
||||
|
||||
// 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(MyApp());
|
||||
}
|
||||
void main() => runApp(MyApp());
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
static const String _title = 'Density Test';
|
||||
|
||||
@@ -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';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
@@ -296,17 +295,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
}
|
||||
}
|
||||
|
||||
// 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(),
|
||||
|
||||
@@ -2,24 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
// 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(),
|
||||
|
||||
@@ -2,23 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
// 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(),
|
||||
|
||||
@@ -2,22 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
// 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(
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
@@ -475,17 +474,7 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
|
||||
}
|
||||
}
|
||||
|
||||
// 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(),
|
||||
));
|
||||
|
||||
@@ -2,8 +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';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -206,17 +204,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
|
||||
}
|
||||
}
|
||||
|
||||
// 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,
|
||||
|
||||
@@ -2,8 +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';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -141,17 +139,7 @@ class PageViewAppState extends State<PageViewApp> {
|
||||
}
|
||||
}
|
||||
|
||||
// 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(
|
||||
|
||||
@@ -2,23 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
// 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(
|
||||
|
||||
@@ -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';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
@@ -12,17 +11,7 @@ import 'package:flutter/scheduler.dart';
|
||||
|
||||
int seed = 0;
|
||||
|
||||
// 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