From 4aac201fed6393870c2e9483defb62431f7d2a66 Mon Sep 17 00:00:00 2001 From: Rolly Date: Tue, 2 Apr 2024 04:02:16 +0300 Subject: [PATCH] refactor: replace `WillPopScope` with `PopScope` --- lib/topics/view/topic_page.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/topics/view/topic_page.dart b/lib/topics/view/topic_page.dart index 8f3a0e6..6c7bc16 100644 --- a/lib/topics/view/topic_page.dart +++ b/lib/topics/view/topic_page.dart @@ -21,10 +21,12 @@ class TopicPage extends StatelessWidget { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - context.flow().deselectTopic(); - return false; + return PopScope( + canPop: false, + onPopInvoked: (didPop) { + if (!didPop) { + context.flow().deselectTopic(); + } }, child: Scaffold( appBar: AppBar( @@ -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), ], ); }