Commit 22d640e471dbe94ee26ae07c9ee91fac7fbf972c

Authored by 吴启风
1 parent b816d5d6

feat:磨耳朵点击不请求接口

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