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 | 61 | return BlocListener<SectionBloc, SectionState>( |
62 | 62 | listener: (context, state) async { |
63 | 63 | if (state is RequestEnterClassState) { |
64 | - if (state.courseType == SectionType.song.value && | |
64 | + if (state.courseType == SectionType.song.value || | |
65 | 65 | state.courseType == SectionType.video.value) { |
66 | 66 | var title = |
67 | 67 | state.courseType == SectionType.song.value ? 'song' : 'video'; |
... | ... | @@ -75,7 +75,7 @@ class _SectionPageView extends StatelessWidget { |
75 | 75 | .playAudio(AudioPlayerUtilType.videoTime); |
76 | 76 | } |
77 | 77 | pushNamed(AppRouteName.lookVideo, arguments: { |
78 | - 'videoUrl': "", | |
78 | + 'videoUrl': null, | |
79 | 79 | 'title': title, |
80 | 80 | 'courseLessonId': state.courseLessonId, |
81 | 81 | 'isTopic': true | ... | ... |
lib/pages/video/lookvideo/bloc/look_video_bloc.dart
... | ... | @@ -17,7 +17,7 @@ part 'look_video_state.dart'; |
17 | 17 | class LookVideoBloc extends BaseSectionBloc<BaseSectionEvent, BaseSectionState> { |
18 | 18 | |
19 | 19 | final String? _videoUrl; |
20 | - String? get videoUrl => _videoUrl ?? _entity?.videos?.videoUrl ?? ''; | |
20 | + String? get videoUrl => (_videoUrl?.isNotEmpty == true) ? _videoUrl : _entity?.videos?.videoUrl ?? ''; | |
21 | 21 | final String? _typeTitle; |
22 | 22 | String? get typeTitle => _typeTitle; |
23 | 23 | final String? _courseLessonId; | ... | ... |
lib/pages/video/lookvideo/look_video_page.dart
lib/route/route.dart
... | ... | @@ -132,8 +132,8 @@ class AppRouter { |
132 | 132 | if (settings.arguments != null) { |
133 | 133 | courseUnitEntity = (settings.arguments as Map) |
134 | 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 | 138 | return CupertinoPageRoute( |
139 | 139 | builder: (_) => SectionPage( |
... | ... | @@ -190,12 +190,14 @@ class AppRouter { |
190 | 190 | return CupertinoPageRoute( |
191 | 191 | builder: (_) => TopicPicturePage(courseLessonId: courseLessonId)); |
192 | 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 | 194 | final title = (settings.arguments as Map)['title'] as String?; |
195 | 195 | final courseLessonId = |
196 | 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 | 201 | return CupertinoPageRoute( |
200 | 202 | builder: (_) => LookVideoPage( |
201 | 203 | videoUrl: videoUrl, | ... | ... |