Commit b90a1518bad80adb31be3f058759242e5f0d6021
1 parent
e3c2820c
feat:练习接口逻辑完成
Showing
5 changed files
with
87 additions
and
51 deletions
ios/Runner/XSMessageMehtodChannel.swift
@@ -21,16 +21,18 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { | @@ -21,16 +21,18 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { | ||
21 | 21 | ||
22 | //配置评测信息 | 22 | //配置评测信息 |
23 | func setEvaluateConfig(dict:Dictionary<String, Any>) { | 23 | func setEvaluateConfig(dict:Dictionary<String, Any>) { |
24 | - let appKey = dict["appKey"] as? String | ||
25 | - let secretKey = dict["secretKey"] as? String | ||
26 | - let userId = dict.keys.contains("userId") ? dict["userId"] as! String:"" | ||
27 | - let frontTime = dict["frontTime"] as? TimeInterval | ||
28 | - let backTime = dict["frontTime"] as? TimeInterval | 24 | + let appKey = dict["appKey"] as? String ?? "" |
25 | + let secretKey = dict["secretKey"] as? String ?? "" | ||
26 | + let userId = dict["userId"] as? String ?? "guest" | ||
27 | + let frontTime = dict["frontTime"] as? String ?? "3" | ||
28 | + let backTime = dict["frontTime"] as? String ?? "3" | ||
29 | let config = SSOralEvaluatingManagerConfig.init() | 29 | let config = SSOralEvaluatingManagerConfig.init() |
30 | + config.vad = true | ||
31 | + config.isOutputLog = false | ||
30 | config.appKey = appKey //"a418" | 32 | config.appKey = appKey //"a418" |
31 | config.secretKey = secretKey //"1a16f31f2611bf32fb7b3fc38f5b2c81"' | 33 | config.secretKey = secretKey //"1a16f31f2611bf32fb7b3fc38f5b2c81"' |
32 | - config.frontTime = frontTime ?? 3 | ||
33 | - config.backTime = backTime ?? 3 | 34 | + config.frontTime = Double(frontTime)! |
35 | + config.backTime = Double(backTime)! | ||
34 | SSOralEvaluatingManager.register(config) | 36 | SSOralEvaluatingManager.register(config) |
35 | SSOralEvaluatingManager.share().register(.line, userId: userId) | 37 | SSOralEvaluatingManager.share().register(.line, userId: userId) |
36 | SSOralEvaluatingManager.share().delegate = self | 38 | SSOralEvaluatingManager.share().delegate = self |
@@ -38,12 +40,12 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { | @@ -38,12 +40,12 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { | ||
38 | 40 | ||
39 | //开始评测 | 41 | //开始评测 |
40 | func evaluateVioce(dict:Dictionary<String, Any>) { | 42 | func evaluateVioce(dict:Dictionary<String, Any>) { |
41 | - let text = dict["word"] as! String | ||
42 | - let type = dict["type"] as! Int | ||
43 | - let userId = dict["userId"] as! String | 43 | + let text = dict["word"] as? String ?? "" |
44 | + let type = dict["type"] as? String ?? "0" | ||
45 | + let userId = dict["userId"] as? String ?? "guest" | ||
44 | let config = SSOralEvaluatingConfig() | 46 | let config = SSOralEvaluatingConfig() |
45 | config.oralContent = text | 47 | config.oralContent = text |
46 | - if (type == 0) { | 48 | + if (type == "0") { |
47 | config.oralType = .word | 49 | config.oralType = .word |
48 | } else { | 50 | } else { |
49 | config.oralType = .sentence | 51 | config.oralType = .sentence |
@@ -79,7 +81,7 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { | @@ -79,7 +81,7 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { | ||
79 | */ | 81 | */ |
80 | func oralEvaluatingDidStart() { | 82 | func oralEvaluatingDidStart() { |
81 | print("评测开始") | 83 | print("评测开始") |
82 | - messageChannel!.invokeMethod("voiceStart", arguments: nil) | 84 | +// messageChannel!.invokeMethod("voiceStart", arguments: nil) |
83 | } | 85 | } |
84 | 86 | ||
85 | /** | 87 | /** |
@@ -87,7 +89,7 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { | @@ -87,7 +89,7 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { | ||
87 | */ | 89 | */ |
88 | func oralEvaluatingDidStop() { | 90 | func oralEvaluatingDidStop() { |
89 | print("评测结束") | 91 | print("评测结束") |
90 | - messageChannel!.invokeMethod("voiceEnd",arguments: nil) | 92 | +// messageChannel!.invokeMethod("voiceEnd",arguments: nil) |
91 | } | 93 | } |
92 | 94 | ||
93 | /** | 95 | /** |
lib/pages/home/home_page.dart
@@ -37,7 +37,8 @@ class _HomePageView extends StatelessWidget { | @@ -37,7 +37,8 @@ class _HomePageView extends StatelessWidget { | ||
37 | } else if (type == HeaderActionType.shop) { | 37 | } else if (type == HeaderActionType.shop) { |
38 | Navigator.of(AppRouter.context).pushNamed(AppRouteName.shop); | 38 | Navigator.of(AppRouter.context).pushNamed(AppRouteName.shop); |
39 | } else if (type == HeaderActionType.user) { | 39 | } else if (type == HeaderActionType.user) { |
40 | - Navigator.of(AppRouter.context).pushNamed(AppRouteName.user); | 40 | + // Navigator.of(AppRouter.context).pushNamed(AppRouteName.user); |
41 | + Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicPic); | ||
41 | } else { | 42 | } else { |
42 | // Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicPic); | 43 | // Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicPic); |
43 | } | 44 | } |
lib/pages/practice/bloc/topic_picture_bloc.dart
@@ -50,17 +50,38 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { | @@ -50,17 +50,38 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { | ||
50 | //音频播放器 | 50 | //音频播放器 |
51 | audioPlayer = AudioPlayer(); | 51 | audioPlayer = AudioPlayer(); |
52 | audioPlayer.onPlayerStateChanged.listen((event) { | 52 | audioPlayer.onPlayerStateChanged.listen((event) { |
53 | - if (event == PlayerState.stopped) { | 53 | + if (event == PlayerState.completed) { |
54 | + if (kDebugMode) { | ||
55 | + print('播放完成'); | ||
54 | 56 | ||
55 | - } | 57 | + }} |
56 | }); | 58 | }); |
57 | 59 | ||
58 | 60 | ||
59 | methodChannel = const MethodChannel('wow_english/sing_sound_method_channely'); | 61 | methodChannel = const MethodChannel('wow_english/sing_sound_method_channely'); |
60 | - methodChannel.invokeMethod('initVoiceSdk',{}); | ||
61 | methodChannel.setMethodCallHandler((call) async { | 62 | methodChannel.setMethodCallHandler((call) async { |
62 | - if (call.method == 'voiceResult') {//评测结束 | 63 | + if (call.method == 'voiceResult') {//评测结果 |
63 | add(XSVoiceResultEvent(call.arguments)); | 64 | add(XSVoiceResultEvent(call.arguments)); |
65 | + return; | ||
66 | + } | ||
67 | + | ||
68 | + if (call.method == 'voiceStart') {//评测开始 | ||
69 | + if (kDebugMode) { | ||
70 | + print('评测开始'); | ||
71 | + } | ||
72 | + return; | ||
73 | + } | ||
74 | + | ||
75 | + if (call.method == 'voiceEnd') {//评测结束 | ||
76 | + if (kDebugMode) { | ||
77 | + print('评测结束'); | ||
78 | + } | ||
79 | + return; | ||
80 | + } | ||
81 | + | ||
82 | + if (call.method == 'voiceFail') {//评测失败 | ||
83 | + EasyLoading.showToast('评测失败'); | ||
84 | + return; | ||
64 | } | 85 | } |
65 | }); | 86 | }); |
66 | }); | 87 | }); |
@@ -96,7 +117,8 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { | @@ -96,7 +117,8 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { | ||
96 | void _pageControllerChange(CurrentPageIndexChangeEvent event,Emitter<TopicPictureState> emitter) async { | 117 | void _pageControllerChange(CurrentPageIndexChangeEvent event,Emitter<TopicPictureState> emitter) async { |
97 | _currentPage = event.pageIndex; | 118 | _currentPage = event.pageIndex; |
98 | final topics = _entity?.topics?[_currentPage]; | 119 | final topics = _entity?.topics?[_currentPage]; |
99 | - if (topics?.type == 1 || topics?.type == 2) { | 120 | + if (topics?.type == 1 || topics?.type == 2 || topics?.type == 5) { |
121 | + audioPlayer.stop(); | ||
100 | if (topics?.audioUrl != null) { | 122 | if (topics?.audioUrl != null) { |
101 | final urlStr = topics?.audioUrl??''; | 123 | final urlStr = topics?.audioUrl??''; |
102 | if (urlStr.isNotEmpty) { | 124 | if (urlStr.isNotEmpty) { |
@@ -106,6 +128,7 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { | @@ -106,6 +128,7 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { | ||
106 | } else { | 128 | } else { |
107 | audioPlayer.stop(); | 129 | audioPlayer.stop(); |
108 | } | 130 | } |
131 | + _selectItem = -1; | ||
109 | emitter(CurrentPageIndexState()); | 132 | emitter(CurrentPageIndexState()); |
110 | } | 133 | } |
111 | 134 | ||
@@ -119,7 +142,7 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { | @@ -119,7 +142,7 @@ class TopicPictureBloc extends Bloc<TopicPictureEvent, TopicPictureState> { | ||
119 | void _voiceXsTest(XSVoiceTestEvent event,Emitter<TopicPictureState> emitter) async { | 142 | void _voiceXsTest(XSVoiceTestEvent event,Emitter<TopicPictureState> emitter) async { |
120 | EasyLoading.show(status: '录音中....'); | 143 | EasyLoading.show(status: '录音中....'); |
121 | methodChannel.invokeMethod( | 144 | methodChannel.invokeMethod( |
122 | - 'startRecord', | 145 | + 'starVoice', |
123 | {'word':event.testWord,'type':event.type,'userId':event.userId.toString()} | 146 | {'word':event.testWord,'type':event.type,'userId':event.userId.toString()} |
124 | ); | 147 | ); |
125 | _isVoicing = true; | 148 | _isVoicing = true; |
lib/pages/practice/bloc/topic_picture_event.dart
@@ -20,8 +20,8 @@ class XSVoiceResultEvent extends TopicPictureEvent { | @@ -20,8 +20,8 @@ class XSVoiceResultEvent extends TopicPictureEvent { | ||
20 | ///先声测试 | 20 | ///先声测试 |
21 | class XSVoiceTestEvent extends TopicPictureEvent { | 21 | class XSVoiceTestEvent extends TopicPictureEvent { |
22 | final String testWord; | 22 | final String testWord; |
23 | - final int type; | ||
24 | - final int userId; | 23 | + final String type; |
24 | + final String userId; | ||
25 | XSVoiceTestEvent(this.testWord,this.type,this.userId); | 25 | XSVoiceTestEvent(this.testWord,this.type,this.userId); |
26 | } | 26 | } |
27 | 27 |
lib/pages/practice/topic_picture_page.dart
@@ -24,7 +24,7 @@ class TopicPicturePage extends StatelessWidget { | @@ -24,7 +24,7 @@ class TopicPicturePage extends StatelessWidget { | ||
24 | { | 24 | { |
25 | 'appKey':'a418', | 25 | 'appKey':'a418', |
26 | 'secretKey':'1a16f31f2611bf32fb7b3fc38f5b2c81', | 26 | 'secretKey':'1a16f31f2611bf32fb7b3fc38f5b2c81', |
27 | - 'userId':UserUtil.getUser()!.id | 27 | + 'userId':UserUtil.getUser()!.id.toString() |
28 | } | 28 | } |
29 | )), | 29 | )), |
30 | child: _TopicPicturePage(), | 30 | child: _TopicPicturePage(), |
@@ -60,9 +60,8 @@ class _TopicPicturePage extends StatelessWidget { | @@ -60,9 +60,8 @@ class _TopicPicturePage extends StatelessWidget { | ||
60 | children: [ | 60 | children: [ |
61 | PracticeHeaderWidget( | 61 | PracticeHeaderWidget( |
62 | title: '${bloc.currentPage}/${bloc.entity?.topics?.length}', | 62 | title: '${bloc.currentPage}/${bloc.entity?.topics?.length}', |
63 | - onTap: (){ | ||
64 | - bloc.add(XSVoiceTestEvent('Hello', 0,UserUtil.getUser()!.id)); | ||
65 | - // Navigator.pop(context); | 63 | + onTap: () { |
64 | + Navigator.pop(context); | ||
66 | }, | 65 | }, |
67 | ), | 66 | ), |
68 | Expanded( | 67 | Expanded( |
@@ -108,7 +107,7 @@ class _TopicPicturePage extends StatelessWidget { | @@ -108,7 +107,7 @@ class _TopicPicturePage extends StatelessWidget { | ||
108 | child: Column( | 107 | child: Column( |
109 | children: [ | 108 | children: [ |
110 | Text( | 109 | Text( |
111 | - 'What to do when the sentence question is very long and needs a line break', | 110 | + topics?.word??'', |
112 | softWrap: true, | 111 | softWrap: true, |
113 | style: TextStyle( | 112 | style: TextStyle( |
114 | fontSize: 21.sp, | 113 | fontSize: 21.sp, |
@@ -120,10 +119,11 @@ class _TopicPicturePage extends StatelessWidget { | @@ -120,10 +119,11 @@ class _TopicPicturePage extends StatelessWidget { | ||
120 | height: 143.h, | 119 | height: 143.h, |
121 | width: 143.w * (topics?.topicAnswerList?.length??0), | 120 | width: 143.w * (topics?.topicAnswerList?.length??0), |
122 | child: ListView.builder( | 121 | child: ListView.builder( |
123 | - itemCount: topics?.topicAnswerList?.length??0, | ||
124 | scrollDirection: Axis.horizontal, | 122 | scrollDirection: Axis.horizontal, |
123 | + physics: const NeverScrollableScrollPhysics(), | ||
124 | + itemCount: topics?.topicAnswerList?.length??0, | ||
125 | itemBuilder: (context,index){ | 125 | itemBuilder: (context,index){ |
126 | - return _decodeImageWidget(index); | 126 | + return _decodeImageWidget(index,topics?.topicAnswerList?[index]); |
127 | }), | 127 | }), |
128 | ), | 128 | ), |
129 | ], | 129 | ], |
@@ -131,7 +131,7 @@ class _TopicPicturePage extends StatelessWidget { | @@ -131,7 +131,7 @@ class _TopicPicturePage extends StatelessWidget { | ||
131 | ); | 131 | ); |
132 | }); | 132 | }); |
133 | 133 | ||
134 | - Widget _decodeImageWidget(int index) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | 134 | + Widget _decodeImageWidget(int index,CourseProcessTopicsTopicAnswerList? answerLis) => BlocBuilder<TopicPictureBloc,TopicPictureState>( |
135 | buildWhen: (_, s) => s is SelectItemChangeState, | 135 | buildWhen: (_, s) => s is SelectItemChangeState, |
136 | builder: (context,state){ | 136 | builder: (context,state){ |
137 | final bloc = BlocProvider.of<TopicPictureBloc>(context); | 137 | final bloc = BlocProvider.of<TopicPictureBloc>(context); |
@@ -155,9 +155,9 @@ class _TopicPicturePage extends StatelessWidget { | @@ -155,9 +155,9 @@ class _TopicPicturePage extends StatelessWidget { | ||
155 | width: 1.0, | 155 | width: 1.0, |
156 | color: const Color(0xFF140C10) | 156 | color: const Color(0xFF140C10) |
157 | ), | 157 | ), |
158 | - image: const DecorationImage( | 158 | + image: DecorationImage( |
159 | fit: BoxFit.fitWidth, | 159 | fit: BoxFit.fitWidth, |
160 | - image: NetworkImage('https://img1.baidu.com/it/u=3392591833,1640391553&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=714') | 160 | + image: NetworkImage(answerLis?.picUrl??'') |
161 | ) | 161 | ) |
162 | ), | 162 | ), |
163 | ), | 163 | ), |
@@ -169,12 +169,11 @@ class _TopicPicturePage extends StatelessWidget { | @@ -169,12 +169,11 @@ class _TopicPicturePage extends StatelessWidget { | ||
169 | ///看题选字 | 169 | ///看题选字 |
170 | Widget _pageViewWordItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | 170 | Widget _pageViewWordItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( |
171 | builder: (context, state){ | 171 | builder: (context, state){ |
172 | - final bloc = BlocProvider.of<TopicPictureBloc>(context); | ||
173 | return SafeArea( | 172 | return SafeArea( |
174 | child: Column( | 173 | child: Column( |
175 | children: [ | 174 | children: [ |
176 | Text( | 175 | Text( |
177 | - 'What to do when the sentence question is very long and needs a line break', | 176 | + topics?.word??'', |
178 | softWrap: true, | 177 | softWrap: true, |
179 | style: TextStyle( | 178 | style: TextStyle( |
180 | fontSize: 21.sp, | 179 | fontSize: 21.sp, |
@@ -186,10 +185,11 @@ class _TopicPicturePage extends StatelessWidget { | @@ -186,10 +185,11 @@ class _TopicPicturePage extends StatelessWidget { | ||
186 | height: 143.h, | 185 | height: 143.h, |
187 | width: 143.w * (topics?.topicAnswerList?.length??0), | 186 | width: 143.w * (topics?.topicAnswerList?.length??0), |
188 | child: ListView.builder( | 187 | child: ListView.builder( |
189 | - itemCount: topics?.topicAnswerList?.length??0, | ||
190 | scrollDirection: Axis.horizontal, | 188 | scrollDirection: Axis.horizontal, |
189 | + itemCount: topics?.topicAnswerList?.length??0, | ||
190 | + physics: const NeverScrollableScrollPhysics(), | ||
191 | itemBuilder: (context,index){ | 191 | itemBuilder: (context,index){ |
192 | - return _decodeWordWidget(index); | 192 | + return _decodeWordWidget(index,topics?.topicAnswerList?[index]); |
193 | }), | 193 | }), |
194 | ), | 194 | ), |
195 | ], | 195 | ], |
@@ -197,7 +197,7 @@ class _TopicPicturePage extends StatelessWidget { | @@ -197,7 +197,7 @@ class _TopicPicturePage extends StatelessWidget { | ||
197 | ); | 197 | ); |
198 | }); | 198 | }); |
199 | 199 | ||
200 | - Widget _decodeWordWidget(int index) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | 200 | + Widget _decodeWordWidget(int index,CourseProcessTopicsTopicAnswerList? answerLis) => BlocBuilder<TopicPictureBloc,TopicPictureState>( |
201 | buildWhen: (_, s) => s is SelectItemChangeState, | 201 | buildWhen: (_, s) => s is SelectItemChangeState, |
202 | builder: (context,state){ | 202 | builder: (context,state){ |
203 | final bloc = BlocProvider.of<TopicPictureBloc>(context); | 203 | final bloc = BlocProvider.of<TopicPictureBloc>(context); |
@@ -224,7 +224,7 @@ class _TopicPicturePage extends StatelessWidget { | @@ -224,7 +224,7 @@ class _TopicPicturePage extends StatelessWidget { | ||
224 | child: Container( | 224 | child: Container( |
225 | alignment: Alignment.center, | 225 | alignment: Alignment.center, |
226 | child: Text( | 226 | child: Text( |
227 | - 'yellow', | 227 | + answerLis?.word??'', |
228 | style: TextStyle( | 228 | style: TextStyle( |
229 | fontSize: 20.sp, | 229 | fontSize: 20.sp, |
230 | color: const Color(0xFF333333) | 230 | color: const Color(0xFF333333) |
@@ -256,7 +256,6 @@ class _TopicPicturePage extends StatelessWidget { | @@ -256,7 +256,6 @@ class _TopicPicturePage extends StatelessWidget { | ||
256 | ///听音选图 | 256 | ///听音选图 |
257 | Widget _pageViewVoicePictureItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | 257 | Widget _pageViewVoicePictureItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( |
258 | builder: (context, state){ | 258 | builder: (context, state){ |
259 | - final bloc = BlocProvider.of<TopicPictureBloc>(context); | ||
260 | return SafeArea( | 259 | return SafeArea( |
261 | child: Column( | 260 | child: Column( |
262 | children: [ | 261 | children: [ |
@@ -266,7 +265,7 @@ class _TopicPicturePage extends StatelessWidget { | @@ -266,7 +265,7 @@ class _TopicPicturePage extends StatelessWidget { | ||
266 | Image.asset('voice'.assetPng,height: 33.h,width: 30.w,), | 265 | Image.asset('voice'.assetPng,height: 33.h,width: 30.w,), |
267 | 10.horizontalSpace, | 266 | 10.horizontalSpace, |
268 | Text( | 267 | Text( |
269 | - 'yellow', | 268 | + topics?.word??'', |
270 | style: TextStyle( | 269 | style: TextStyle( |
271 | fontSize: 20.sp, | 270 | fontSize: 20.sp, |
272 | color: const Color(0xFF333333) | 271 | color: const Color(0xFF333333) |
@@ -280,9 +279,10 @@ class _TopicPicturePage extends StatelessWidget { | @@ -280,9 +279,10 @@ class _TopicPicturePage extends StatelessWidget { | ||
280 | width: 163.w * (topics?.topicAnswerList?.length??0), | 279 | width: 163.w * (topics?.topicAnswerList?.length??0), |
281 | child: ListView.builder( | 280 | child: ListView.builder( |
282 | scrollDirection: Axis.horizontal, | 281 | scrollDirection: Axis.horizontal, |
282 | + physics: const NeverScrollableScrollPhysics(), | ||
283 | itemCount: topics?.topicAnswerList?.length??0, | 283 | itemCount: topics?.topicAnswerList?.length??0, |
284 | itemBuilder: (BuildContext context,int index){ | 284 | itemBuilder: (BuildContext context,int index){ |
285 | - return _decodeVoiceImageWidget(1,topics?.topicAnswerList?[index]); | 285 | + return _decodeVoiceImageWidget(index,topics?.topicAnswerList?[index]); |
286 | }) | 286 | }) |
287 | , | 287 | , |
288 | ) | 288 | ) |
@@ -315,9 +315,9 @@ class _TopicPicturePage extends StatelessWidget { | @@ -315,9 +315,9 @@ class _TopicPicturePage extends StatelessWidget { | ||
315 | width: 1.0, | 315 | width: 1.0, |
316 | color: const Color(0xFF140C10) | 316 | color: const Color(0xFF140C10) |
317 | ), | 317 | ), |
318 | - image: const DecorationImage( | 318 | + image: DecorationImage( |
319 | fit: BoxFit.fitWidth, | 319 | fit: BoxFit.fitWidth, |
320 | - image: NetworkImage('https://img1.baidu.com/it/u=3392591833,1640391553&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=714') | 320 | + image: NetworkImage(answerList?.picUrl??'') |
321 | ) | 321 | ) |
322 | ), | 322 | ), |
323 | ), | 323 | ), |
@@ -329,7 +329,6 @@ class _TopicPicturePage extends StatelessWidget { | @@ -329,7 +329,6 @@ class _TopicPicturePage extends StatelessWidget { | ||
329 | ///听音选字 | 329 | ///听音选字 |
330 | Widget _pageViewVoiceWordItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | 330 | Widget _pageViewVoiceWordItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( |
331 | builder: (context, state){ | 331 | builder: (context, state){ |
332 | - final bloc = BlocProvider.of<TopicPictureBloc>(context); | ||
333 | return SafeArea( | 332 | return SafeArea( |
334 | child: Column( | 333 | child: Column( |
335 | children: [ | 334 | children: [ |
@@ -339,8 +338,9 @@ class _TopicPicturePage extends StatelessWidget { | @@ -339,8 +338,9 @@ class _TopicPicturePage extends StatelessWidget { | ||
339 | width: 163.w * (topics?.topicAnswerList?.length??0), | 338 | width: 163.w * (topics?.topicAnswerList?.length??0), |
340 | height: 143.h, | 339 | height: 143.h, |
341 | child: ListView.builder( | 340 | child: ListView.builder( |
342 | - itemCount: topics?.topicAnswerList?.length, | ||
343 | scrollDirection: Axis.horizontal, | 341 | scrollDirection: Axis.horizontal, |
342 | + itemCount: topics?.topicAnswerList?.length, | ||
343 | + physics: const NeverScrollableScrollPhysics(), | ||
344 | itemBuilder: (BuildContext context,int index){ | 344 | itemBuilder: (BuildContext context,int index){ |
345 | return _decodeVoiceWordImageWidget(index, topics!.topicAnswerList![index]); | 345 | return _decodeVoiceWordImageWidget(index, topics!.topicAnswerList![index]); |
346 | }), | 346 | }), |
@@ -416,7 +416,7 @@ class _TopicPicturePage extends StatelessWidget { | @@ -416,7 +416,7 @@ class _TopicPicturePage extends StatelessWidget { | ||
416 | mainAxisAlignment: MainAxisAlignment.center, | 416 | mainAxisAlignment: MainAxisAlignment.center, |
417 | children: [ | 417 | children: [ |
418 | OwImageWidget( | 418 | OwImageWidget( |
419 | - name:'https://up.enterdesk.com/edpic_source/16/e7/0d/16e70d550daff77cbac31fae5e1651d4.jpg', | 419 | + name:topics?.picUrl??'', |
420 | height: 186.h, | 420 | height: 186.h, |
421 | width: 186.w, | 421 | width: 186.w, |
422 | ), | 422 | ), |
@@ -424,10 +424,16 @@ class _TopicPicturePage extends StatelessWidget { | @@ -424,10 +424,16 @@ class _TopicPicturePage extends StatelessWidget { | ||
424 | Column( | 424 | Column( |
425 | mainAxisAlignment: MainAxisAlignment.center, | 425 | mainAxisAlignment: MainAxisAlignment.center, |
426 | children: [ | 426 | children: [ |
427 | - Image.asset( | ||
428 | - 'voice'.assetPng, | ||
429 | - height: 52.h, | ||
430 | - width: 46.w, | 427 | + Row( |
428 | + children: [ | ||
429 | + Image.asset( | ||
430 | + 'voice'.assetPng, | ||
431 | + height: 52.h, | ||
432 | + width: 46.w, | ||
433 | + ), | ||
434 | + 10.horizontalSpace, | ||
435 | + Text(topics?.word??'') | ||
436 | + ], | ||
431 | ), | 437 | ), |
432 | 70.verticalSpace, | 438 | 70.verticalSpace, |
433 | GestureDetector( | 439 | GestureDetector( |
@@ -435,7 +441,11 @@ class _TopicPicturePage extends StatelessWidget { | @@ -435,7 +441,11 @@ class _TopicPicturePage extends StatelessWidget { | ||
435 | if (bloc.isVoicing) { | 441 | if (bloc.isVoicing) { |
436 | return; | 442 | return; |
437 | } | 443 | } |
438 | - bloc.add(XSVoiceTestEvent('Hello', 0,UserUtil.getUser()!.id)); | 444 | + if (topics?.type == 5) { |
445 | + bloc.add(XSVoiceTestEvent(topics?.keyWord??'', '0',UserUtil.getUser()!.id.toString())); | ||
446 | + } else { | ||
447 | + bloc.add(XSVoiceTestEvent(topics?.word??'', '0',UserUtil.getUser()!.id.toString())); | ||
448 | + } | ||
439 | }, | 449 | }, |
440 | child: Image.asset( | 450 | child: Image.asset( |
441 | 'micro_phone'.assetPng, | 451 | 'micro_phone'.assetPng, |