Commit 22d640e471dbe94ee26ae07c9ee91fac7fbf972c
1 parent
b816d5d6
feat:磨耳朵点击不请求接口
Showing
4 changed files
with
16 additions
and
16 deletions
lib/pages/listen/listen_page.dart
| ... | ... | @@ -23,9 +23,7 @@ class _ListenPageView extends StatelessWidget { | 
| 23 | 23 | @override | 
| 24 | 24 | Widget build(BuildContext context) { | 
| 25 | 25 | return BlocListener<ListenBloc, ListenState>( | 
| 26 | - listener: (context, state) { | |
| 27 | - | |
| 28 | - }, | |
| 26 | + listener: (context, state) {}, | |
| 29 | 27 | child: Scaffold( | 
| 30 | 28 | appBar: const WEAppBar( | 
| 31 | 29 | titleText: '磨耳朵', | 
| ... | ... | @@ -36,20 +34,24 @@ class _ListenPageView extends StatelessWidget { | 
| 36 | 34 | ); | 
| 37 | 35 | } | 
| 38 | 36 | |
| 39 | - Widget _listenView() => BlocBuilder<ListenBloc, ListenState>( | |
| 40 | - builder: (context, state) { | |
| 37 | + Widget _listenView() => | |
| 38 | + BlocBuilder<ListenBloc, ListenState>(builder: (context, state) { | |
| 41 | 39 | final bloc = BlocProvider.of<ListenBloc>(context); | 
| 42 | 40 | return ListView.builder( | 
| 43 | 41 | itemCount: bloc.listData.length, | 
| 44 | 42 | scrollDirection: Axis.horizontal, | 
| 45 | - padding: EdgeInsets.symmetric(horizontal: 30.w,vertical: 36.h), | |
| 46 | - itemBuilder: (BuildContext context,int index){ | |
| 43 | + padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 36.h), | |
| 44 | + itemBuilder: (BuildContext context, int index) { | |
| 47 | 45 | final entity = bloc.listData[index]; | 
| 48 | 46 | return ListenItemWidget( | 
| 49 | 47 | entity: entity, | 
| 50 | - clickEvent: (){ | |
| 51 | - Navigator.of(context).pushNamed(AppRouteName.lookVideo,arguments: {'videoUrl':entity?.videoUrl,'title':'listen'}); | |
| 48 | + clickEvent: () { | |
| 49 | + Navigator.of(context).pushNamed(AppRouteName.lookVideo, | |
| 50 | + arguments: { | |
| 51 | + 'videoUrl': entity?.videoUrl, | |
| 52 | + 'title': 'listen' | |
| 53 | + }); | |
| 52 | 54 | }); | 
| 53 | 55 | }); | 
| 54 | 56 | }); | 
| 55 | -} | |
| 56 | 57 | \ No newline at end of file | 
| 58 | +} | ... | ... | 
lib/pages/section/section_page.dart
| ... | ... | @@ -16,9 +16,7 @@ import 'package:wow_english/utils/audio_player_util.dart'; | 
| 16 | 16 | import 'package:wow_english/utils/toast_util.dart'; | 
| 17 | 17 | |
| 18 | 18 | import '../../models/course_section_entity.dart'; | 
| 19 | -import '../../utils/log_util.dart'; | |
| 20 | 19 | import 'bloc/section_bloc.dart'; | 
| 21 | -import 'courese_module_model.dart'; | |
| 22 | 20 | |
| 23 | 21 | /// 环节(课程)列表页 | 
| 24 | 22 | class SectionPage extends StatelessWidget { | 
| ... | ... | @@ -81,7 +79,6 @@ class _SectionPageView extends StatelessWidget { | 
| 81 | 79 | () async { | 
| 82 | 80 | ///播放音乐->调进入课程接口->跳转课程页面 | 
| 83 | 81 | await bloc.requestEnterClass(courseLessonId, () { | 
| 84 | - Log.d("WQF request finish"); | |
| 85 | 82 | pushNamed(AppRouteName.lookVideo, arguments: { | 
| 86 | 83 | 'videoUrl': null, | 
| 87 | 84 | 'title': title, | 
| ... | ... | @@ -100,7 +97,6 @@ class _SectionPageView extends StatelessWidget { | 
| 100 | 97 | .playAudio(AudioPlayerUtilType.countWithMe); | 
| 101 | 98 | }); | 
| 102 | 99 | }, onRequestEnterFailed: (error) { | 
| 103 | - Log.d("WQF requestEnterClass failed $error"); | |
| 104 | 100 | }); | 
| 105 | 101 | }); | 
| 106 | 102 | return; | ... | ... | 
lib/pages/video/lookvideo/bloc/look_video_bloc.dart
| ... | ... | @@ -42,6 +42,10 @@ class LookVideoBloc extends BaseSectionBloc<BaseSectionEvent, BaseSectionState> | 
| 42 | 42 | ///请求数据 | 
| 43 | 43 | void _requestData( | 
| 44 | 44 | RequestDataEvent event, Emitter<BaseSectionState> emitter) async { | 
| 45 | + if (!_isTopic) { | |
| 46 | + ///只有练习场景才需要请求数据 | |
| 47 | + return; | |
| 48 | + } | |
| 45 | 49 | try { | 
| 46 | 50 | await loading(() async { | 
| 47 | 51 | _entity = await ListenDao.process(courseLessonId); | ... | ... | 
lib/pages/video/lookvideo/look_video_page.dart
| ... | ... | @@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; | 
| 3 | 3 | import 'package:wow_english/pages/section/subsection/base_section/state.dart'; | 
| 4 | 4 | import 'package:wow_english/pages/video/lookvideo/bloc/look_video_bloc.dart'; | 
| 5 | 5 | import 'package:wow_english/pages/video/lookvideo/widgets/video_widget.dart'; | 
| 6 | -import 'package:wow_english/utils/log_util.dart'; | |
| 7 | 6 | |
| 8 | 7 | class LookVideoPage extends StatelessWidget { | 
| 9 | 8 | const LookVideoPage( | 
| ... | ... | @@ -34,7 +33,6 @@ Widget _buildPage(BuildContext context) { | 
| 34 | 33 | return BlocBuilder<LookVideoBloc, BaseSectionState>( | 
| 35 | 34 | builder: (context, state) { | 
| 36 | 35 | final bloc = BlocProvider.of<LookVideoBloc>(context); | 
| 37 | - Log.d("WQF lookvideo BlocBuilder bloc.videoUr=${bloc.videoUrl}"); | |
| 38 | 36 | return Center( | 
| 39 | 37 | child: bloc.videoUrl?.isNotEmpty == true | 
| 40 | 38 | ? Container( | ... | ... | 
