Leaderboard

This commit is contained in:
Nopylacetat
2023-10-20 23:55:36 +02:00
parent 57dcdb55f4
commit 14536bfc59

View File

@@ -13,20 +13,35 @@ class LeaderboardPage extends StatelessWidget {
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
itemCount: leaderboard.length, itemCount: leaderboard.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return ListTile( final isLoggedInUser =
selected: leaderboard.elementAt(index).id == DbHelper.currentUser!.id;
leaderboard.elementAt(index).id == DbHelper.currentUser!.id, return Card(
leading: Text((index + 1).toString(), color:
style: Theme.of(context) isLoggedInUser ? Theme.of(context).colorScheme.secondary : null,
.textTheme child: ListTile(
.bodyLarge! leading: Text((index + 1).toString(),
.copyWith(fontWeight: FontWeight.bold)), style: Theme.of(context).textTheme.bodyLarge!.copyWith(
title: Text(leaderboard.first.username), fontWeight: FontWeight.bold,
trailing: Text(leaderboard.first.points.toString(), color: isLoggedInUser
style: Theme.of(context) ? Theme.of(context).colorScheme.onSecondary
.textTheme : null,
.bodyLarge! )),
.copyWith(fontWeight: FontWeight.bold)), title: Text(
leaderboard.elementAt(index).username,
style: TextStyle(
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,
)),
),
); );
}); });
} }