Commit b81332cac9a883de284377a729048504a8c873c2
1 parent
c623c7b2
feat:喇叭组件替换
Showing
2 changed files
with
32 additions
and
35 deletions
lib/pages/practice/topic_picture_page.dart
... | ... | @@ -295,17 +295,16 @@ class _TopicPicturePage extends StatelessWidget { |
295 | 295 | Row( |
296 | 296 | mainAxisAlignment: MainAxisAlignment.center, |
297 | 297 | children: [ |
298 | - GestureDetector( | |
298 | + SpeakerWidget( | |
299 | + isPlaying: bloc.voicePlayState == VoicePlayState.playing, | |
300 | + // 控制动画播放 | |
301 | + isClickable: true, | |
302 | + // 控制是否可点击 | |
303 | + width: 32.w, | |
304 | + height: 32.w, | |
299 | 305 | onTap: () { |
300 | 306 | bloc.add(VoicePlayEvent()); |
301 | 307 | }, |
302 | - child: Image.asset( | |
303 | - bloc.voicePlayState == VoicePlayState.playing | |
304 | - ? 'reade_answer'.assetGif | |
305 | - : 'voice'.assetPng, | |
306 | - height: 33.h, | |
307 | - width: 30.w, | |
308 | - ), | |
309 | 308 | ), |
310 | 309 | 10.horizontalSpace, |
311 | 310 | Text(topics?.word ?? '', |
... | ... | @@ -376,16 +375,17 @@ class _TopicPicturePage extends StatelessWidget { |
376 | 375 | return SafeArea( |
377 | 376 | child: Column( |
378 | 377 | children: [ |
379 | - GestureDetector( | |
380 | - onTap: () { | |
381 | - bloc.add(VoicePlayEvent()); | |
382 | - }, | |
383 | - child: Image.asset( | |
384 | - bloc.voicePlayState == VoicePlayState.playing | |
385 | - ? 'reade_answer'.assetGif | |
386 | - : 'voice'.assetPng, | |
387 | - height: 33.h, | |
388 | - width: 30.w)), | |
378 | + SpeakerWidget( | |
379 | + isPlaying: bloc.voicePlayState == VoicePlayState.playing, | |
380 | + // 控制动画播放 | |
381 | + isClickable: true, | |
382 | + // 控制是否可点击 | |
383 | + width: 32.w, | |
384 | + height: 32.w, | |
385 | + onTap: () { | |
386 | + bloc.add(VoicePlayEvent()); | |
387 | + }, | |
388 | + ), | |
389 | 389 | 26.verticalSpace, |
390 | 390 | SizedBox( |
391 | 391 | width: 163.w * (topics?.topicAnswerList?.length ?? 0), | ... | ... |
lib/pages/reading/reading_page.dart
... | ... | @@ -9,6 +9,7 @@ import 'package:wow_english/route/route.dart'; |
9 | 9 | import '../../common/core/app_consts.dart'; |
10 | 10 | import '../../common/core/user_util.dart'; |
11 | 11 | import '../../common/widgets/recorder_widget.dart'; |
12 | +import '../../common/widgets/speaker_widget.dart'; | |
12 | 13 | import '../../models/course_process_entity.dart'; |
13 | 14 | import '../../utils/log_util.dart'; |
14 | 15 | import 'bloc/reading_bloc.dart'; |
... | ... | @@ -156,21 +157,18 @@ class _ReadingPage extends StatelessWidget { |
156 | 157 | child: Row( |
157 | 158 | children: [ |
158 | 159 | 5.horizontalSpace, |
159 | - GestureDetector( | |
160 | + SpeakerWidget( | |
161 | + isPlaying: | |
162 | + bloc.voicePlayState == VoicePlayState.playing && | |
163 | + bloc.isOriginAudioPlaying, | |
164 | + // 控制动画播放 | |
165 | + isClickable: !bloc.isRecording, | |
166 | + // 控制是否可点击 | |
167 | + width: 42.w, | |
168 | + height: 42.w, | |
160 | 169 | onTap: () { |
161 | - if (bloc.isRecording) { | |
162 | - return; | |
163 | - } | |
164 | 170 | bloc.add(PlayOriginalAudioEvent(null)); |
165 | 171 | }, |
166 | - child: Image.asset( | |
167 | - bloc.voicePlayState == VoicePlayState.playing && | |
168 | - bloc.isOriginAudioPlaying | |
169 | - ? 'reade_answer'.assetGif | |
170 | - : 'voice'.assetPng, | |
171 | - height: 40.h, | |
172 | - width: 45.w, | |
173 | - ), | |
174 | 172 | ), |
175 | 173 | SizedBox( |
176 | 174 | width: 10.w, |
... | ... | @@ -188,17 +186,16 @@ class _ReadingPage extends StatelessWidget { |
188 | 186 | ), |
189 | 187 | RecorderWidget( |
190 | 188 | isPlaying: bloc.isRecording, |
191 | - isClickable: bloc.voicePlayState != VoicePlayState.playing, | |
189 | + isClickable: | |
190 | + bloc.voicePlayState != VoicePlayState.playing, | |
192 | 191 | width: 60.w, |
193 | 192 | height: 60.w, |
194 | 193 | onTap: () { |
195 | 194 | if (bloc.isRecording) { |
196 | 195 | bloc.add(XSVoiceStopEvent()); |
197 | 196 | } else { |
198 | - bloc.add(XSVoiceStartEvent( | |
199 | - bloc.readingContent(), | |
200 | - '0', | |
201 | - UserUtil.getUser()?.id.toString())); | |
197 | + bloc.add(XSVoiceStartEvent(bloc.readingContent(), | |
198 | + '0', UserUtil.getUser()?.id.toString())); | |
202 | 199 | } |
203 | 200 | }, |
204 | 201 | ), | ... | ... |