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:
@@ -64,6 +64,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
case TargetPlatform.fuchsia:
|
||||
return Icons.arrow_back;
|
||||
case TargetPlatform.iOS:
|
||||
case TargetPlatform.macOS:
|
||||
return Icons.arrow_back_ios;
|
||||
}
|
||||
assert(false);
|
||||
|
||||
@@ -360,6 +360,8 @@ class _PlatformItem extends StatelessWidget {
|
||||
return 'Fuchsia';
|
||||
case TargetPlatform.iOS:
|
||||
return 'Cupertino';
|
||||
case TargetPlatform.macOS:
|
||||
return 'Material Desktop (macOS)';
|
||||
}
|
||||
assert(false);
|
||||
return null;
|
||||
|
||||
@@ -14,8 +14,12 @@ import 'gallery/app.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.
|
||||
// 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() {
|
||||
if (!kIsWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux)) {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user