Blame view

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