Blame view

lib/pages/practice/topic_picture_page.dart 18.7 KB
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
1
2
3
  import 'package:flutter/material.dart';
  import 'package:flutter_bloc/flutter_bloc.dart';
  import 'package:flutter_screenutil/flutter_screenutil.dart';
997ea0d6   liangchengyou   feat:绘本闪退问题修复
4
  import 'package:wow_english/common/core/app_consts.dart';
e3c2820c   liangchengyou   feat:先声SDK逻辑调整
5
  import 'package:wow_english/common/core/user_util.dart';
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
6
7
  import 'package:wow_english/common/extension/string_extension.dart';
  import 'package:wow_english/common/widgets/ow_image_widget.dart';
2eb67dd4   liangchengyou   feat:调整代码
8
  import 'package:wow_english/models/course_process_entity.dart';
934e2b47   liangchengyou   feat:权限调整+课程进度接口对接
9
  import 'package:wow_english/route/route.dart';
3c1d5c64   liangchengyou   feat:练习功能完成
10
  import 'package:wow_english/utils/toast_util.dart';
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
11
12
13
14
  
  import 'bloc/topic_picture_bloc.dart';
  import 'widgets/practice_header_widget.dart';
  
3c1d5c64   liangchengyou   feat:练习功能完成
15
  class TopicPicturePage extends StatelessWidget  {
608c05b4   liangchengyou   feat:兑换课程
16
17
18
    const TopicPicturePage({super.key, this.courseLessonId});
  
    final String? courseLessonId;
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
19
20
21
22
  
    @override
    Widget build(BuildContext context) {
      return BlocProvider(
2eb67dd4   liangchengyou   feat:调整代码
23
        create: (context) => TopicPictureBloc(
3c1d5c64   liangchengyou   feat:练习功能完成
24
25
            PageController(),
            courseLessonId??'',
2eb67dd4   liangchengyou   feat:调整代码
26
        )
3c1d5c64   liangchengyou   feat:练习功能完成
27
          ..add(InitBlocEvent())
2eb67dd4   liangchengyou   feat:调整代码
28
          ..add(RequestDataEvent())
e3c2820c   liangchengyou   feat:先声SDK逻辑调整
29
30
          ..add(XSVoiceInitEvent(
              {
997ea0d6   liangchengyou   feat:绘本闪退问题修复
31
32
33
34
                'appKey':AppConsts.xsAppKey,
                'service':AppConsts.xsAppService,
                'secretKey':AppConsts.xsAppSecretKey,
                'userId':UserUtil.getUser()!.id.toString(),
e3c2820c   liangchengyou   feat:先声SDK逻辑调整
35
36
              }
          )),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
37
38
39
40
41
42
43
44
45
        child: _TopicPicturePage(),
      );
    }
  }
  
  class _TopicPicturePage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return BlocListener<TopicPictureBloc,TopicPictureState>(
2eb67dd4   liangchengyou   feat:调整代码
46
47
        listener: (context, state){
          if (state is RequestDataState) {
608c05b4   liangchengyou   feat:兑换课程
48
            context.read<TopicPictureBloc>().add(CurrentPageIndexChangeEvent(0));
e3c2820c   liangchengyou   feat:先声SDK逻辑调整
49
          }
e3c2820c   liangchengyou   feat:先声SDK逻辑调整
50
51
          if (state is XSVoiceTestState) {
  
2eb67dd4   liangchengyou   feat:调整代码
52
53
          }
        },
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
54
55
56
57
58
        child: _topicPictureView(),
      );
    }
  
    Widget _topicPictureView() => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
