Skip to content

Commit

Permalink
refactor: replace WillPopScope with PopScope
Browse files Browse the repository at this point in the history
  • Loading branch information
narcodico committed Apr 2, 2024
1 parent 0135c1c commit 4aac201
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/topics/view/topic_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class TopicPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
context.flow<TopicsFlowState>().deselectTopic();
return false;
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (!didPop) {
context.flow<TopicsFlowState>().deselectTopic();
}
},
child: Scaffold(
appBar: AppBar(
Expand Down Expand Up @@ -87,7 +89,7 @@ class QuizList extends StatelessWidget {
final quizzes = context.select((Topic topic) => topic.quizzes);
return Column(
children: [
for (final quiz in quizzes) QuizItem(quiz: quiz, topicId: topicId)
for (final quiz in quizzes) QuizItem(quiz: quiz, topicId: topicId),
],
);
}
Expand Down

0 comments on commit 4aac201

Please sign in to comment.