in app/lib/frontend/templates/listing.dart [136:214]
List<SearchTab> _calculateSearchTabs(SearchForm searchForm) {
SearchTab runtimeTab({
required String label,
required String runtimeTag,
required String title,
}) {
return SearchTab(
text: label,
href: searchForm.toggleRuntime(runtimeTag).toSearchLink(),
title: title,
active: searchForm.runtimes.contains(runtimeTag),
);
}
SearchTab platformTab({
required String label,
required String platformTag,
required String title,
}) {
return SearchTab(
text: label,
href: searchForm.togglePlatform(platformTag).toSearchLink(),
title: title,
active: searchForm.platforms.contains(platformTag),
);
}
final sdk = searchForm.context.sdk;
if (sdk == SdkTagValue.dart) {
return <SearchTab>[
runtimeTab(
label: 'native',
runtimeTag: DartSdkRuntime.nativeJit,
title:
'Packages compatible with Dart running on a native platform (JIT/AOT)',
),
runtimeTab(
label: 'JS',
runtimeTag: DartSdkRuntime.web,
title: 'Packages compatible with Dart compiled for the web',
),
];
}
if (sdk == SdkTagValue.flutter) {
return <SearchTab>[
platformTab(
label: 'Android',
platformTag: FlutterSdkPlatform.android,
title: 'Packages compatible with Flutter on the Android platform',
),
platformTab(
label: 'iOS',
platformTag: FlutterSdkPlatform.ios,
title: 'Packages compatible with Flutter on the iOS platform',
),
platformTab(
label: 'Web',
platformTag: FlutterSdkPlatform.web,
title: 'Packages compatible with Flutter on the Web platform',
),
platformTab(
label: 'Linux',
platformTag: FlutterSdkPlatform.linux,
title: 'Packages compatible with Flutter on the Linux platform',
),
platformTab(
label: 'macOS',
platformTag: FlutterSdkPlatform.macos,
title: 'Packages compatible with Flutter on the macOS platform',
),
platformTab(
label: 'Windows',
platformTag: FlutterSdkPlatform.windows,
title: 'Packages compatible with Flutter on the Windows platform',
),
];
}
return const <SearchTab>[];
}