diff --git a/lib/pages/leaderboard_page.dart b/lib/pages/leaderboard_page.dart index 12dd459..1f4a5a9 100644 --- a/lib/pages/leaderboard_page.dart +++ b/lib/pages/leaderboard_page.dart @@ -19,13 +19,15 @@ class LeaderboardPage extends StatelessWidget { color: isLoggedInUser ? Theme.of(context).colorScheme.secondary : null, child: ListTile( - leading: Text((index + 1).toString(), - style: Theme.of(context).textTheme.bodyLarge!.copyWith( - fontWeight: FontWeight.bold, - color: isLoggedInUser - ? Theme.of(context).colorScheme.onSecondary - : null, - )), + leading: Text( + (index + 1).toString(), + style: Theme.of(context).textTheme.bodyLarge!.copyWith( + fontWeight: FontWeight.bold, + color: isLoggedInUser + ? Theme.of(context).colorScheme.onSecondary + : null, + ), + ), title: Text( leaderboard.elementAt(index).username, style: TextStyle( @@ -34,13 +36,15 @@ class LeaderboardPage extends StatelessWidget { : null, ), ), - trailing: Text(leaderboard.elementAt(index).points.toString(), - style: Theme.of(context).textTheme.bodyLarge!.copyWith( - fontWeight: FontWeight.bold, - color: isLoggedInUser - ? Theme.of(context).colorScheme.onSecondary - : null, - )), + trailing: Text( + leaderboard.elementAt(index).points.toString(), + style: Theme.of(context).textTheme.bodyLarge!.copyWith( + fontWeight: FontWeight.bold, + color: isLoggedInUser + ? Theme.of(context).colorScheme.onSecondary + : null, + ), + ), ), ); }); diff --git a/lib/services/db_helper.dart b/lib/services/db_helper.dart index f866be8..c9d0dc5 100644 --- a/lib/services/db_helper.dart +++ b/lib/services/db_helper.dart @@ -83,7 +83,10 @@ class DbHelper { static Future> fetchProfiles() async { List items = []; - final res = await _supabase.from('profiles').select(); + final res = await _supabase.from('profiles').select().order( + 'points', + ascending: false, + ); for (final map in res) { items.add(Profile.fromMap(map)); }