Skip to content

Commit ad806da

Browse files
committed
Separate ID from name for browser OS
1 parent a395fb3 commit ad806da

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/site_shared/lib/src/utils/web_current_os.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ import 'package:universal_web/web.dart' as web;
1010

1111
/// An operating system that a user's web browser can run on.
1212
enum OperatingSystem {
13-
windows('Windows'),
14-
macOS('macOS'),
15-
linux('Linux'),
16-
chromeOS('ChromeOS');
13+
windows(id: 'windows', label: 'Windows'),
14+
macOS(id: 'macos', label: 'macOS'),
15+
linux(id: 'linux', label: 'Linux'),
16+
chromeOS(id: 'chromeos', label: 'ChromeOS');
1717

18-
const OperatingSystem(this.label);
18+
const OperatingSystem({required this.id, required this.label});
19+
20+
/// All-lowercase identifier for the operating system.
21+
final String id;
1922

2023
/// Human-readable name of the operating system.
2124
final String label;

sites/docs/lib/src/components/common/client/os_selector.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class _OsSelectorState extends State<OsSelector> {
7474
[
7575
div(classes: 'card-leading', [
7676
img(
77-
src: '/assets/images/docs/brand-svg/${os.name}.svg',
77+
src: '/assets/images/docs/brand-svg/${os.id}.svg',
7878
alt: '${os.label} logo',
7979
attributes: {
8080
'width': '72',

0 commit comments

Comments
 (0)