Commit 6baa39bd83252c1989cce9463ae316e311f755a2
1 parent
1e22b7d1
feat:儿歌/视频保留url传参,留作日后扩展
Showing
4 changed files
with
10 additions
and
7 deletions
lib/pages/section/section_page.dart
@@ -61,7 +61,7 @@ class _SectionPageView extends StatelessWidget { | @@ -61,7 +61,7 @@ class _SectionPageView extends StatelessWidget { | ||
61 | return BlocListener<SectionBloc, SectionState>( | 61 | return BlocListener<SectionBloc, SectionState>( |
62 | listener: (context, state) async { | 62 | listener: (context, state) async { |
63 | if (state is RequestEnterClassState) { | 63 | if (state is RequestEnterClassState) { |
64 | - if (state.courseType == SectionType.song.value && | 64 | + if (state.courseType == SectionType.song.value || |
65 | state.courseType == SectionType.video.value) { | 65 | state.courseType == SectionType.video.value) { |
66 | var title = | 66 | var title = |
67 | state.courseType == SectionType.song.value ? 'song' : 'video'; | 67 | state.courseType == SectionType.song.value ? 'song' : 'video'; |
@@ -75,7 +75,7 @@ class _SectionPageView extends StatelessWidget { | @@ -75,7 +75,7 @@ class _SectionPageView extends StatelessWidget { | ||
75 | .playAudio(AudioPlayerUtilType.videoTime); | 75 | .playAudio(AudioPlayerUtilType.videoTime); |
76 | } | 76 | } |
77 | pushNamed(AppRouteName.lookVideo, arguments: { | 77 | pushNamed(AppRouteName.lookVideo, arguments: { |
78 | - 'videoUrl': "", | 78 | + 'videoUrl': null, |
79 | 'title': title, | 79 | 'title': title, |
80 | 'courseLessonId': state.courseLessonId, | 80 | 'courseLessonId': state.courseLessonId, |
81 | 'isTopic': true | 81 | 'isTopic': true |
lib/pages/video/lookvideo/bloc/look_video_bloc.dart
@@ -17,7 +17,7 @@ part 'look_video_state.dart'; | @@ -17,7 +17,7 @@ part 'look_video_state.dart'; | ||
17 | class LookVideoBloc extends BaseSectionBloc<BaseSectionEvent, BaseSectionState> { | 17 | class LookVideoBloc extends BaseSectionBloc<BaseSectionEvent, BaseSectionState> { |
18 | 18 | ||
19 | final String? _videoUrl; | 19 | final String? _videoUrl; |
20 | - String? get videoUrl => _videoUrl ?? _entity?.videos?.videoUrl ?? ''; | 20 | + String? get videoUrl => (_videoUrl?.isNotEmpty == true) ? _videoUrl : _entity?.videos?.videoUrl ?? ''; |
21 | final String? _typeTitle; | 21 | final String? _typeTitle; |
22 | String? get typeTitle => _typeTitle; | 22 | String? get typeTitle => _typeTitle; |
23 | final String? _courseLessonId; | 23 | final String? _courseLessonId; |
lib/pages/video/lookvideo/look_video_page.dart
@@ -13,6 +13,7 @@ class LookVideoPage extends StatelessWidget { | @@ -13,6 +13,7 @@ class LookVideoPage extends StatelessWidget { | ||
13 | this.courseLessonId, | 13 | this.courseLessonId, |
14 | this.isTopic = false}); | 14 | this.isTopic = false}); |
15 | 15 | ||
16 | + ///暂时不删,留着以后扩展。目前的逻辑是null,进入后请求课程数据 | ||
16 | final String? videoUrl; | 17 | final String? videoUrl; |
17 | final String? typeTitle; | 18 | final String? typeTitle; |
18 | final String? courseLessonId; | 19 | final String? courseLessonId; |
lib/route/route.dart
@@ -132,8 +132,8 @@ class AppRouter { | @@ -132,8 +132,8 @@ class AppRouter { | ||
132 | if (settings.arguments != null) { | 132 | if (settings.arguments != null) { |
133 | courseUnitEntity = (settings.arguments as Map) | 133 | courseUnitEntity = (settings.arguments as Map) |
134 | .getOrNull('courseUnitEntity') as CourseUnitEntity; | 134 | .getOrNull('courseUnitEntity') as CourseUnitEntity; |
135 | - courseUnitDetail = (settings.arguments as Map) | ||
136 | - .getOrNull('courseUnitId'); | 135 | + courseUnitDetail = |
136 | + (settings.arguments as Map).getOrNull('courseUnitId'); | ||
137 | } | 137 | } |
138 | return CupertinoPageRoute( | 138 | return CupertinoPageRoute( |
139 | builder: (_) => SectionPage( | 139 | builder: (_) => SectionPage( |
@@ -190,12 +190,14 @@ class AppRouter { | @@ -190,12 +190,14 @@ class AppRouter { | ||
190 | return CupertinoPageRoute( | 190 | return CupertinoPageRoute( |
191 | builder: (_) => TopicPicturePage(courseLessonId: courseLessonId)); | 191 | builder: (_) => TopicPicturePage(courseLessonId: courseLessonId)); |
192 | case AppRouteName.lookVideo: | 192 | case AppRouteName.lookVideo: |
193 | - final videoUrl = (settings.arguments as Map)['videoUrl'] as String; | 193 | + final videoUrl = (settings.arguments as Map)['videoUrl'] as String?; |
194 | final title = (settings.arguments as Map)['title'] as String?; | 194 | final title = (settings.arguments as Map)['title'] as String?; |
195 | final courseLessonId = | 195 | final courseLessonId = |
196 | (settings.arguments as Map)['courseLessonId'] as String?; | 196 | (settings.arguments as Map)['courseLessonId'] as String?; |
197 | + | ||
197 | ///是否是课程内的视频环节,用于播放结束判断要不要再来一次以及下一环节用 | 198 | ///是否是课程内的视频环节,用于播放结束判断要不要再来一次以及下一环节用 |
198 | - final isTopic = (settings.arguments as Map)['isTopic'] as bool? ?? false; | 199 | + final isTopic = |
200 | + (settings.arguments as Map)['isTopic'] as bool? ?? false; | ||
199 | return CupertinoPageRoute( | 201 | return CupertinoPageRoute( |
200 | builder: (_) => LookVideoPage( | 202 | builder: (_) => LookVideoPage( |
201 | videoUrl: videoUrl, | 203 | videoUrl: videoUrl, |