Skip to content

Commit

Permalink
feat: add finished trivia page variant
Browse files Browse the repository at this point in the history
  • Loading branch information
luisburgos committed Sep 23, 2022
1 parent 2477420 commit ac818a9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions example/lib/shared/modules/trivia/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ class TriviaPage extends StatelessWidget {
);
}

if (status == 'finished') {
return _TriviaFinishedStatusPage(
triviaId: triviaId,
onSeeScoreboardTap: onSeeScoreboardTap,
);
}

return _TriviaInitialStatusPage(
triviaId: triviaId,
onCopyJoinLinkTap: onCopyJoinLinkTap,
Expand Down Expand Up @@ -123,3 +130,30 @@ class _TriviaStartedStatusPage extends StatelessWidget {
);
}
}

class _TriviaFinishedStatusPage extends StatelessWidget {
const _TriviaFinishedStatusPage({
Key? key,
required this.triviaId,
required this.onSeeScoreboardTap,
}) : super(key: key);

final String triviaId;
final Function(String) onSeeScoreboardTap;

@override
Widget build(BuildContext context) {
return BasePage(
name: '$runtimeType',
actions: [
MainAction(
label: 'See scoreboard',
onPressed: () {
debugPrint('$runtimeType onSeeScoreboardTap');
onSeeScoreboardTap(triviaId);
},
),
],
);
}
}

0 comments on commit ac818a9

Please sign in to comment.