59
60
61
62
63
64
65
66
67
        builder: (context,state){
          final bloc = BlocProvider.of<TopicPictureBloc>(context);
          return Container(
            color: Colors.white,
            child: Stack(
              children: [
                Column(
                  children: [
                    PracticeHeaderWidget(
2eb67dd4   liangchengyou   feat:调整代码
68
                      title: '${bloc.currentPage}/${bloc.entity?.topics?.length}',
b90a1518   liangchengyou   feat:练习接口逻辑完成
69
                      onTap: () {
934e2b47   liangchengyou   feat:权限调整+课程进度接口对接
70
71
72
                        popPage(
                            data:{
                              'currentStep':bloc.currentPage.toString(),
56e2ae5a   liangchengyou   feat:绘本添加回调数据
73
                              'courseLessonId':bloc.courseLessonId
934e2b47   liangchengyou   feat:权限调整+课程进度接口对接
74
75
                            });
                        // Navigator.pop(context);
e3c2820c   liangchengyou   feat:先声SDK逻辑调整
76
                        },
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
77
78
79
                    ),
                    Expanded(
                      child: PageView.builder(
2eb67dd4   liangchengyou   feat:调整代码
80
                          itemCount: bloc.entity?.topics?.length,
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
81
82
83
84
85
86
                          scrollDirection: Axis.horizontal,
                          controller: bloc.pageController,
                          onPageChanged: (int index) {
                            bloc.add(CurrentPageIndexChangeEvent(index));
                          },
                          itemBuilder: (BuildContext context,int index){
2eb67dd4   liangchengyou   feat:调整代码
87
88
89
90
91
92
93
94
95
96
97
                            CourseProcessTopics? topics = bloc.entity?.topics![index];
                            if (topics?.type == 1) {//听音选图
                              return _pageViewVoicePictureItemWidget(topics);
                            } else if (topics?.type == 2) {//听音选字
                              return _pageViewVoiceWordItemWidget(topics);
                            } else if (topics?.type == 3) {//看题选字
                              return _pageViewWordItemWidget(topics);
                            } else if (topics?.type == 4) {//看题选图
                              return _pageViewItemWidget(topics);
                            } else {//语音问答
                              return _voiceAnswerItem(topics);
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
                            }
                          }),
                    )
                  ],
                ),
                Positioned(
                    left: 0,
                    right: 0,
                    bottom: 0,
                    child: Image.asset('bottom_grass'.assetPng)
                )
              ],
            ),
          );
        });
  
    ///看题选图
2eb67dd4   liangchengyou   feat:调整代码
115
    Widget _pageViewItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
116
        builder: (context, state){
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
117
118
119
120
          return SafeArea(
            child: Column(
              children: [
                Text(
b90a1518   liangchengyou   feat:练习接口逻辑完成
121
                    topics?.word??'',
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
122
123
124
125
126
127
128
                    softWrap: true,
                    style: TextStyle(
                        fontSize: 21.sp,
                        color: const Color(0xFF333333)
                    )
                ),
                26.verticalSpace,
2eb67dd4   liangchengyou   feat:调整代码
129
130
131
132
                SizedBox(
                  height: 143.h,
                  width: 143.w * (topics?.topicAnswerList?.length??0),
                  child: ListView.builder(
2eb67dd4   liangchengyou   feat:调整代码
133
                      scrollDirection: Axis.horizontal,
b90a1518   liangchengyou   feat:练习接口逻辑完成
134
135
                      physics: const NeverScrollableScrollPhysics(),
                      itemCount: topics?.topicAnswerList?.length??0,
2eb67dd4   liangchengyou   feat:调整代码
136
                      itemBuilder: (context,index){
b90a1518   liangchengyou   feat:练习接口逻辑完成
137
                        return _decodeImageWidget(index,topics?.topicAnswerList?[index]);
2eb67dd4   liangchengyou   feat:调整代码
138
139
                      }),
                ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
140
141
142
143
144
              ],
            ),
          );
        });
  
b90a1518   liangchengyou   feat:练习接口逻辑完成
145
    Widget _decodeImageWidget(int index,CourseProcessTopicsTopicAnswerList? answerLis) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
