Leaderboard
This commit is contained in:
@@ -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(
|
||||||
|
color:
|
||||||
|
isLoggedInUser ? Theme.of(context).colorScheme.secondary : null,
|
||||||
|
child: ListTile(
|
||||||
leading: Text((index + 1).toString(),
|
leading: Text((index + 1).toString(),
|
||||||
style: Theme.of(context)
|
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||||
.textTheme
|
fontWeight: FontWeight.bold,
|
||||||
.bodyLarge!
|
color: isLoggedInUser
|
||||||
.copyWith(fontWeight: FontWeight.bold)),
|
? Theme.of(context).colorScheme.onSecondary
|
||||||
title: Text(leaderboard.first.username),
|
: null,
|
||||||
trailing: Text(leaderboard.first.points.toString(),
|
)),
|
||||||
style: Theme.of(context)
|
title: Text(
|
||||||
.textTheme
|
leaderboard.elementAt(index).username,
|
||||||
.bodyLarge!
|
style: TextStyle(
|
||||||
.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,
|
||||||
|
)),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user