Commit a0bbff8c687e61b0840424d83315ab989fc96497
1 parent
4fb9cd24
feat:代码优化-背景音播放使用await同步阻塞
Showing
2 changed files
with
5 additions
and
5 deletions
lib/pages/home/view.dart
... | ... | @@ -79,7 +79,7 @@ class _HomePageView extends StatelessWidget { |
79 | 79 | child: GestureDetector( |
80 | 80 | onTap: () { |
81 | 81 | _checkPermission(() async { |
82 | - clickController.playMusicAndPerformAction( | |
82 | + await clickController.playMusicAndPerformAction( | |
83 | 83 | context, AudioPlayerUtilType.classTime, |
84 | 84 | () async { |
85 | 85 | pushNamed(AppRouteName.courseUnit) |
... | ... | @@ -172,7 +172,7 @@ class _HomePageView extends StatelessWidget { |
172 | 172 | return GestureDetector( |
173 | 173 | onTap: () { |
174 | 174 | _checkPermission(() async { |
175 | - clickController.playMusicAndPerformAction( | |
175 | + await clickController.playMusicAndPerformAction( | |
176 | 176 | context, AudioPlayerUtilType.gameTime, |
177 | 177 | () async { |
178 | 178 | pushNamed(AppRouteName.games) | ... | ... |
lib/pages/section/section_page.dart
... | ... | @@ -77,7 +77,7 @@ class _SectionPageView extends StatelessWidget { |
77 | 77 | audioType = AudioPlayerUtilType.videoTime; |
78 | 78 | } |
79 | 79 | |
80 | - clickController.playMusicAndPerformAction(context, audioType, | |
80 | + await clickController.playMusicAndPerformAction(context, audioType, | |
81 | 81 | () async { |
82 | 82 | ///播放音乐->调进入课程接口->跳转课程页面 |
83 | 83 | await bloc.requestEnterClass(courseLessonId, () { |
... | ... | @@ -108,7 +108,7 @@ class _SectionPageView extends StatelessWidget { |
108 | 108 | |
109 | 109 | if (courseType == SectionType.pictureBook.value) { |
110 | 110 | //绘本 |
111 | - clickController.playMusicAndPerformAction( | |
111 | + await clickController.playMusicAndPerformAction( | |
112 | 112 | context, AudioPlayerUtilType.readingTime, () async { |
113 | 113 | await bloc.requestEnterClass(courseLessonId, () { |
114 | 114 | pushNamed(AppRouteName.reading, |
... | ... | @@ -134,7 +134,7 @@ class _SectionPageView extends StatelessWidget { |
134 | 134 | |
135 | 135 | if (courseType == SectionType.practice.value) { |
136 | 136 | //练习 |
137 | - clickController.playMusicAndPerformAction( | |
137 | + await clickController.playMusicAndPerformAction( | |
138 | 138 | context, AudioPlayerUtilType.quizTime, () async { |
139 | 139 | await bloc.requestEnterClass(courseLessonId, () { |
140 | 140 | pushNamed(AppRouteName.topicPic, arguments: { | ... | ... |