Leaderboard
This commit is contained in:
@@ -1,15 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../models/profile.dart';
|
||||
import '../services/profiles_provider.dart';
|
||||
|
||||
class LeaderboardPage extends StatelessWidget {
|
||||
const LeaderboardPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final leaderboard = [
|
||||
Profile('Alina', 123),
|
||||
];
|
||||
return const Placeholder();
|
||||
final leaderboard = Provider.of<Profiles>(context).profiles;
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(8),
|
||||
itemCount: leaderboard.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ListTile(
|
||||
leading: Text((index + 1).toString(),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyLarge!
|
||||
.copyWith(fontWeight: FontWeight.bold)),
|
||||
title: Text(leaderboard.first.username),
|
||||
trailing: Text(leaderboard.first.points.toString(),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyLarge!
|
||||
.copyWith(fontWeight: FontWeight.bold)),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:maggs_victory_voyage/services/db_helper.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../services/feed_provider.dart';
|
||||
import 'leaderboard_page.dart';
|
||||
import 'login_page.dart';
|
||||
|
||||
class SplashPage extends StatefulWidget {
|
||||
@@ -19,7 +20,7 @@ class _SplashPageState extends State<SplashPage> {
|
||||
int currentPageIndex = 0;
|
||||
final List<Widget> tabs = [
|
||||
const GamesPage(),
|
||||
const FeedPage(),
|
||||
const LeaderboardPage(),
|
||||
const FeedPage(),
|
||||
];
|
||||
|
||||
@@ -65,17 +66,17 @@ class _SplashPageState extends State<SplashPage> {
|
||||
items: const <BottomNavigationBarItem>[
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.home,
|
||||
Icons.videogame_asset,
|
||||
color: Colors.white,
|
||||
),
|
||||
label: 'Home',
|
||||
label: 'Games',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.add_rounded,
|
||||
Icons.emoji_events,
|
||||
color: Colors.white,
|
||||
),
|
||||
label: 'Add',
|
||||
label: 'Leaderboard',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
|
||||
Reference in New Issue
Block a user