Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Added support for enhanced enums in data/demos.dart #681

Merged
merged 8 commits into from
May 18, 2022
16 changes: 9 additions & 7 deletions lib/data/demos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ enum GalleryDemoCategory {
study,
material,
cupertino,
other,
}
other;

@override
String toString() {
return name.toUpperCase();
}

extension GalleryDemoExtension on GalleryDemoCategory {
String? displayTitle(GalleryLocalizations localizations) {
switch (this) {
case GalleryDemoCategory.material:
return 'MATERIAL';
case GalleryDemoCategory.cupertino:
return 'CUPERTINO';
case GalleryDemoCategory.other:
return localizations.homeCategoryReference;
case GalleryDemoCategory.material:
case GalleryDemoCategory.cupertino:
return toString();
case GalleryDemoCategory.study:
}
return null;
Expand Down