diff --git a/assets/images/photo_pause.png b/assets/images/photo_pause.png index a339e26..d1cca72 100644 --- a/assets/images/photo_pause.png +++ b/assets/images/photo_pause.png diff --git a/lib/pages/reading/bloc/reading_bloc.dart b/lib/pages/reading/bloc/reading_bloc.dart index 071c33c..a73d087 100644 --- a/lib/pages/reading/bloc/reading_bloc.dart +++ b/lib/pages/reading/bloc/reading_bloc.dart @@ -90,20 +90,16 @@ class ReadingPageBloc extends Bloc { //音频播放器 audioPlayer = AudioPlayer(); audioPlayer.onPlayerStateChanged.listen((event) async { - debugPrint('播放状态变化'); if (event == PlayerState.completed) { - debugPrint('播放完成'); _voicePlayState = VoicePlayState.completed; _onAudioPlayComplete(); } if (event == PlayerState.stopped) { - debugPrint('播放结束'); _voicePlayState = VoicePlayState.stop; _onAudioPlayComplete(); } if (event == PlayerState.playing) { - debugPrint('正在播放中'); _voicePlayState = VoicePlayState.playing; } if (isClosed) { @@ -261,6 +257,9 @@ class ReadingPageBloc extends Bloc { } CourseProcessReadings? currentPageData() { + if ((_entity?.readings?.length??0) - 1 < _currentPage) { + return null; + } return _entity?.readings?[_currentPage]; } @@ -338,7 +337,7 @@ class ReadingPageBloc extends Bloc { nextPage(); } - Log.d("_onAudioPlayComplete _isOriginAudioPlaying=${_isOriginAudioPlaying} _voicePlayState=$_voicePlayState recordUrl=${currentPageData()?.recordUrl?.isNotEmpty}"); + Log.d("_onAudioPlayComplete _isOriginAudioPlaying=$_isOriginAudioPlaying _voicePlayState=$_voicePlayState recordUrl=${currentPageData()?.recordUrl?.isNotEmpty}"); if (_isOriginAudioPlaying && _voicePlayState == VoicePlayState.completed && currentPageData()?.recordUrl?.isNotEmpty != true) { ///如果刚刚完成原音播放&&录音为空,则开始录音 startRecord(currentPageData()?.word ?? ''); @@ -358,7 +357,7 @@ class ReadingPageBloc extends Bloc { OnXSVoiceStateChangeEvent event, Emitter emitter ) async { - emit(XSVoiceTestState()); + emitter(XSVoiceTestState()); } } diff --git a/lib/pages/reading/reading_page.dart b/lib/pages/reading/reading_page.dart index fcd0b55..0026718 100644 --- a/lib/pages/reading/reading_page.dart +++ b/lib/pages/reading/reading_page.dart @@ -118,8 +118,7 @@ class _ReadingPage extends StatelessWidget { ), Padding( - padding: EdgeInsets.only( - right: 15.w + ScreenUtil().bottomBarHeight), + padding: EdgeInsets.only(right: 15.w + ScreenUtil().bottomBarHeight), child: GestureDetector( onTap: () { bloc.add(CurrentModeChangeEvent()); @@ -233,13 +232,12 @@ class _ReadingPage extends StatelessWidget { ); }); - Widget _readingPagerItem(CourseProcessReadings readings) => - BlocBuilder(builder: (context, state) { + Widget _readingPagerItem(CourseProcessReadings readings) => BlocBuilder( + builder: (context, state) { return Stack( children: [ Positioned.fill( - child: - Image.network(readings.picUrl ?? '', fit: BoxFit.cover), + child: Image.network(readings.picUrl ?? '', fit: BoxFit.cover), ), ], );