Skip to content

Commit

Permalink
fix: back button fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ProjectAJ14 committed Jun 30, 2024
1 parent 5d4c6fe commit 7e7f8a7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
6 changes: 1 addition & 5 deletions lib/ui/screens/game/game_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ class GameController extends GetxController {
void _gameListener(event) {
int score = _calculateScore();
if (score <= 0 && !isGameEnded && isGameStarted) {
endGame(
reason: 'You ran out of time!',
);
} else {
developer.log("score: $score");
endGame(reason: 'You ran out of time!');
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/ui/screens/home/widgets/footer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class Footer extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: Row(
children: [
const Text(
Text(
'Made with Flutter',
style: Theme.of(context).textTheme.bodySmall,
),
const Icon(
Icons.favorite,
Expand Down
23 changes: 15 additions & 8 deletions lib/ui/screens/leaderboard/leaderboard_screen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:nes_ui/nes_ui.dart';

import '../../../app/repo/repos.dart';
import '../../routes/route_constants.dart';
import 'widgets/user_table_widget.dart';

class LeaderboardScreen extends StatelessWidget {
Expand All @@ -26,13 +28,16 @@ class LeaderboardScreen extends StatelessWidget {
],
),
centerTitle: true,
leading: const CloseButton(),
leading: CloseButton(
onPressed: () {
Get.offAllNamed(RouteConstants.home);
},
),
),
body: SingleChildScrollView(
child: Container(
child: SizedBox(
height: height * 1.5,
width: width,
color: Colors.blue.shade100,
child: Center(
child: StreamBuilder(
stream: fireStoreRepo.leaderboardStream(),
Expand All @@ -57,6 +62,10 @@ class LeaderboardScreen extends StatelessWidget {
Icons.emoji_events,
size: MediaQuery.of(context).size.width * 0.1,
),
Text(
highestScorer.score.toString(),
style: Theme.of(context).textTheme.headlineMedium,
),
Text(
highestScorer.displayName,
style: Theme.of(context).textTheme.headlineLarge,
Expand All @@ -65,12 +74,10 @@ class LeaderboardScreen extends StatelessWidget {
highestScorer.email,
style: Theme.of(context).textTheme.bodySmall,
),
Text(
highestScorer.score.toString(),
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(height: 16),
const Divider(),
const Divider(
indent: 10,
),
],
Flexible(child: UserTableWidget(users: users)),
],
Expand Down

0 comments on commit 7e7f8a7

Please sign in to comment.