Leaderboard
This commit is contained in:
@@ -1,15 +1,32 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../models/profile.dart';
|
import '../models/profile.dart';
|
||||||
|
import '../services/profiles_provider.dart';
|
||||||
|
|
||||||
class LeaderboardPage extends StatelessWidget {
|
class LeaderboardPage extends StatelessWidget {
|
||||||
const LeaderboardPage({super.key});
|
const LeaderboardPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final leaderboard = [
|
final leaderboard = Provider.of<Profiles>(context).profiles;
|
||||||
Profile('Alina', 123),
|
return ListView.builder(
|
||||||
];
|
padding: const EdgeInsets.all(8),
|
||||||
return const Placeholder();
|
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 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../services/feed_provider.dart';
|
import '../services/feed_provider.dart';
|
||||||
|
import 'leaderboard_page.dart';
|
||||||
import 'login_page.dart';
|
import 'login_page.dart';
|
||||||
|
|
||||||
class SplashPage extends StatefulWidget {
|
class SplashPage extends StatefulWidget {
|
||||||
@@ -19,7 +20,7 @@ class _SplashPageState extends State<SplashPage> {
|
|||||||
int currentPageIndex = 0;
|
int currentPageIndex = 0;
|
||||||
final List<Widget> tabs = [
|
final List<Widget> tabs = [
|
||||||
const GamesPage(),
|
const GamesPage(),
|
||||||
const FeedPage(),
|
const LeaderboardPage(),
|
||||||
const FeedPage(),
|
const FeedPage(),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -65,17 +66,17 @@ class _SplashPageState extends State<SplashPage> {
|
|||||||
items: const <BottomNavigationBarItem>[
|
items: const <BottomNavigationBarItem>[
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.home,
|
Icons.videogame_asset,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
label: 'Home',
|
label: 'Games',
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.add_rounded,
|
Icons.emoji_events,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
label: 'Add',
|
label: 'Leaderboard',
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
|
|||||||
Reference in New Issue
Block a user