Commit 7b87c05caf37ffb77b13fc292942bf20987cdb4e
1 parent
7be2176f
feat:进入课堂接口取消loading,因为进去后会调用课程详情接口,连着2个loading体验不好
Showing
1 changed file
with
14 additions
and
14 deletions
lib/pages/section/bloc/section_bloc.dart
| @@ -93,21 +93,21 @@ class SectionBloc extends Bloc<SectionEvent, SectionState> { | @@ -93,21 +93,21 @@ class SectionBloc extends Bloc<SectionEvent, SectionState> { | ||
| 93 | Future<void> requestEnterClass( | 93 | Future<void> requestEnterClass( |
| 94 | String courseLessonId, FutureOr<void> Function() onRequestEnterSuccess, | 94 | String courseLessonId, FutureOr<void> Function() onRequestEnterSuccess, |
| 95 | {FutureOr<void> Function(Object)? onRequestEnterFailed}) async { | 95 | {FutureOr<void> Function(Object)? onRequestEnterFailed}) async { |
| 96 | - await loading(() async { | ||
| 97 | - try { | ||
| 98 | - await ListenDao.enterClass(courseLessonId); | ||
| 99 | - await Future.sync(onRequestEnterSuccess); | ||
| 100 | - } catch (e) { | ||
| 101 | - if (e is ApiException) { | ||
| 102 | - showToast('进入课堂失败 ${e.message}'); | ||
| 103 | - } else { | ||
| 104 | - showToast('进入课堂失败 $e'); | ||
| 105 | - } | ||
| 106 | - if (onRequestEnterFailed != null) { | ||
| 107 | - await Future.sync(onRequestEnterFailed(e) as FutureOr Function()); | ||
| 108 | - } | 96 | + // await loading(() async { |
| 97 | + try { | ||
| 98 | + await ListenDao.enterClass(courseLessonId); | ||
| 99 | + await Future.sync(onRequestEnterSuccess); | ||
| 100 | + } catch (e) { | ||
| 101 | + if (e is ApiException) { | ||
| 102 | + showToast('进入课堂失败 ${e.message}'); | ||
| 103 | + } else { | ||
| 104 | + showToast('进入课堂失败 $e'); | ||
| 109 | } | 105 | } |
| 110 | - }); | 106 | + if (onRequestEnterFailed != null) { |
| 107 | + await Future.sync(onRequestEnterFailed(e) as FutureOr Function()); | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + // }); | ||
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | void _requestEndClass( | 113 | void _requestEndClass( |