146
147
148
        buildWhen: (_, s) => s is SelectItemChangeState,
        builder: (context,state){
          final bloc = BlocProvider.of<TopicPictureBloc>(context);
2eb67dd4   liangchengyou   feat:调整代码
149
150
151
152
          return Container(
            padding: EdgeInsets.symmetric(horizontal: 10.w),
            child: GestureDetector(
              onTap: () => bloc.add(SelectItemEvent(index)),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
153
              child: Container(
2eb67dd4   liangchengyou   feat:调整代码
154
                padding: const EdgeInsets.all(4.5),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
155
                decoration: BoxDecoration(
2eb67dd4   liangchengyou   feat:调整代码
156
157
158
159
160
161
162
163
164
165
166
167
168
                  color: bloc.selectItem == index?const Color(0xFF00B6F1):Colors.white,
                  borderRadius: BorderRadius.circular(15),
                ),
                height: 143.h,
                width: 143.w,
                child: Container(
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(15),
                      border: Border.all(
                          width: 1.0,
                          color: const Color(0xFF140C10)
                      ),
b90a1518   liangchengyou   feat:练习接口逻辑完成
169
                      image: DecorationImage(
2eb67dd4   liangchengyou   feat:调整代码
170
                          fit: BoxFit.fitWidth,
b90a1518   liangchengyou   feat:练习接口逻辑完成
171
                          image: NetworkImage(answerLis?.picUrl??'')
2eb67dd4   liangchengyou   feat:调整代码
172
173
                      )
                  ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
174
175
176
177
178
179
180
                ),
              ),
            ),
          );
        });
  
    ///看题选字
2eb67dd4   liangchengyou   feat:调整代码
181
    Widget _pageViewWordItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
182
        builder: (context, state){
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
183
184
185
186
          return SafeArea(
            child: Column(
              children: [
                Text(
b90a1518   liangchengyou   feat:练习接口逻辑完成
187
                    topics?.word??'',
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
188
189
190
191
192
193
194
                    softWrap: true,
                    style: TextStyle(
                        fontSize: 21.sp,
                        color: const Color(0xFF333333)
                    )
                ),
                26.verticalSpace,
2eb67dd4   liangchengyou   feat:调整代码
195
196
197
198
                SizedBox(
                  height: 143.h,
                  width: 143.w * (topics?.topicAnswerList?.length??0),
                  child: ListView.builder(
2eb67dd4   liangchengyou   feat:调整代码
199
                      scrollDirection: Axis.horizontal,
b90a1518   liangchengyou   feat:练习接口逻辑完成
200
201
                      itemCount: topics?.topicAnswerList?.length??0,
                      physics: const NeverScrollableScrollPhysics(),
2eb67dd4   liangchengyou   feat:调整代码
202
                      itemBuilder: (context,index){
b90a1518   liangchengyou   feat:练习接口逻辑完成
203
                        return _decodeWordWidget(index,topics?.topicAnswerList?[index]);
2eb67dd4   liangchengyou   feat:调整代码
204
205
                      }),
                ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
206
207
208
209
210
              ],
            ),
          );
        });
  
b90a1518   liangchengyou   feat:练习接口逻辑完成
211
    Widget _decodeWordWidget(int index,CourseProcessTopicsTopicAnswerList? answerLis) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
212
213
214
        buildWhen: (_, s) => s is SelectItemChangeState,
        builder: (context,state){
          final bloc = BlocProvider.of<TopicPictureBloc>(context);
2eb67dd4   liangchengyou   feat:调整代码
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
          return Container(
            padding: EdgeInsets.symmetric(horizontal: 10.w),
            child: GestureDetector(
              onTap: () => bloc.add(SelectItemEvent(index)),
              child: Container(
                width: 143.w,
                height: 143.h,
                padding: EdgeInsets.only(left: 13.w,right: 13.w,top: 13.h,bottom: 13.h),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(15),
                  border: Border.all(
                      width: 1.0,
                      color: const Color(0xFF140C10)
                  ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
230
                ),
2eb67dd4   liangchengyou   feat:调整代码
231
232
233
234
235
236
237
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: [
                    Expanded(
                      child: Container(
                        alignment: Alignment.center,
                        child: Text(
b90a1518   liangchengyou   feat:练习接口逻辑完成
238
                            answerLis?.word??'',
2eb67dd4   liangchengyou   feat:调整代码
239
240
241
242
243
                            style: TextStyle(
                                fontSize: 20.sp,
                                color: const Color(0xFF333333)
                            )
                        ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
244
245
                      ),
                    ),
2eb67dd4   liangchengyou   feat:调整代码
246
247
248
249
250
251
252
253
254
255
                    Container(
                      height: 30.h,
                      width: double.infinity,
                      decoration: BoxDecoration(
                        color: bloc.selectItem == index?const Color(0xFF00B6F1):Colors.white,
                        borderRadius: BorderRadius.circular(15.r),
                        border: Border.all(
                            width: 1.5,
                            color: const Color(0xFF140C10)
                        ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
256
                      ),
2eb67dd4   liangchengyou   feat:调整代码
257
258
259
260
261
                      alignment: Alignment.center,
                      child: Image.asset('choose'.assetPng),
                    )
                  ],
                ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
262
263
264
265
266
267
              ),
            ),
          );
        });
  
    ///听音选图
2eb67dd4   liangchengyou   feat:调整代码
268
    Widget _pageViewVoicePictureItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
269
        builder: (context, state){
3c1d5c64   liangchengyou   feat:练习功能完成
270
          final bloc = BlocProvider.of<TopicPictureBloc>(context);
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
271
272
273
274
275
276
          return SafeArea(
            child: Column(
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
3c1d5c64   liangchengyou   feat:练习功能完成
277
278
279
280
281
282
283
284
285
286
                    GestureDetector(
                      onTap: () {
                        bloc.add(VoicePlayEvent());
                      },
                      child: Image.asset(
                        bloc.voicePlayState == VoicePlayState.playing?'reade_answer'.assetGif:'voice'.assetPng,
                        height: 33.h,
                        width: 30.w,
                      ),
                    ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
287
288
                    10.horizontalSpace,
                    Text(
b90a1518   liangchengyou   feat:练习接口逻辑完成
289
                        topics?.word??'',
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
290
291
292
293
294
295
296
297
                        style: TextStyle(
                            fontSize: 20.sp,
                            color: const Color(0xFF333333)
                        )
                    )
                  ],
                ),
                26.verticalSpace,
2eb67dd4   liangchengyou   feat:调整代码
298
299
300
301
302
                SizedBox(
                  height: 143.h,
                  width: 163.w * (topics?.topicAnswerList?.length??0),
                  child: ListView.builder(
                      scrollDirection: Axis.horizontal,
b90a1518   liangchengyou   feat:练习接口逻辑完成
303
                      physics: const NeverScrollableScrollPhysics(),
2eb67dd4   liangchengyou   feat:调整代码
304
305
                      itemCount: topics?.topicAnswerList?.length??0,
                      itemBuilder: (BuildContext context,int index){
b90a1518   liangchengyou   feat:练习接口逻辑完成
306
                        return _decodeVoiceImageWidget(index,topics?.topicAnswerList?[index]);
2eb67dd4   liangchengyou   feat:调整代码
307
308
                      })
                  ,
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
309
310
311
312
313
314
                )
              ],
            ),
          );
        });
  
2eb67dd4   liangchengyou   feat:调整代码
315
    Widget _decodeVoiceImageWidget(int index,CourseProcessTopicsTopicAnswerList? answerList) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
