1dc46cf7
吴启风
feat:绘本ui
|
1
2
3
4
|
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/common/extension/string_extension.dart';
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
5
|
import 'package:wow_english/pages/reading/widgets/ReadingModeType.dart';
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
6
|
import 'package:wow_english/pages/reading/widgets/reading_dialog_widget.dart';
|
1dc46cf7
吴启风
feat:绘本ui
|
7
|
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
8
9
|
import '../../common/core/user_util.dart';
import '../../models/course_process_entity.dart';
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
10
|
import '../../utils/log_util.dart';
|
1dc46cf7
吴启风
feat:绘本ui
|
11
12
|
import 'bloc/reading_bloc.dart';
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
13
|
class ReadingPage extends StatelessWidget {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
14
15
16
|
const ReadingPage({super.key, this.courseLessonId});
final String? courseLessonId;
|
1dc46cf7
吴启风
feat:绘本ui
|
17
18
19
20
|
@override
Widget build(BuildContext context) {
return BlocProvider(
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
21
|
create: (_) => ReadingPageBloc(context, PageController(), courseLessonId ?? '')
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
22
23
|
..add(InitBlocEvent())
..add(RequestDataEvent()),
|
1dc46cf7
吴启风
feat:绘本ui
|
24
25
26
27
28
29
30
31
32
|
child: _ReadingPage(),
);
}
}
class _ReadingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocListener<ReadingPageBloc, ReadingPageState>(
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
33
|
listener: (context, state) {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
34
|
Log.d('reading BlocListener=$state');
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
35
|
if (state is RequestDataState) {
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
36
37
38
|
///刷新页面
context.read<ReadingPageBloc>().add(CurrentPageIndexChangeEvent(0));
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
39
40
41
42
43
44
45
46
|
if (state is FeedbackState) {
showDialog<ReadingDialog>(
context: context,
barrierDismissible: false,
builder: (context) {
return const ReadingDialog();
});
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
47
|
},
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
48
|
child: _readingPageView(),
|
1dc46cf7
吴启风
feat:绘本ui
|
49
50
51
|
);
}
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
52
|
Widget _readingPageView() => BlocBuilder<ReadingPageBloc, ReadingPageState>(
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
53
|
builder: (context, state) {
|
1dc46cf7
吴启风
feat:绘本ui
|
54
55
56
57
58
|
final bloc = BlocProvider.of<ReadingPageBloc>(context);
return Container(
color: Colors.white,
child: Stack(
children: [
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
59
|
PageView.builder(
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
60
|
itemCount: bloc.dataCount(),
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
61
62
63
64
65
|
controller: bloc.pageController,
onPageChanged: (int index) {
bloc.add(CurrentPageIndexChangeEvent(index));
},
itemBuilder: (context, int index) {
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
66
|
return _readingPagerItem(bloc.entity!.readings![index]);
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
}),
Container(
color: Colors.transparent,
height: 60.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding:
EdgeInsets.only(left: ScreenUtil().bottomBarHeight),
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Image.asset(
'back_around'.assetPng,
width: 40,
height: 40,
)),
),
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 27.w),
decoration: BoxDecoration(
color: const Color(0xFF00B6F1),
borderRadius: BorderRadius.circular(15.r),
border: Border.all(
width: 1.0,
color: const Color(0xFF140C10),
),
),
alignment: Alignment.center,
child: Text(
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
100
|
'${bloc.currentPage}/${bloc.dataCount()}',
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
101
102
103
104
105
|
style: TextStyle(fontSize: 20.sp, color: Colors.white),
),
),
Padding(
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
106
107
|
padding: EdgeInsets.only(
right: 15.w + ScreenUtil().bottomBarHeight),
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
child: GestureDetector(
onTap: () {
bloc.add(CurrentModeChangeEvent());
},
child: SizedBox(
height: 40.h,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('bg_reading_mode'.assetPng),
fit: BoxFit.fill),
),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Text(
bloc.currentMode == ReadingModeType.auto
? '设为手动'
: '设为自动',
style: TextStyle(fontSize: 14.5.sp),
),
),
),
),
),
// ScreenUtil().bottomBarHeight.horizontalSpace,
],
),
),
Align(
alignment: Alignment.bottomLeft,
child: Container(
color: const Color(0x4DFFFFFF),
margin: EdgeInsets.symmetric(horizontal: 10.w),
child: Row(
children: [
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
144
145
146
147
148
|
GestureDetector(
onTap: () {
if (bloc.isRecording) {
return;
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
149
150
151
|
bloc.add(PlayOriginalAudioEvent(null));
},
child: Image.asset(
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
152
153
154
155
|
bloc.voicePlayState == VoicePlayState.playing &&
bloc.isOriginAudioPlaying
? 'reade_answer'.assetGif
: 'voice'.assetPng,
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
156
157
158
|
height: 40.h,
width: 45.w,
),
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
159
160
161
162
163
164
|
),
SizedBox(
width: 10.w,
),
Expanded(
child: Text(
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
165
|
bloc.currentPageData()?.word ?? '',
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
166
167
168
169
170
171
172
173
|
style: TextStyle(
color: const Color(0xFF333333), fontSize: 21.sp),
maxLines: 2,
overflow: TextOverflow.ellipsis,
)),
SizedBox(
width: 10.w,
),
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
174
175
176
|
GestureDetector(
onTap: () {
if (bloc.isRecording) {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
177
178
179
180
181
|
bloc.add(XSVoiceStopEvent());
} else {
bloc.add(XSVoiceStartEvent(
bloc.currentPageData()?.word ?? '',
'0',
|
dae7f2fd
吴启风
feat:增加android端先声...
|
182
|
UserUtil.getUser()?.id.toString()));
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
183
|
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
184
185
|
},
child: Image.asset(
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
186
187
188
|
bloc.isRecording
? 'micro_phone'.assetGif
: 'micro_phone'.assetPng,
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
189
190
191
|
height: 47.h,
width: 47.w,
)),
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
192
193
194
|
SizedBox(
width: 10.w,
),
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
GestureDetector(
onTap: () {
if (bloc.isRecording) {
return;
}
bloc.add(PlayRecordAudioEvent());
},
child: Visibility(
visible: bloc.currentPageData()?.recordUrl != null,
child: Image.asset(
bloc.isRecordAudioPlaying
? 'record_pause'.assetWebp
: 'record_play'.assetWebp,
height: 33.h,
width: 33.w,
),
)),
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
212
|
],
|
1dc46cf7
吴启风
feat:绘本ui
|
213
|
),
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
214
|
),
|
1dc46cf7
吴启风
feat:绘本ui
|
215
216
217
218
219
220
|
)
],
),
);
});
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
221
|
Widget _readingPagerItem(CourseProcessReadings readings) =>
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
222
223
|
BlocBuilder<ReadingPageBloc, ReadingPageState>(builder: (context, state) {
return Stack(
|
1dc46cf7
吴启风
feat:绘本ui
|
224
|
children: [
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
225
226
227
228
|
Positioned.fill(
child:
Image.network(readings.picUrl ?? '', fit: BoxFit.cover),
),
|
1dc46cf7
吴启风
feat:绘本ui
|
229
230
231
232
|
],
);
});
}
|