Implement switch expressions in dev/ (#139048)
I previously made a PR (#136140) that used `switch` expressions to make some parts of the Flutter codebase easier to understand. It was assigned to the framework team, and @christopherfujino let me know that it was too large to effectively review and recommended breaking it up into smaller pull requests. Here's a PR that only targets files in the `dev/` directory. Hopefully this will be easier to work with! (solves issue https://github.com/flutter/flutter/issues/136139)
This commit is contained in:
@@ -411,20 +411,14 @@ class _PlatformItem extends StatelessWidget {
|
||||
final ValueChanged<GalleryOptions>? onOptionsChanged;
|
||||
|
||||
String _platformLabel(TargetPlatform platform) {
|
||||
switch (platform) {
|
||||
case TargetPlatform.android:
|
||||
return 'Mountain View';
|
||||
case TargetPlatform.fuchsia:
|
||||
return 'Fuchsia';
|
||||
case TargetPlatform.iOS:
|
||||
return 'Cupertino';
|
||||
case TargetPlatform.linux:
|
||||
return 'Material Desktop (linux)';
|
||||
case TargetPlatform.macOS:
|
||||
return 'Material Desktop (macOS)';
|
||||
case TargetPlatform.windows:
|
||||
return 'Material Desktop (Windows)';
|
||||
}
|
||||
return switch (platform) {
|
||||
TargetPlatform.android => 'Mountain View',
|
||||
TargetPlatform.fuchsia => 'Fuchsia',
|
||||
TargetPlatform.iOS => 'Cupertino',
|
||||
TargetPlatform.linux => 'Material Desktop (linux)',
|
||||
TargetPlatform.macOS => 'Material Desktop (macOS)',
|
||||
TargetPlatform.windows => 'Material Desktop (Windows)',
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user