316
317
318
        buildWhen: (_, s) => s is SelectItemChangeState,
        builder: (context,state){
          final bloc = BlocProvider.of<TopicPictureBloc>(context);
2eb67dd4   liangchengyou   feat:调整代码
319
320
321
322
          return Container(
            padding:  EdgeInsets.symmetric(horizontal: 10.w),
            child: GestureDetector(
              onTap: () => bloc.add(SelectItemEvent(index)),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
323
              child: Container(
2eb67dd4   liangchengyou   feat:调整代码
324
                padding: const EdgeInsets.all(4.5),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
325
                decoration: BoxDecoration(
2eb67dd4   liangchengyou   feat:调整代码
326
327
328
329
330
331
332
333
334
335
336
337
338
                  color: bloc.selectItem == index?const Color(0xFF00B6F1):Colors.white,
                  borderRadius: BorderRadius.circular(15),
                ),
                height: 143.h,
                width: 143.w,
                child: Container(
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(15),
                      border: Border.all(
                          width: 1.0,
                          color: const Color(0xFF140C10)
                      ),
b90a1518   liangchengyou   feat:练习接口逻辑完成
339
                      image: DecorationImage(
2eb67dd4   liangchengyou   feat:调整代码
340
                          fit: BoxFit.fitWidth,
b90a1518   liangchengyou   feat:练习接口逻辑完成
341
                          image: NetworkImage(answerList?.picUrl??'')
2eb67dd4   liangchengyou   feat:调整代码
342
343
                      )
                  ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
344
345
346
347
348
349
350
                ),
              ),
            ),
          );
        });
  
    ///听音选字
2eb67dd4   liangchengyou   feat:调整代码
351
    Widget _pageViewVoiceWordItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
