Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/badges/anchor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/badges/audiophile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/badges/coversationalist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/badges/crowdfav.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/badges/storyteller.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/models/resonate_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ double? toDouble(dynamic value) {
if (value is int) return value.toDouble();
if (value is double) return value;
return null;
}
}
25 changes: 25 additions & 0 deletions lib/utils/badge_constants.dart
Original file line number Diff line number Diff line change
@@ -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<String, String> 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<String, String> 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',
};
}
1 change: 1 addition & 0 deletions lib/views/screens/user_account_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
34 changes: 34 additions & 0 deletions lib/views/widgets/badge_row.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import '../../utils/badge_constants.dart';

class BadgeRow extends StatelessWidget {
final List<String> 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(),
);
}
}
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down