diff --git a/assets/badges/anchor.png b/assets/badges/anchor.png new file mode 100644 index 00000000..f4df0642 Binary files /dev/null and b/assets/badges/anchor.png differ diff --git a/assets/badges/audiophile.png b/assets/badges/audiophile.png new file mode 100644 index 00000000..ff1f2f92 Binary files /dev/null and b/assets/badges/audiophile.png differ diff --git a/assets/badges/coversationalist.png b/assets/badges/coversationalist.png new file mode 100644 index 00000000..b8ffd8e1 Binary files /dev/null and b/assets/badges/coversationalist.png differ diff --git a/assets/badges/crowdfav.png b/assets/badges/crowdfav.png new file mode 100644 index 00000000..28ea31a7 Binary files /dev/null and b/assets/badges/crowdfav.png differ diff --git a/assets/badges/storyteller.png b/assets/badges/storyteller.png new file mode 100644 index 00000000..abcfa08f Binary files /dev/null and b/assets/badges/storyteller.png differ diff --git a/lib/models/resonate_user.dart b/lib/models/resonate_user.dart index b784c3ad..c723ae52 100644 --- a/lib/models/resonate_user.dart +++ b/lib/models/resonate_user.dart @@ -25,4 +25,4 @@ double? toDouble(dynamic value) { if (value is int) return value.toDouble(); if (value is double) return value; return null; -} +} \ No newline at end of file diff --git a/lib/utils/badge_constants.dart b/lib/utils/badge_constants.dart new file mode 100644 index 00000000..7fb69239 --- /dev/null +++ b/lib/utils/badge_constants.dart @@ -0,0 +1,25 @@ +class BadgeConstants { + static const String anchor = 'ANCHOR'; + static const String storyteller = 'STORYTELLER'; + static const String crowdFavorite = 'CROWD_FAVORITE'; + static const String conversationalist = 'CONVERSATIONALIST'; + static const String audiophile = 'AUDIOPHILE'; + + // This maps the ID to the image file + static const Map icons = { + anchor: 'assets/badges/anchor.png', + storyteller: 'assets/badges/storyteller.png', + crowdFavorite: 'assets/badges/crowdfav.png', + conversationalist: 'assets/badges/conversationalist.png', + audiophile: 'assets/badges/audiophile.png', + }; + + // This maps the ID to the text description (tooltip) + static const Map tooltips = { + anchor: 'The Anchor: Hosted 5 Rooms', + storyteller: 'The Storyteller: Published 1 Story', + crowdFavorite: 'Crowd Favorite: 100 Listeners', + conversationalist: 'Conversationalist: 10 Pair Chats', + audiophile: 'Audiophile: 10 Hours Listening', + }; +} \ No newline at end of file diff --git a/lib/views/screens/user_account_screen.dart b/lib/views/screens/user_account_screen.dart index 15808955..d8487d50 100644 --- a/lib/views/screens/user_account_screen.dart +++ b/lib/views/screens/user_account_screen.dart @@ -3,6 +3,7 @@ import 'package:resonate/l10n/app_localizations.dart'; import 'package:get/get.dart'; import 'package:resonate/routes/app_routes.dart'; import 'package:resonate/utils/ui_sizes.dart'; +import 'widgets/badge_row.dart'; class UserAccountScreen extends StatelessWidget { const UserAccountScreen({super.key}); diff --git a/lib/views/widgets/badge_row.dart b/lib/views/widgets/badge_row.dart new file mode 100644 index 00000000..4b8b497a --- /dev/null +++ b/lib/views/widgets/badge_row.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import '../../utils/badge_constants.dart'; + +class BadgeRow extends StatelessWidget { + final List userBadges; + + const BadgeRow({Key? key, required this.userBadges}) : super(key: key); + + @override + Widget build(BuildContext context) { + if (userBadges.isEmpty) return SizedBox.shrink(); // Hide if no badges + + return Wrap( + spacing: 8.0, // Space between badges + children: userBadges.map((badgeId) { + // Find the image path for this badge ID + final iconPath = BadgeConstants.icons[badgeId]; + + // If we define a badge in DB but forget the image, don't crash + if (iconPath == null) return SizedBox.shrink(); + + return Tooltip( + message: BadgeConstants.tooltips[badgeId] ?? '', + triggerMode: TooltipTriggerMode.tap, + child: Image.asset( + iconPath, + width: 35, // Size of the badge + height: 35, + ), + ); + }).toList(), + ); + } +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 978d8920..e5ca14cc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -131,6 +131,7 @@ flutter: - assets/images/ - assets/svg/ - assets/mock/ + - assets/badges/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware