Unverified Commit 245d1b51 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

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.
parent e60c0f68
...@@ -8,13 +8,17 @@ import 'package:flutter/material.dart'; ...@@ -8,13 +8,17 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(const MaterialApp( runApp(const MaterialApp(
title: 'Actions Demo', title: 'Actions Demo',
home: FocusDemo(), home: FocusDemo(),
......
...@@ -108,11 +108,16 @@ class IconSample { ...@@ -108,11 +108,16 @@ class IconSample {
final String description; final String description;
} }
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(AnimatedIconsTestApp()); runApp(AnimatedIconsTestApp());
} }
...@@ -296,13 +296,17 @@ class DragAndDropAppState extends State<DragAndDropApp> { ...@@ -296,13 +296,17 @@ class DragAndDropAppState extends State<DragAndDropApp> {
} }
} }
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(MaterialApp( runApp(MaterialApp(
title: 'Drag and Drop Flutter Demo', title: 'Drag and Drop Flutter Demo',
home: DragAndDropApp(), home: DragAndDropApp(),
......
...@@ -8,13 +8,17 @@ import 'package:flutter/material.dart'; ...@@ -8,13 +8,17 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(const MaterialApp( runApp(const MaterialApp(
title: 'Focus Demo', title: 'Focus Demo',
home: FocusDemo(), home: FocusDemo(),
......
...@@ -8,13 +8,17 @@ import 'package:flutter/foundation.dart'; ...@@ -8,13 +8,17 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(const MaterialApp( runApp(const MaterialApp(
title: 'Hover Demo', title: 'Hover Demo',
home: HoverDemo(), home: HoverDemo(),
......
...@@ -7,13 +7,17 @@ import 'dart:io'; ...@@ -7,13 +7,17 @@ import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(const Directionality( runApp(const Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Center( child: Center(
......
...@@ -475,13 +475,17 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM ...@@ -475,13 +475,17 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
} }
} }
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(const MaterialApp( runApp(const MaterialApp(
home: AnimationDemo(), home: AnimationDemo(),
)); ));
......
...@@ -206,13 +206,17 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -206,13 +206,17 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
} }
} }
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(MaterialApp( runApp(MaterialApp(
theme: ThemeData( theme: ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
......
...@@ -141,12 +141,17 @@ class PageViewAppState extends State<PageViewApp> { ...@@ -141,12 +141,17 @@ class PageViewAppState extends State<PageViewApp> {
} }
} }
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(MaterialApp( runApp(MaterialApp(
title: 'PageView', title: 'PageView',
theme: ThemeData( theme: ThemeData(
......
...@@ -8,13 +8,17 @@ import 'package:flutter/foundation.dart'; ...@@ -8,13 +8,17 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(MaterialApp( runApp(MaterialApp(
title: 'Hardware Key Demo', title: 'Hardware Key Demo',
home: Scaffold( home: Scaffold(
......
...@@ -12,13 +12,17 @@ import 'package:flutter/scheduler.dart'; ...@@ -12,13 +12,17 @@ import 'package:flutter/scheduler.dart';
int seed = 0; int seed = 0;
void main() { // Sets a platform override for desktop to avoid exceptions. See
if (!kIsWeb && Platform.isMacOS) { // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Update this when TargetPlatform includes macOS. https://github.com/flutter/flutter/issues/31366 // TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
}
void main() {
_enablePlatformOverrideForDesktop();
runApp(MaterialApp( runApp(MaterialApp(
title: 'Text tester', title: 'Text tester',
home: const Home(), home: const Home(),
......
...@@ -64,6 +64,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin { ...@@ -64,6 +64,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
return Icons.arrow_back; return Icons.arrow_back;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return Icons.arrow_back_ios; return Icons.arrow_back_ios;
} }
assert(false); assert(false);
......
...@@ -360,6 +360,8 @@ class _PlatformItem extends StatelessWidget { ...@@ -360,6 +360,8 @@ class _PlatformItem extends StatelessWidget {
return 'Fuchsia'; return 'Fuchsia';
case TargetPlatform.iOS: case TargetPlatform.iOS:
return 'Cupertino'; return 'Cupertino';
case TargetPlatform.macOS:
return 'Material Desktop (macOS)';
} }
assert(false); assert(false);
return null; return null;
......
...@@ -14,8 +14,12 @@ import 'gallery/app.dart'; ...@@ -14,8 +14,12 @@ import 'gallery/app.dart';
// Sets a platform override for desktop to avoid exceptions. See // Sets a platform override for desktop to avoid exceptions. See
// https://flutter.dev/desktop#target-platform-override for more info. // https://flutter.dev/desktop#target-platform-override for more info.
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
// This is only included in the Gallery because Flutter's testing infrastructure
// uses the Gallery for various tests, and this allows us to test on desktop
// platforms that aren't yet supported in TargetPlatform.
void _enablePlatformOverrideForDesktop() { void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux)) { if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
} }
......
...@@ -230,6 +230,7 @@ class _CupertinoPickerState extends State<CupertinoPicker> { ...@@ -230,6 +230,7 @@ class _CupertinoPickerState extends State<CupertinoPicker> {
break; break;
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.macOS:
hasSuitableHapticHardware = false; hasSuitableHapticHardware = false;
break; break;
} }
......
...@@ -445,8 +445,9 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox { ...@@ -445,8 +445,9 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox {
case TargetPlatform.iOS: case TargetPlatform.iOS:
HapticFeedback.lightImpact(); HapticFeedback.lightImpact();
break; break;
case TargetPlatform.fuchsia:
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.macOS:
break; break;
} }
} }
......
...@@ -11,6 +11,8 @@ platform.TargetPlatform get defaultTargetPlatform { ...@@ -11,6 +11,8 @@ platform.TargetPlatform get defaultTargetPlatform {
platform.TargetPlatform result; platform.TargetPlatform result;
if (Platform.isIOS) { if (Platform.isIOS) {
result = platform.TargetPlatform.iOS; result = platform.TargetPlatform.iOS;
} else if (Platform.isMacOS) {
result = platform.TargetPlatform.macOS;
} else if (Platform.isAndroid) { } else if (Platform.isAndroid) {
result = platform.TargetPlatform.android; result = platform.TargetPlatform.android;
} else if (Platform.isFuchsia) { } else if (Platform.isFuchsia) {
......
...@@ -163,6 +163,9 @@ abstract class BindingBase { ...@@ -163,6 +163,9 @@ abstract class BindingBase {
case 'iOS': case 'iOS':
debugDefaultTargetPlatformOverride = TargetPlatform.iOS; debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
break; break;
case 'macOS':
debugDefaultTargetPlatformOverride = TargetPlatform.macOS;
break;
case 'fuchsia': case 'fuchsia':
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
break; break;
......
...@@ -47,6 +47,9 @@ enum TargetPlatform { ...@@ -47,6 +47,9 @@ enum TargetPlatform {
/// iOS: <http://www.apple.com/ios/> /// iOS: <http://www.apple.com/ios/>
iOS, iOS,
/// macOS: <http://www.apple.com/macos>
macOS,
} }
/// Override the [defaultTargetPlatform]. /// Override the [defaultTargetPlatform].
......
...@@ -481,6 +481,7 @@ class _MaterialScrollBehavior extends ScrollBehavior { ...@@ -481,6 +481,7 @@ class _MaterialScrollBehavior extends ScrollBehavior {
// the base class as well. // the base class as well.
switch (getPlatform(context)) { switch (getPlatform(context)) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return child; return child;
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
......
...@@ -393,6 +393,7 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget { ...@@ -393,6 +393,7 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
return false; return false;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return actions == null || actions.length < 2; return actions == null || actions.length < 2;
} }
return null; return null;
...@@ -483,6 +484,7 @@ class _AppBarState extends State<AppBar> { ...@@ -483,6 +484,7 @@ class _AppBarState extends State<AppBar> {
namesRoute = true; namesRoute = true;
break; break;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
break; break;
} }
title = DefaultTextStyle( title = DefaultTextStyle(
......
...@@ -34,6 +34,7 @@ class BackButtonIcon extends StatelessWidget { ...@@ -34,6 +34,7 @@ class BackButtonIcon extends StatelessWidget {
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
return Icons.arrow_back; return Icons.arrow_back;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return Icons.arrow_back_ios; return Icons.arrow_back_ios;
} }
assert(false); assert(false);
......
...@@ -283,6 +283,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { ...@@ -283,6 +283,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
String _getRouteLabel(MaterialLocalizations localizations) { String _getRouteLabel(MaterialLocalizations localizations) {
switch (Theme.of(context).platform) { switch (Theme.of(context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return ''; return '';
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
......
...@@ -911,6 +911,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> { ...@@ -911,6 +911,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
HapticFeedback.vibrate(); HapticFeedback.vibrate();
break; break;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
break; break;
} }
} }
......
...@@ -314,6 +314,7 @@ class AlertDialog extends StatelessWidget { ...@@ -314,6 +314,7 @@ class AlertDialog extends StatelessWidget {
if (title == null) { if (title == null) {
switch (theme.platform) { switch (theme.platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
label = semanticLabel; label = semanticLabel;
break; break;
case TargetPlatform.android: case TargetPlatform.android:
...@@ -591,6 +592,7 @@ class SimpleDialog extends StatelessWidget { ...@@ -591,6 +592,7 @@ class SimpleDialog extends StatelessWidget {
String label = semanticLabel; String label = semanticLabel;
if (title == null) { if (title == null) {
switch (theme.platform) { switch (theme.platform) {
case TargetPlatform.macOS:
case TargetPlatform.iOS: case TargetPlatform.iOS:
label = semanticLabel; label = semanticLabel;
break; break;
......
...@@ -177,6 +177,7 @@ class Drawer extends StatelessWidget { ...@@ -177,6 +177,7 @@ class Drawer extends StatelessWidget {
String label = semanticLabel; String label = semanticLabel;
switch (Theme.of(context).platform) { switch (Theme.of(context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
label = semanticLabel; label = semanticLabel;
break; break;
case TargetPlatform.android: case TargetPlatform.android:
...@@ -523,6 +524,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro ...@@ -523,6 +524,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
platformHasBackButton = true; platformHasBackButton = true;
break; break;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
platformHasBackButton = false; platformHasBackButton = false;
break; break;
......
...@@ -166,7 +166,7 @@ class FlexibleSpaceBar extends StatefulWidget { ...@@ -166,7 +166,7 @@ class FlexibleSpaceBar extends StatefulWidget {
/// Whether the title should be centered. /// Whether the title should be centered.
/// ///
/// By default this property is true if the current target platform /// By default this property is true if the current target platform
/// is [TargetPlatform.iOS], false otherwise. /// is [TargetPlatform.iOS] or [TargetPlatform.macOS], false otherwise.
final bool centerTitle; final bool centerTitle;
/// Collapse effect while scrolling. /// Collapse effect while scrolling.
...@@ -239,6 +239,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -239,6 +239,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
return false; return false;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return true; return true;
} }
return null; return null;
...@@ -341,6 +342,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -341,6 +342,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
Widget title; Widget title;
switch (theme.platform) { switch (theme.platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
title = widget.title; title = widget.title;
break; break;
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
...@@ -349,6 +351,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> { ...@@ -349,6 +351,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
namesRoute: true, namesRoute: true,
child: widget.title, child: widget.title,
); );
break;
} }
// StretchMode.fadeTitle // StretchMode.fadeTitle
......
...@@ -486,14 +486,15 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder { ...@@ -486,14 +486,15 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder {
class PageTransitionsTheme extends Diagnosticable { class PageTransitionsTheme extends Diagnosticable {
/// Construct a PageTransitionsTheme. /// Construct a PageTransitionsTheme.
/// ///
/// By default the list of builders is: [FadeUpwardsPageTransitionsBuilder], /// By default the list of builders is: [FadeUpwardsPageTransitionsBuilder]
/// [CupertinoPageTransitionsBuilder] for [TargetPlatform.android] /// for [TargetPlatform.android], and [CupertinoPageTransitionsBuilder] for
/// and [TargetPlatform.iOS] respectively. /// [TargetPlatform.iOS] and [TargetPlatform.macOS].
const PageTransitionsTheme({ Map<TargetPlatform, PageTransitionsBuilder> builders }) : _builders = builders; const PageTransitionsTheme({ Map<TargetPlatform, PageTransitionsBuilder> builders }) : _builders = builders;
static const Map<TargetPlatform, PageTransitionsBuilder> _defaultBuilders = <TargetPlatform, PageTransitionsBuilder>{ static const Map<TargetPlatform, PageTransitionsBuilder> _defaultBuilders = <TargetPlatform, PageTransitionsBuilder>{
TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(), TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
}; };
/// The [PageTransitionsBuilder]s supported by this theme. /// The [PageTransitionsBuilder]s supported by this theme.
......
...@@ -830,6 +830,7 @@ Future<T> showMenu<T>({ ...@@ -830,6 +830,7 @@ Future<T> showMenu<T>({
String label = semanticLabel; String label = semanticLabel;
switch (Theme.of(context).platform) { switch (Theme.of(context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
label = semanticLabel; label = semanticLabel;
break; break;
case TargetPlatform.android: case TargetPlatform.android:
...@@ -1083,6 +1084,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> { ...@@ -1083,6 +1084,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
return const Icon(Icons.more_vert); return const Icon(Icons.more_vert);
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return const Icon(Icons.more_horiz); return const Icon(Icons.more_horiz);
} }
return null; return null;
......
...@@ -2299,6 +2299,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -2299,6 +2299,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
switch (themeData.platform) { switch (themeData.platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
_addIfNonNull( _addIfNonNull(
children, children,
GestureDetector( GestureDetector(
......
...@@ -86,6 +86,7 @@ class _ScrollbarState extends State<Scrollbar> with TickerProviderStateMixin { ...@@ -86,6 +86,7 @@ class _ScrollbarState extends State<Scrollbar> with TickerProviderStateMixin {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
switch (theme.platform) { switch (theme.platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
// On iOS, stop all local animations. CupertinoScrollbar has its own // On iOS, stop all local animations. CupertinoScrollbar has its own
// animations. // animations.
_fadeoutTimer?.cancel(); _fadeoutTimer?.cancel();
......
...@@ -487,6 +487,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> { ...@@ -487,6 +487,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
String routeName; String routeName;
switch (theme.platform) { switch (theme.platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
routeName = ''; routeName = '';
break; break;
case TargetPlatform.android: case TargetPlatform.android:
......
...@@ -70,6 +70,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur ...@@ -70,6 +70,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
if (delegate.selectionEnabled) { if (delegate.selectionEnabled) {
switch (Theme.of(_state.context).platform) { switch (Theme.of(_state.context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
renderEditable.selectPositionAt( renderEditable.selectPositionAt(
from: details.globalPosition, from: details.globalPosition,
cause: SelectionChangedCause.longPress, cause: SelectionChangedCause.longPress,
...@@ -93,6 +94,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur ...@@ -93,6 +94,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
if (delegate.selectionEnabled) { if (delegate.selectionEnabled) {
switch (Theme.of(_state.context).platform) { switch (Theme.of(_state.context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
renderEditable.selectWordEdge(cause: SelectionChangedCause.tap); renderEditable.selectWordEdge(cause: SelectionChangedCause.tap);
break; break;
case TargetPlatform.android: case TargetPlatform.android:
...@@ -110,6 +112,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur ...@@ -110,6 +112,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
if (delegate.selectionEnabled) { if (delegate.selectionEnabled) {
switch (Theme.of(_state.context).platform) { switch (Theme.of(_state.context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
renderEditable.selectPositionAt( renderEditable.selectPositionAt(
from: details.globalPosition, from: details.globalPosition,
cause: SelectionChangedCause.longPress, cause: SelectionChangedCause.longPress,
...@@ -462,6 +465,7 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive ...@@ -462,6 +465,7 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
switch (Theme.of(context).platform) { switch (Theme.of(context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
if (cause == SelectionChangedCause.longPress) { if (cause == SelectionChangedCause.longPress) {
_editableText?.bringIntoView(selection.base); _editableText?.bringIntoView(selection.base);
} }
...@@ -529,6 +533,7 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive ...@@ -529,6 +533,7 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
switch (themeData.platform) { switch (themeData.platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
forcePressEnabled = true; forcePressEnabled = true;
textSelectionControls = cupertinoTextSelectionControls; textSelectionControls = cupertinoTextSelectionControls;
paintCursorAboveText = true; paintCursorAboveText = true;
......
...@@ -502,6 +502,7 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin { ...@@ -502,6 +502,7 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
return _buildMaterialSlider(context); return _buildMaterialSlider(context);
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return _buildCupertinoSlider(context); return _buildCupertinoSlider(context);
} }
} }
...@@ -888,14 +889,15 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -888,14 +889,15 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
double get _adjustmentUnit { double get _adjustmentUnit {
switch (_platform) { switch (_platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
// Matches iOS implementation of material slider. // Matches iOS implementation of material slider.
return 0.1; return 0.1;
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
default:
// Matches Android implementation of material slider. // Matches Android implementation of material slider.
return 0.05; return 0.05;
} }
return 0.0;
} }
void _updateLabelPainter() { void _updateLabelPainter() {
......
...@@ -354,6 +354,7 @@ class _SwitchState extends State<Switch> with TickerProviderStateMixin { ...@@ -354,6 +354,7 @@ class _SwitchState extends State<Switch> with TickerProviderStateMixin {
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
return buildMaterialSwitch(context); return buildMaterialSwitch(context);
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return buildCupertinoSwitch(context); return buildCupertinoSwitch(context);
} }
} }
......
...@@ -59,6 +59,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete ...@@ -59,6 +59,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
if (delegate.selectionEnabled) { if (delegate.selectionEnabled) {
switch (Theme.of(_state.context).platform) { switch (Theme.of(_state.context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
renderEditable.selectPositionAt( renderEditable.selectPositionAt(
from: details.globalPosition, from: details.globalPosition,
cause: SelectionChangedCause.longPress, cause: SelectionChangedCause.longPress,
...@@ -82,6 +83,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete ...@@ -82,6 +83,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
if (delegate.selectionEnabled) { if (delegate.selectionEnabled) {
switch (Theme.of(_state.context).platform) { switch (Theme.of(_state.context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
renderEditable.selectWordEdge(cause: SelectionChangedCause.tap); renderEditable.selectWordEdge(cause: SelectionChangedCause.tap);
break; break;
case TargetPlatform.android: case TargetPlatform.android:
...@@ -100,6 +102,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete ...@@ -100,6 +102,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
if (delegate.selectionEnabled) { if (delegate.selectionEnabled) {
switch (Theme.of(_state.context).platform) { switch (Theme.of(_state.context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
renderEditable.selectPositionAt( renderEditable.selectPositionAt(
from: details.globalPosition, from: details.globalPosition,
cause: SelectionChangedCause.longPress, cause: SelectionChangedCause.longPress,
...@@ -868,6 +871,7 @@ class _TextFieldState extends State<TextField> implements TextSelectionGestureDe ...@@ -868,6 +871,7 @@ class _TextFieldState extends State<TextField> implements TextSelectionGestureDe
switch (Theme.of(context).platform) { switch (Theme.of(context).platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
if (cause == SelectionChangedCause.longPress) { if (cause == SelectionChangedCause.longPress) {
_editableText?.bringIntoView(selection.base); _editableText?.bringIntoView(selection.base);
} }
...@@ -923,6 +927,7 @@ class _TextFieldState extends State<TextField> implements TextSelectionGestureDe ...@@ -923,6 +927,7 @@ class _TextFieldState extends State<TextField> implements TextSelectionGestureDe
switch (themeData.platform) { switch (themeData.platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
forcePressEnabled = true; forcePressEnabled = true;
textSelectionControls = cupertinoTextSelectionControls; textSelectionControls = cupertinoTextSelectionControls;
paintCursorAboveText = true; paintCursorAboveText = true;
......
...@@ -873,9 +873,10 @@ class ThemeData extends Diagnosticable { ...@@ -873,9 +873,10 @@ class ThemeData extends Diagnosticable {
/// In a test environment, the platform returned is [TargetPlatform.android] /// In a test environment, the platform returned is [TargetPlatform.android]
/// regardless of the host platform. (Android was chosen because the tests /// regardless of the host platform. (Android was chosen because the tests
/// were originally written assuming Android-like behavior, and we added /// were originally written assuming Android-like behavior, and we added
/// platform adaptations for iOS later). Tests can check iOS behavior by /// platform adaptations for other platforms later). Tests can check behavior
/// setting the [platform] of the [Theme] explicitly to [TargetPlatform.iOS], /// for other platforms by setting the [platform] of the [Theme] explicitly to
/// or by setting [debugDefaultTargetPlatformOverride]. /// another [TargetPlatform] value, or by setting
/// [debugDefaultTargetPlatformOverride].
final TargetPlatform platform; final TargetPlatform platform;
/// Configures the hit test size of certain Material widgets. /// Configures the hit test size of certain Material widgets.
......
...@@ -209,6 +209,7 @@ class _DayPeriodControl extends StatelessWidget { ...@@ -209,6 +209,7 @@ class _DayPeriodControl extends StatelessWidget {
_announceToAccessibility(context, MaterialLocalizations.of(context).anteMeridiemAbbreviation); _announceToAccessibility(context, MaterialLocalizations.of(context).anteMeridiemAbbreviation);
break; break;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
break; break;
} }
_togglePeriod(); _togglePeriod();
...@@ -224,6 +225,7 @@ class _DayPeriodControl extends StatelessWidget { ...@@ -224,6 +225,7 @@ class _DayPeriodControl extends StatelessWidget {
_announceToAccessibility(context, MaterialLocalizations.of(context).postMeridiemAbbreviation); _announceToAccessibility(context, MaterialLocalizations.of(context).postMeridiemAbbreviation);
break; break;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
break; break;
} }
_togglePeriod(); _togglePeriod();
...@@ -1525,6 +1527,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> { ...@@ -1525,6 +1527,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
}); });
break; break;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
break; break;
} }
} }
......
...@@ -88,10 +88,11 @@ enum ScriptCategory { ...@@ -88,10 +88,11 @@ enum ScriptCategory {
class Typography extends Diagnosticable { class Typography extends Diagnosticable {
/// Creates a typography instance. /// Creates a typography instance.
/// ///
/// If [platform] is [TargetPlatform.iOS], the default values for [black] and /// If [platform] is [TargetPlatform.iOS] or [TargetPlatform.macOS], the
/// [white] are [blackCupertino] and [whiteCupertino] respectively. Otherwise /// default values for [black] and [white] are [blackCupertino] and
/// they are [blackMountainView] and [whiteMoutainView]. If [platform] is /// [whiteCupertino] respectively. Otherwise they are [blackMountainView] and
/// null then both [black] and [white] must be specified. /// [whiteMoutainView]. If [platform] is null then both [black] and [white]
/// must be specified.
/// ///
/// The default values for [englishLike], [dense], and [tall] are /// The default values for [englishLike], [dense], and [tall] are
/// [englishLike2014], [dense2014], and [tall2014]. /// [englishLike2014], [dense2014], and [tall2014].
...@@ -106,6 +107,7 @@ class Typography extends Diagnosticable { ...@@ -106,6 +107,7 @@ class Typography extends Diagnosticable {
assert(platform != null || (black != null && white != null)); assert(platform != null || (black != null && white != null));
switch (platform) { switch (platform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
black ??= blackCupertino; black ??= blackCupertino;
white ??= whiteCupertino; white ??= whiteCupertino;
break; break;
......
...@@ -1719,6 +1719,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -1719,6 +1719,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
assert(defaultTargetPlatform != null); assert(defaultTargetPlatform != null);
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return Rect.fromLTWH(0.0, 0.0, cursorWidth, preferredLineHeight + 2); return Rect.fromLTWH(0.0, 0.0, cursorWidth, preferredLineHeight + 2);
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
...@@ -1777,6 +1778,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -1777,6 +1778,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
if (caretHeight != null) { if (caretHeight != null) {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
final double heightDiff = caretHeight - caretRect.height; final double heightDiff = caretHeight - caretRect.height;
// Center the caret vertically along the text. // Center the caret vertically along the text.
caretRect = Rect.fromLTWH( caretRect = Rect.fromLTWH(
......
...@@ -253,8 +253,9 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> ...@@ -253,8 +253,9 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
case TargetPlatform.android: case TargetPlatform.android:
lowerOverlayStyle = layer.find<SystemUiOverlayStyle>(bottom); lowerOverlayStyle = layer.find<SystemUiOverlayStyle>(bottom);
break; break;
case TargetPlatform.iOS:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
case TargetPlatform.iOS:
case TargetPlatform.macOS:
break; break;
} }
// If there are no overlay styles in the UI don't bother updating. // If there are no overlay styles in the UI don't bother updating.
......
...@@ -82,6 +82,7 @@ class ModalBarrier extends StatelessWidget { ...@@ -82,6 +82,7 @@ class ModalBarrier extends StatelessWidget {
platformSupportsDismissingBarrier = false; platformSupportsDismissingBarrier = false;
break; break;
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
platformSupportsDismissingBarrier = true; platformSupportsDismissingBarrier = true;
break; break;
} }
......
...@@ -1217,9 +1217,10 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -1217,9 +1217,10 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
/// True if one or more [WillPopCallback] callbacks exist. /// True if one or more [WillPopCallback] callbacks exist.
/// ///
/// This method is used to disable the horizontal swipe pop gesture /// This method is used to disable the horizontal swipe pop gesture supported
/// supported by [MaterialPageRoute] for [TargetPlatform.iOS]. /// by [MaterialPageRoute] for [TargetPlatform.iOS] and
/// If a pop might be vetoed, then the back gesture is disabled. /// [TargetPlatform.macOS]. If a pop might be vetoed, then the back gesture is
/// disabled.
/// ///
/// The [buildTransitions] method will not be called again if this changes, /// The [buildTransitions] method will not be called again if this changes,
/// since it can change during the build as descendants of the route add or /// since it can change during the build as descendants of the route add or
......
...@@ -35,6 +35,7 @@ class ScrollBehavior { ...@@ -35,6 +35,7 @@ class ScrollBehavior {
// _MaterialScrollBehavior as well. // _MaterialScrollBehavior as well.
switch (getPlatform(context)) { switch (getPlatform(context)) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return child; return child;
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
...@@ -54,6 +55,7 @@ class ScrollBehavior { ...@@ -54,6 +55,7 @@ class ScrollBehavior {
ScrollPhysics getScrollPhysics(BuildContext context) { ScrollPhysics getScrollPhysics(BuildContext context) {
switch (getPlatform(context)) { switch (getPlatform(context)) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.macOS:
return const BouncingScrollPhysics(); return const BouncingScrollPhysics();
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
......
...@@ -331,6 +331,7 @@ void main() { ...@@ -331,6 +331,7 @@ void main() {
final Finder button = find.byType(RaisedButton); final Finder button = find.byType(RaisedButton);
expect(tester.getBottomLeft(button).dy, equals(550.0)); expect(tester.getBottomLeft(button).dy, equals(550.0));
expect(tester.getCenter(button).dx, equals(400.0)); expect(tester.getCenter(button).dx, equals(400.0));
debugDefaultTargetPlatformOverride = null;
// Drag for overscroll // Drag for overscroll
await tester.drag(find.byType(Scrollable), const Offset(0.0, -50.0)); await tester.drag(find.byType(Scrollable), const Offset(0.0, -50.0));
......
...@@ -656,7 +656,8 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi ...@@ -656,7 +656,8 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
// removed, and the new schema should always be used. // removed, and the new schema should always be used.
'useNewPluginSchema': macos, 'useNewPluginSchema': macos,
// If a desktop platform is included, add a workaround for #31366. // If a desktop platform is included, add a workaround for #31366.
'includeTargetPlatformWorkaround': macos, // When Linux and Windows are added, we will need this workaround again.
'includeTargetPlatformWorkaround': false,
}; };
} }
......
...@@ -18,7 +18,7 @@ import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart'; ...@@ -18,7 +18,7 @@ import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart';
// Sets a platform override for desktop to avoid exceptions. See // Sets a platform override for desktop to avoid exceptions. See
// https://flutter.dev/desktop#target-platform-override for more info. // https://flutter.dev/desktop#target-platform-override for more info.
void _enablePlatformOverrideForDesktop() { void _enablePlatformOverrideForDesktop() {
if (!kIsWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux)) { if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment