diff --git a/lib/tools/leaderboard/achievements_page.dart b/lib/tools/leaderboard/achievements_page.dart index ffdef6d..90e2029 100644 --- a/lib/tools/leaderboard/achievements_page.dart +++ b/lib/tools/leaderboard/achievements_page.dart @@ -11,8 +11,11 @@ class AchievementPage extends StatefulWidget { State createState() => _AchievementPageState(); } -class _AchievementPageState extends State { +class _AchievementPageState extends State + with AutomaticKeepAliveClientMixin { final rewardsController = Get.find(); + @override + bool get wantKeepAlive => true; String dateFormat(DateTime date) { return DateFormat('EEEE, MMMM d, y').format(date); @@ -20,6 +23,7 @@ class _AchievementPageState extends State { @override Widget build(BuildContext context) { + super.build(context); return RefreshIndicator( onRefresh: () async { final result = await rewardsController.fetchCurrentUserRewards(); diff --git a/lib/tools/leaderboard/hall_of_fame_page.dart b/lib/tools/leaderboard/hall_of_fame_page.dart index cc7e4a1..be3e407 100644 --- a/lib/tools/leaderboard/hall_of_fame_page.dart +++ b/lib/tools/leaderboard/hall_of_fame_page.dart @@ -3,19 +3,22 @@ import 'package:academia/tools/leaderboard/widgets/top_three_widget.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; -class HallOfFamePage extends StatelessWidget { +class HallOfFamePage extends StatefulWidget { const HallOfFamePage({super.key}); - // @override - // void initState() { - // super.initState(); - // leaderBoardResult = rewardsController.fetchLeaderBoard(); - // } + @override + State createState() => _HallOfFamePageState(); +} + +class _HallOfFamePageState extends State + with AutomaticKeepAliveClientMixin { + @override + bool get wantKeepAlive => true; @override Widget build(BuildContext context) { + super.build(context); final rewardsController = Get.find(); - // late Future>> leaderBoardResult; Future leaderBoardResult = rewardsController.fetchLeaderBoard(); return FutureBuilder(