352
        builder: (context, state){
3c1d5c64   liangchengyou   feat:练习功能完成
353
          final bloc = BlocProvider.of<TopicPictureBloc>(context);
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
354
355
356
          return SafeArea(
            child: Column(
              children: [
3c1d5c64   liangchengyou   feat:练习功能完成
357
358
359
360
361
362
363
364
365
366
                GestureDetector(
                  onTap: () {
                    bloc.add(VoicePlayEvent());
                  },
                  child: Image.asset(
                    bloc.voicePlayState == VoicePlayState.playing?'reade_answer'.assetGif:'voice'.assetPng,
                    height: 33.h,
                    width: 30.w
                  )
                ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
367
                26.verticalSpace,
2eb67dd4   liangchengyou   feat:调整代码
368
369
370
371
                SizedBox(
                  width: 163.w * (topics?.topicAnswerList?.length??0),
                  height: 143.h,
                  child: ListView.builder(
2eb67dd4   liangchengyou   feat:调整代码
372
                      scrollDirection: Axis.horizontal,
b90a1518   liangchengyou   feat:练习接口逻辑完成
373
374
                      itemCount: topics?.topicAnswerList?.length,
                      physics: const NeverScrollableScrollPhysics(),
2eb67dd4   liangchengyou   feat:调整代码
375
376
377
378
                      itemBuilder: (BuildContext context,int index){
                        return _decodeVoiceWordImageWidget(index, topics!.topicAnswerList![index]);
                      }),
                ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
379
380
381
382
383
              ],
            ),
          );
        });
  
2eb67dd4   liangchengyou   feat:调整代码
384
    Widget _decodeVoiceWordImageWidget(int index,CourseProcessTopicsTopicAnswerList answerList) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
385
386
387
388
389
390
        buildWhen: (_, s) => s is SelectItemChangeState,
        builder: (context,state){
          final bloc = BlocProvider.of<TopicPictureBloc>(context);
          return GestureDetector(
            onTap: () => bloc.add(SelectItemEvent(index)),
            child: Container(
2eb67dd4   liangchengyou   feat:调整代码
391
              width: 163.w,
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
392
              height: 143.h,
2eb67dd4   liangchengyou   feat:调整代码
393
394
395
396
397
398
399
400
401
402
403
404
              padding: EdgeInsets.symmetric(horizontal: 10.w),
              child: Container(
                width: 143.w,
                height: 143.h,
                padding: EdgeInsets.only(left: 13.w,right: 13.w,top: 13.h,bottom: 13.h),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(15),
                  border: Border.all(
                      width: 1.0,
                      color: const Color(0xFF140C10)
                  ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
405
                ),
2eb67dd4   liangchengyou   feat:调整代码
406
407
408
409
410
411
412
413
414
415
416
417
418
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: [
                    Expanded(
                      child: Container(
                        alignment: Alignment.center,
                        child: Text(
                            answerList.word??'',
                            style: TextStyle(
                                fontSize: 20.sp,
                                color: const Color(0xFF333333)
                            )
                        ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
419
420
                      ),
                    ),
2eb67dd4   liangchengyou   feat:调整代码
421
422
423
424
425
426
427
428
429
430
                    Container(
                      height: 30.h,
                      width: double.infinity,
                      decoration: BoxDecoration(
                        color: bloc.selectItem == index?const Color(0xFF00B6F1):Colors.white,
                        borderRadius: BorderRadius.circular(15.r),
                        border: Border.all(
                            width: 1.5,
                            color: const Color(0xFF140C10)
                        ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
431
                      ),
2eb67dd4   liangchengyou   feat:调整代码
432
433
434
435
436
                      alignment: Alignment.center,
                      child: Image.asset('choose'.assetPng),
                    )
                  ],
                ),
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
437
438
439
440
441
442
              ),
            ),
          );
        });
  
    ///语音问答
2eb67dd4   liangchengyou   feat:调整代码
443
    Widget _voiceAnswerItem(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
444
        builder: (context, state) {
2eb67dd4   liangchengyou   feat:调整代码
445
          final bloc = BlocProvider.of<TopicPictureBloc>(context);
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
446
          return Row(
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
447
448
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
2eb67dd4   liangchengyou   feat:调整代码
449
              OwImageWidget(
b90a1518   liangchengyou   feat:练习接口逻辑完成
450
                name:topics?.picUrl??'',
2eb67dd4   liangchengyou   feat:调整代码
451
452
                height: 186.h,
                width: 186.w,
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
453
              ),
2eb67dd4   liangchengyou   feat:调整代码
454
455
456
457
              160.horizontalSpace,
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
3c1d5c64   liangchengyou   feat:练习功能完成
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
                  GestureDetector(
                    onTap: () {
                      if (bloc.isVoicing) {
                        showToast('正在录音,不能终止');
                        return;
                      }
                      bloc.add(VoicePlayEvent());
                    },
                    child: Row(
                      children: [
                        Image.asset(
                          bloc.voicePlayState == VoicePlayState.playing?'reade_answer'.assetGif:'voice'.assetPng,
                          height: 52.h,
                          width: 46.w,
                        ),
                        10.horizontalSpace,
                        Text(topics?.word??'')
                      ],
                    ),
2eb67dd4   liangchengyou   feat:调整代码
477
478
479
480
                  ),
                  70.verticalSpace,
                  GestureDetector(
                    onTap: () {
3c1d5c64   liangchengyou   feat:练习功能完成
481
482
483
484
485
                      if (bloc.voicePlayState == VoicePlayState.playing) {
                        showToast('正在播放音屏,不能终止');
                        return;
                      }
  
2eb67dd4   liangchengyou   feat:调整代码
486
487
488
                      if (bloc.isVoicing) {
                        return;
                      }
3c1d5c64   liangchengyou   feat:练习功能完成
489
                      if (topics?.type == 5 || topics?.type == 7) {
b90a1518   liangchengyou   feat:练习接口逻辑完成
490
491
492
493
                        bloc.add(XSVoiceTestEvent(topics?.keyWord??'', '0',UserUtil.getUser()!.id.toString()));
                      } else {
                        bloc.add(XSVoiceTestEvent(topics?.word??'', '0',UserUtil.getUser()!.id.toString()));
                      }
2eb67dd4   liangchengyou   feat:调整代码
494
495
                    },
                    child: Image.asset(
3c1d5c64   liangchengyou   feat:练习功能完成
496
                      bloc.isVoicing?'micro_phone'.assetGif:'micro_phone'.assetPng,
2eb67dd4   liangchengyou   feat:调整代码
497
498
499
500
501
                      height: 75.w,
                      width: 75.w,
                    ),
                  )
                ],
842b7132   liangchengyou   feat:磨耳朵/练习页面调整
502
503
              )
            ],
2eb67dd4   liangchengyou   feat:调整代码
504
505
          );
        });
da82bd70   Key   feat: user_inform...
506
  }