Commit f29687b2fe98680efbe9ac7805cc6e830ef1f8d4
1 parent
18699a34
修复iOS偶现按钮消失问题,练习页面返回按钮尺寸和标题位置
Showing
5 changed files
with
309 additions
and
292 deletions
ios/Runner.xcodeproj/project.pbxproj
... | ... | @@ -2327,7 +2327,7 @@ |
2327 | 2327 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
2328 | 2328 | CODE_SIGN_IDENTITY = "Apple Development"; |
2329 | 2329 | CODE_SIGN_STYLE = Automatic; |
2330 | - CURRENT_PROJECT_VERSION = 11; | |
2330 | + CURRENT_PROJECT_VERSION = 12; | |
2331 | 2331 | DEVELOPMENT_TEAM = T8P9KW8GWH; |
2332 | 2332 | ENABLE_BITCODE = NO; |
2333 | 2333 | INFOPLIST_FILE = Runner/Info.plist; |
... | ... | @@ -2671,7 +2671,7 @@ |
2671 | 2671 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
2672 | 2672 | CODE_SIGN_IDENTITY = "Apple Development"; |
2673 | 2673 | CODE_SIGN_STYLE = Automatic; |
2674 | - CURRENT_PROJECT_VERSION = 11; | |
2674 | + CURRENT_PROJECT_VERSION = 12; | |
2675 | 2675 | DEVELOPMENT_TEAM = T8P9KW8GWH; |
2676 | 2676 | ENABLE_BITCODE = NO; |
2677 | 2677 | HEADER_SEARCH_PATHS = ( |
... | ... | @@ -2876,7 +2876,7 @@ |
2876 | 2876 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
2877 | 2877 | CODE_SIGN_IDENTITY = "Apple Development"; |
2878 | 2878 | CODE_SIGN_STYLE = Automatic; |
2879 | - CURRENT_PROJECT_VERSION = 11; | |
2879 | + CURRENT_PROJECT_VERSION = 12; | |
2880 | 2880 | DEVELOPMENT_TEAM = T8P9KW8GWH; |
2881 | 2881 | ENABLE_BITCODE = NO; |
2882 | 2882 | INFOPLIST_FILE = Runner/Info.plist; | ... | ... |
ios/Runner/Info.plist
... | ... | @@ -92,16 +92,16 @@ |
92 | 92 | <true/> |
93 | 93 | <key>UISupportedInterfaceOrientations</key> |
94 | 94 | <array> |
95 | - <string>UIInterfaceOrientationPortrait</string> | |
96 | 95 | <string>UIInterfaceOrientationLandscapeLeft</string> |
97 | 96 | <string>UIInterfaceOrientationLandscapeRight</string> |
97 | + <string>UIInterfaceOrientationPortrait</string> | |
98 | 98 | </array> |
99 | 99 | <key>UISupportedInterfaceOrientations~ipad</key> |
100 | 100 | <array> |
101 | - <string>UIInterfaceOrientationPortrait</string> | |
102 | - <string>UIInterfaceOrientationPortraitUpsideDown</string> | |
103 | 101 | <string>UIInterfaceOrientationLandscapeLeft</string> |
104 | 102 | <string>UIInterfaceOrientationLandscapeRight</string> |
103 | + <string>UIInterfaceOrientationPortrait</string> | |
104 | + <string>UIInterfaceOrientationPortraitUpsideDown</string> | |
105 | 105 | </array> |
106 | 106 | <key>UIViewControllerBasedStatusBarAppearance</key> |
107 | 107 | <false/> | ... | ... |
ios/Runner/Wowgame/WowGameClasses/WowGameCocosManager.mm
... | ... | @@ -48,6 +48,7 @@ static CocosAppDelegate cocosAppDelegate; |
48 | 48 | } |
49 | 49 | |
50 | 50 | - (void)exitGame { |
51 | + | |
51 | 52 | [self.gameViewController dismissViewControllerAnimated:YES completion:nil]; |
52 | 53 | } |
53 | 54 | |
... | ... | @@ -102,6 +103,7 @@ static DMProgressHUD *hud; |
102 | 103 | } |
103 | 104 | |
104 | 105 | -(void)startGameWithID:(NSInteger)gameid { |
106 | + [self clearData]; | |
105 | 107 | cocos2d::Director::getInstance()->getScheduler()->performFunctionInCocosThread([=] { |
106 | 108 | // CCLOG("start gameid---> %d ", gameid); |
107 | 109 | cocos2d::EventCustom evtEnter("start_gameid"); |
... | ... | @@ -117,6 +119,16 @@ static DMProgressHUD *hud; |
117 | 119 | } |
118 | 120 | |
119 | 121 | |
122 | +- (void)clearData | |
123 | +{ | |
124 | + cocos2d::SpriteFrameCache::getInstance()->removeSpriteFrames(); | |
125 | + cocos2d::Director::getInstance()->getTextureCache()->removeAllTextures(); | |
126 | + //清理搜索路径 | |
127 | + std::vector<std::string> searchPathArray; | |
128 | + searchPathArray.push_back("res"); | |
129 | + cocos2d::FileUtils::getInstance()->setSearchPaths(searchPathArray); | |
130 | +} | |
131 | + | |
120 | 132 | - (void)detoryCocosEnvironment { |
121 | 133 | |
122 | 134 | } | ... | ... |
lib/pages/practice/topic_picture_page.dart
... | ... | @@ -14,7 +14,7 @@ import '../../common/widgets/throttledGesture_gesture_detector.dart'; |
14 | 14 | import 'bloc/topic_picture_bloc.dart'; |
15 | 15 | import 'widgets/practice_header_widget.dart'; |
16 | 16 | |
17 | -class TopicPicturePage extends StatelessWidget { | |
17 | +class TopicPicturePage extends StatelessWidget { | |
18 | 18 | const TopicPicturePage({super.key, this.courseLessonId}); |
19 | 19 | |
20 | 20 | final String? courseLessonId; |
... | ... | @@ -23,20 +23,18 @@ class TopicPicturePage extends StatelessWidget { |
23 | 23 | Widget build(BuildContext context) { |
24 | 24 | return BlocProvider( |
25 | 25 | create: (context) => TopicPictureBloc( |
26 | - context, | |
27 | - PageController(), | |
28 | - courseLessonId??'', | |
26 | + context, | |
27 | + PageController(), | |
28 | + courseLessonId ?? '', | |
29 | 29 | ) |
30 | 30 | ..add(InitBlocEvent()) |
31 | 31 | ..add(RequestDataEvent()) |
32 | - ..add(XSVoiceInitEvent( | |
33 | - { | |
34 | - 'appKey':AppConsts.xsAppKey, | |
35 | - 'service':AppConsts.xsAppService, | |
36 | - 'secretKey':AppConsts.xsAppSecretKey, | |
37 | - 'userId':UserUtil.getUser()!.id.toString(), | |
38 | - } | |
39 | - )), | |
32 | + ..add(XSVoiceInitEvent({ | |
33 | + 'appKey': AppConsts.xsAppKey, | |
34 | + 'service': AppConsts.xsAppService, | |
35 | + 'secretKey': AppConsts.xsAppSecretKey, | |
36 | + 'userId': UserUtil.getUser()!.id.toString(), | |
37 | + })), | |
40 | 38 | child: _TopicPicturePage(), |
41 | 39 | ); |
42 | 40 | } |
... | ... | @@ -45,21 +43,20 @@ class TopicPicturePage extends StatelessWidget { |
45 | 43 | class _TopicPicturePage extends StatelessWidget { |
46 | 44 | @override |
47 | 45 | Widget build(BuildContext context) { |
48 | - return BlocListener<TopicPictureBloc,TopicPictureState>( | |
49 | - listener: (context, state){ | |
46 | + return BlocListener<TopicPictureBloc, TopicPictureState>( | |
47 | + listener: (context, state) { | |
50 | 48 | if (state is RequestDataState) { |
51 | 49 | context.read<TopicPictureBloc>().add(CurrentPageIndexChangeEvent(0)); |
52 | 50 | } |
53 | - if (state is XSVoiceTestState) { | |
54 | - | |
55 | - } | |
51 | + if (state is XSVoiceTestState) {} | |
56 | 52 | }, |
57 | 53 | child: _topicPictureView(), |
58 | 54 | ); |
59 | 55 | } |
60 | 56 | |
61 | - Widget _topicPictureView() => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
62 | - builder: (context,state){ | |
57 | + Widget _topicPictureView() => | |
58 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
59 | + builder: (context, state) { | |
63 | 60 | final bloc = BlocProvider.of<TopicPictureBloc>(context); |
64 | 61 | return Container( |
65 | 62 | color: Colors.white, |
... | ... | @@ -70,14 +67,13 @@ class _TopicPicturePage extends StatelessWidget { |
70 | 67 | PracticeHeaderWidget( |
71 | 68 | title: '${bloc.currentPage}/${bloc.entity?.topics?.length}', |
72 | 69 | onTap: () { |
73 | - popPage( | |
74 | - data:{ | |
75 | - 'currentStep':bloc.currentPage, | |
76 | - 'courseLessonId':bloc.courseLessonId, | |
77 | - 'isCompleted': bloc.isLastPage(), | |
78 | - }); | |
70 | + popPage(data: { | |
71 | + 'currentStep': bloc.currentPage, | |
72 | + 'courseLessonId': bloc.courseLessonId, | |
73 | + 'isCompleted': bloc.isLastPage(), | |
74 | + }); | |
79 | 75 | // Navigator.pop(context); |
80 | - }, | |
76 | + }, | |
81 | 77 | ), |
82 | 78 | Expanded( |
83 | 79 | child: PageView.builder( |
... | ... | @@ -87,17 +83,27 @@ class _TopicPicturePage extends StatelessWidget { |
87 | 83 | onPageChanged: (int index) { |
88 | 84 | bloc.add(CurrentPageIndexChangeEvent(index)); |
89 | 85 | }, |
90 | - itemBuilder: (BuildContext context,int index){ | |
91 | - CourseProcessTopics? topics = bloc.entity?.topics![index]; | |
92 | - if (topics?.type == TopicType.audioImageSelect.value) {//听音选图 | |
86 | + itemBuilder: (BuildContext context, int index) { | |
87 | + CourseProcessTopics? topics = | |
88 | + bloc.entity?.topics![index]; | |
89 | + if (topics?.type == | |
90 | + TopicType.audioImageSelect.value) { | |
91 | + //听音选图 | |
93 | 92 | return _pageViewVoicePictureItemWidget(topics); |
94 | - } else if (topics?.type == TopicType.audioCharSelect.value) {//听音选字 | |
93 | + } else if (topics?.type == | |
94 | + TopicType.audioCharSelect.value) { | |
95 | + //听音选字 | |
95 | 96 | return _pageViewVoiceWordItemWidget(topics); |
96 | - } else if (topics?.type == TopicType.questionCharSelect.value) {//看题选字 | |
97 | + } else if (topics?.type == | |
98 | + TopicType.questionCharSelect.value) { | |
99 | + //看题选字 | |
97 | 100 | return _pageViewWordItemWidget(topics); |
98 | - } else if (topics?.type == TopicType.questionImageSelect.value) {//看题选图 | |
101 | + } else if (topics?.type == | |
102 | + TopicType.questionImageSelect.value) { | |
103 | + //看题选图 | |
99 | 104 | return _pageViewItemWidget(topics); |
100 | - } else {//语音问答 | |
105 | + } else { | |
106 | + //语音问答 | |
101 | 107 | return _voiceAnswerItem(topics); |
102 | 108 | } |
103 | 109 | }), |
... | ... | @@ -108,37 +114,34 @@ class _TopicPicturePage extends StatelessWidget { |
108 | 114 | left: 0, |
109 | 115 | right: 0, |
110 | 116 | bottom: 0, |
111 | - child: Image.asset('bottom_grass'.assetPng) | |
112 | - ) | |
117 | + child: Image.asset('bottom_grass'.assetPng)) | |
113 | 118 | ], |
114 | 119 | ), |
115 | 120 | ); |
116 | 121 | }); |
117 | 122 | |
118 | 123 | ///看题选图 |
119 | - Widget _pageViewItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
120 | - builder: (context, state){ | |
124 | + Widget _pageViewItemWidget(CourseProcessTopics? topics) => | |
125 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
126 | + builder: (context, state) { | |
121 | 127 | return SafeArea( |
122 | 128 | child: Column( |
123 | 129 | children: [ |
124 | - Text( | |
125 | - topics?.word??'', | |
130 | + Text(topics?.word ?? '', | |
126 | 131 | softWrap: true, |
127 | 132 | style: TextStyle( |
128 | - fontSize: 21.sp, | |
129 | - color: const Color(0xFF333333) | |
130 | - ) | |
131 | - ), | |
133 | + fontSize: 21.sp, color: const Color(0xFF333333))), | |
132 | 134 | 26.verticalSpace, |
133 | 135 | SizedBox( |
134 | 136 | height: 143.h, |
135 | - width: 143.w * (topics?.topicAnswerList?.length??0), | |
137 | + width: 143.w * (topics?.topicAnswerList?.length ?? 0), | |
136 | 138 | child: ListView.builder( |
137 | 139 | scrollDirection: Axis.horizontal, |
138 | 140 | physics: const NeverScrollableScrollPhysics(), |
139 | - itemCount: topics?.topicAnswerList?.length??0, | |
140 | - itemBuilder: (context,index){ | |
141 | - return _decodeImageWidget(index,topics?.topicAnswerList?[index]); | |
141 | + itemCount: topics?.topicAnswerList?.length ?? 0, | |
142 | + itemBuilder: (context, index) { | |
143 | + return _decodeImageWidget( | |
144 | + index, topics?.topicAnswerList?[index]); | |
142 | 145 | }), |
143 | 146 | ), |
144 | 147 | ], |
... | ... | @@ -146,65 +149,63 @@ class _TopicPicturePage extends StatelessWidget { |
146 | 149 | ); |
147 | 150 | }); |
148 | 151 | |
149 | - Widget _decodeImageWidget(int index,CourseProcessTopicsTopicAnswerList? answerLis) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
150 | - buildWhen: (_, s) => s is SelectItemChangeState, | |
151 | - builder: (context,state){ | |
152 | - final bloc = BlocProvider.of<TopicPictureBloc>(context); | |
153 | - return Container( | |
154 | - padding: EdgeInsets.symmetric(horizontal: 10.w), | |
155 | - child: GestureDetector( | |
156 | - onTap: () => bloc.add(SelectItemEvent(index)), | |
157 | - child: Container( | |
158 | - padding: const EdgeInsets.all(4.5), | |
159 | - decoration: BoxDecoration( | |
160 | - color: bloc.selectItem == index?const Color(0xFF00B6F1):Colors.white, | |
161 | - borderRadius: BorderRadius.circular(15), | |
162 | - ), | |
163 | - height: 143.h, | |
164 | - width: 143.w, | |
165 | - child: Container( | |
166 | - decoration: BoxDecoration( | |
167 | - color: Colors.white, | |
152 | + Widget _decodeImageWidget( | |
153 | + int index, CourseProcessTopicsTopicAnswerList? answerLis) => | |
154 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
155 | + buildWhen: (_, s) => s is SelectItemChangeState, | |
156 | + builder: (context, state) { | |
157 | + final bloc = BlocProvider.of<TopicPictureBloc>(context); | |
158 | + return Container( | |
159 | + padding: EdgeInsets.symmetric(horizontal: 10.w), | |
160 | + child: GestureDetector( | |
161 | + onTap: () => bloc.add(SelectItemEvent(index)), | |
162 | + child: Container( | |
163 | + padding: const EdgeInsets.all(4.5), | |
164 | + decoration: BoxDecoration( | |
165 | + color: bloc.selectItem == index | |
166 | + ? const Color(0xFF00B6F1) | |
167 | + : Colors.white, | |
168 | 168 | borderRadius: BorderRadius.circular(15), |
169 | - border: Border.all( | |
170 | - width: 1.0, | |
171 | - color: const Color(0xFF140C10) | |
172 | - ), | |
173 | - image: DecorationImage( | |
174 | - fit: BoxFit.fitWidth, | |
175 | - image: NetworkImage(answerLis?.picUrl??'') | |
176 | - ) | |
169 | + ), | |
170 | + height: 143.h, | |
171 | + width: 143.w, | |
172 | + child: Container( | |
173 | + decoration: BoxDecoration( | |
174 | + color: Colors.white, | |
175 | + borderRadius: BorderRadius.circular(15), | |
176 | + border: Border.all( | |
177 | + width: 1.0, color: const Color(0xFF140C10)), | |
178 | + image: DecorationImage( | |
179 | + fit: BoxFit.fitWidth, | |
180 | + image: NetworkImage(answerLis?.picUrl ?? ''))), | |
181 | + ), | |
177 | 182 | ), |
178 | 183 | ), |
179 | - ), | |
180 | - ), | |
181 | - ); | |
182 | - }); | |
184 | + ); | |
185 | + }); | |
183 | 186 | |
184 | 187 | ///看题选字 |
185 | - Widget _pageViewWordItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
186 | - builder: (context, state){ | |
188 | + Widget _pageViewWordItemWidget(CourseProcessTopics? topics) => | |
189 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
190 | + builder: (context, state) { | |
187 | 191 | return SafeArea( |
188 | 192 | child: Column( |
189 | 193 | children: [ |
190 | - Text( | |
191 | - topics?.word??'', | |
194 | + Text(topics?.word ?? '', | |
192 | 195 | softWrap: true, |
193 | 196 | style: TextStyle( |
194 | - fontSize: 21.sp, | |
195 | - color: const Color(0xFF333333) | |
196 | - ) | |
197 | - ), | |
197 | + fontSize: 21.sp, color: const Color(0xFF333333))), | |
198 | 198 | 26.verticalSpace, |
199 | 199 | SizedBox( |
200 | 200 | height: 143.h, |
201 | - width: 143.w * (topics?.topicAnswerList?.length??0), | |
201 | + width: 143.w * (topics?.topicAnswerList?.length ?? 0), | |
202 | 202 | child: ListView.builder( |
203 | 203 | scrollDirection: Axis.horizontal, |
204 | - itemCount: topics?.topicAnswerList?.length??0, | |
204 | + itemCount: topics?.topicAnswerList?.length ?? 0, | |
205 | 205 | physics: const NeverScrollableScrollPhysics(), |
206 | - itemBuilder: (context,index){ | |
207 | - return _decodeWordWidget(index,topics?.topicAnswerList?[index]); | |
206 | + itemBuilder: (context, index) { | |
207 | + return _decodeWordWidget( | |
208 | + index, topics?.topicAnswerList?[index]); | |
208 | 209 | }), |
209 | 210 | ), |
210 | 211 | ], |
... | ... | @@ -212,65 +213,64 @@ class _TopicPicturePage extends StatelessWidget { |
212 | 213 | ); |
213 | 214 | }); |
214 | 215 | |
215 | - Widget _decodeWordWidget(int index,CourseProcessTopicsTopicAnswerList? answerLis) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
216 | - buildWhen: (_, s) => s is SelectItemChangeState, | |
217 | - builder: (context,state){ | |
218 | - final bloc = BlocProvider.of<TopicPictureBloc>(context); | |
219 | - return Container( | |
220 | - padding: EdgeInsets.symmetric(horizontal: 10.w), | |
221 | - child: GestureDetector( | |
222 | - onTap: () => bloc.add(SelectItemEvent(index)), | |
223 | - child: Container( | |
224 | - width: 143.w, | |
225 | - height: 143.h, | |
226 | - padding: EdgeInsets.only(left: 13.w,right: 13.w,top: 13.h,bottom: 13.h), | |
227 | - decoration: BoxDecoration( | |
228 | - color: Colors.white, | |
229 | - borderRadius: BorderRadius.circular(15), | |
230 | - border: Border.all( | |
231 | - width: 1.0, | |
232 | - color: const Color(0xFF140C10) | |
233 | - ), | |
234 | - ), | |
235 | - child: Column( | |
236 | - mainAxisAlignment: MainAxisAlignment.end, | |
237 | - children: [ | |
238 | - Expanded( | |
239 | - child: Container( | |
240 | - alignment: Alignment.center, | |
241 | - child: Text( | |
242 | - answerLis?.word??'', | |
243 | - style: TextStyle( | |
244 | - fontSize: 20.sp, | |
245 | - color: const Color(0xFF333333) | |
246 | - ) | |
247 | - ), | |
248 | - ), | |
216 | + Widget _decodeWordWidget( | |
217 | + int index, CourseProcessTopicsTopicAnswerList? answerLis) => | |
218 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
219 | + buildWhen: (_, s) => s is SelectItemChangeState, | |
220 | + builder: (context, state) { | |
221 | + final bloc = BlocProvider.of<TopicPictureBloc>(context); | |
222 | + return Container( | |
223 | + padding: EdgeInsets.symmetric(horizontal: 10.w), | |
224 | + child: GestureDetector( | |
225 | + onTap: () => bloc.add(SelectItemEvent(index)), | |
226 | + child: Container( | |
227 | + width: 143.w, | |
228 | + height: 143.h, | |
229 | + padding: EdgeInsets.only( | |
230 | + left: 13.w, right: 13.w, top: 13.h, bottom: 13.h), | |
231 | + decoration: BoxDecoration( | |
232 | + color: Colors.white, | |
233 | + borderRadius: BorderRadius.circular(15), | |
234 | + border: | |
235 | + Border.all(width: 1.0, color: const Color(0xFF140C10)), | |
249 | 236 | ), |
250 | - Container( | |
251 | - height: 30.h, | |
252 | - width: double.infinity, | |
253 | - decoration: BoxDecoration( | |
254 | - color: bloc.selectItem == index?const Color(0xFF00B6F1):Colors.white, | |
255 | - borderRadius: BorderRadius.circular(15.r), | |
256 | - border: Border.all( | |
257 | - width: 1.5, | |
258 | - color: const Color(0xFF140C10) | |
237 | + child: Column( | |
238 | + mainAxisAlignment: MainAxisAlignment.end, | |
239 | + children: [ | |
240 | + Expanded( | |
241 | + child: Container( | |
242 | + alignment: Alignment.center, | |
243 | + child: Text(answerLis?.word ?? '', | |
244 | + style: TextStyle( | |
245 | + fontSize: 20.sp, | |
246 | + color: const Color(0xFF333333))), | |
247 | + ), | |
259 | 248 | ), |
260 | - ), | |
261 | - alignment: Alignment.center, | |
262 | - child: Image.asset('choose'.assetPng), | |
263 | - ) | |
264 | - ], | |
249 | + Container( | |
250 | + height: 30.h, | |
251 | + width: double.infinity, | |
252 | + decoration: BoxDecoration( | |
253 | + color: bloc.selectItem == index | |
254 | + ? const Color(0xFF00B6F1) | |
255 | + : Colors.white, | |
256 | + borderRadius: BorderRadius.circular(15.r), | |
257 | + border: Border.all( | |
258 | + width: 1.5, color: const Color(0xFF140C10)), | |
259 | + ), | |
260 | + alignment: Alignment.center, | |
261 | + child: Image.asset('choose'.assetPng), | |
262 | + ) | |
263 | + ], | |
264 | + ), | |
265 | + ), | |
265 | 266 | ), |
266 | - ), | |
267 | - ), | |
268 | - ); | |
269 | - }); | |
267 | + ); | |
268 | + }); | |
270 | 269 | |
271 | 270 | ///听音选图 |
272 | - Widget _pageViewVoicePictureItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
273 | - builder: (context, state){ | |
271 | + Widget _pageViewVoicePictureItemWidget(CourseProcessTopics? topics) => | |
272 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
273 | + builder: (context, state) { | |
274 | 274 | final bloc = BlocProvider.of<TopicPictureBloc>(context); |
275 | 275 | return SafeArea( |
276 | 276 | child: Column( |
... | ... | @@ -283,101 +283,101 @@ class _TopicPicturePage extends StatelessWidget { |
283 | 283 | bloc.add(VoicePlayEvent()); |
284 | 284 | }, |
285 | 285 | child: Image.asset( |
286 | - bloc.voicePlayState == VoicePlayState.playing?'reade_answer'.assetGif:'voice'.assetPng, | |
286 | + bloc.voicePlayState == VoicePlayState.playing | |
287 | + ? 'reade_answer'.assetGif | |
288 | + : 'voice'.assetPng, | |
287 | 289 | height: 33.h, |
288 | 290 | width: 30.w, |
289 | 291 | ), |
290 | 292 | ), |
291 | 293 | 10.horizontalSpace, |
292 | - Text( | |
293 | - topics?.word??'', | |
294 | + Text(topics?.word ?? '', | |
294 | 295 | style: TextStyle( |
295 | - fontSize: 20.sp, | |
296 | - color: const Color(0xFF333333) | |
297 | - ) | |
298 | - ) | |
296 | + fontSize: 20.sp, color: const Color(0xFF333333))) | |
299 | 297 | ], |
300 | 298 | ), |
301 | 299 | 26.verticalSpace, |
302 | 300 | SizedBox( |
303 | 301 | height: 143.h, |
304 | - width: 163.w * (topics?.topicAnswerList?.length??0), | |
302 | + width: 163.w * (topics?.topicAnswerList?.length ?? 0), | |
305 | 303 | child: ListView.builder( |
306 | 304 | scrollDirection: Axis.horizontal, |
307 | 305 | physics: const NeverScrollableScrollPhysics(), |
308 | - itemCount: topics?.topicAnswerList?.length??0, | |
309 | - itemBuilder: (BuildContext context,int index){ | |
310 | - return _decodeVoiceImageWidget(index,topics?.topicAnswerList?[index]); | |
311 | - }) | |
312 | - , | |
306 | + itemCount: topics?.topicAnswerList?.length ?? 0, | |
307 | + itemBuilder: (BuildContext context, int index) { | |
308 | + return _decodeVoiceImageWidget( | |
309 | + index, topics?.topicAnswerList?[index]); | |
310 | + }), | |
313 | 311 | ) |
314 | 312 | ], |
315 | 313 | ), |
316 | 314 | ); |
317 | 315 | }); |
318 | 316 | |
319 | - Widget _decodeVoiceImageWidget(int index,CourseProcessTopicsTopicAnswerList? answerList) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
320 | - buildWhen: (_, s) => s is SelectItemChangeState, | |
321 | - builder: (context,state){ | |
322 | - final bloc = BlocProvider.of<TopicPictureBloc>(context); | |
323 | - return Container( | |
324 | - padding: EdgeInsets.symmetric(horizontal: 10.w), | |
325 | - child: GestureDetector( | |
326 | - onTap: () => bloc.add(SelectItemEvent(index)), | |
327 | - child: Container( | |
328 | - padding: const EdgeInsets.all(4.5), | |
329 | - decoration: BoxDecoration( | |
330 | - color: bloc.selectItem == index?const Color(0xFF00B6F1):Colors.white, | |
331 | - borderRadius: BorderRadius.circular(15), | |
332 | - ), | |
333 | - height: 143.h, | |
334 | - width: 143.w, | |
335 | - child: Container( | |
336 | - decoration: BoxDecoration( | |
337 | - color: Colors.white, | |
317 | + Widget _decodeVoiceImageWidget( | |
318 | + int index, CourseProcessTopicsTopicAnswerList? answerList) => | |
319 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
320 | + buildWhen: (_, s) => s is SelectItemChangeState, | |
321 | + builder: (context, state) { | |
322 | + final bloc = BlocProvider.of<TopicPictureBloc>(context); | |
323 | + return Container( | |
324 | + padding: EdgeInsets.symmetric(horizontal: 10.w), | |
325 | + child: GestureDetector( | |
326 | + onTap: () => bloc.add(SelectItemEvent(index)), | |
327 | + child: Container( | |
328 | + padding: const EdgeInsets.all(4.5), | |
329 | + decoration: BoxDecoration( | |
330 | + color: bloc.selectItem == index | |
331 | + ? const Color(0xFF00B6F1) | |
332 | + : Colors.white, | |
338 | 333 | borderRadius: BorderRadius.circular(15), |
339 | - border: Border.all( | |
340 | - width: 1.0, | |
341 | - color: const Color(0xFF140C10) | |
342 | - ), | |
343 | - image: DecorationImage( | |
344 | - fit: BoxFit.fitWidth, | |
345 | - image: NetworkImage(answerList?.picUrl??'') | |
346 | - ) | |
334 | + ), | |
335 | + height: 143.h, | |
336 | + width: 143.w, | |
337 | + child: Container( | |
338 | + decoration: BoxDecoration( | |
339 | + color: Colors.white, | |
340 | + borderRadius: BorderRadius.circular(15), | |
341 | + border: Border.all( | |
342 | + width: 1.0, color: const Color(0xFF140C10)), | |
343 | + image: DecorationImage( | |
344 | + fit: BoxFit.fitWidth, | |
345 | + image: NetworkImage(answerList?.picUrl ?? ''))), | |
346 | + ), | |
347 | 347 | ), |
348 | 348 | ), |
349 | - ), | |
350 | - ), | |
351 | - ); | |
352 | - }); | |
349 | + ); | |
350 | + }); | |
353 | 351 | |
354 | 352 | ///听音选字 |
355 | - Widget _pageViewVoiceWordItemWidget(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
356 | - builder: (context, state){ | |
353 | + Widget _pageViewVoiceWordItemWidget(CourseProcessTopics? topics) => | |
354 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
355 | + builder: (context, state) { | |
357 | 356 | final bloc = BlocProvider.of<TopicPictureBloc>(context); |
358 | 357 | return SafeArea( |
359 | 358 | child: Column( |
360 | 359 | children: [ |
361 | 360 | GestureDetector( |
362 | - onTap: () { | |
363 | - bloc.add(VoicePlayEvent()); | |
364 | - }, | |
365 | - child: Image.asset( | |
366 | - bloc.voicePlayState == VoicePlayState.playing?'reade_answer'.assetGif:'voice'.assetPng, | |
367 | - height: 33.h, | |
368 | - width: 30.w | |
369 | - ) | |
370 | - ), | |
361 | + onTap: () { | |
362 | + bloc.add(VoicePlayEvent()); | |
363 | + }, | |
364 | + child: Image.asset( | |
365 | + bloc.voicePlayState == VoicePlayState.playing | |
366 | + ? 'reade_answer'.assetGif | |
367 | + : 'voice'.assetPng, | |
368 | + height: 33.h, | |
369 | + width: 30.w)), | |
371 | 370 | 26.verticalSpace, |
372 | 371 | SizedBox( |
373 | - width: 163.w * (topics?.topicAnswerList?.length??0), | |
372 | + width: 163.w * (topics?.topicAnswerList?.length ?? 0), | |
374 | 373 | height: 143.h, |
375 | 374 | child: ListView.builder( |
376 | 375 | scrollDirection: Axis.horizontal, |
377 | 376 | itemCount: topics?.topicAnswerList?.length, |
378 | 377 | physics: const NeverScrollableScrollPhysics(), |
379 | - itemBuilder: (BuildContext context,int index){ | |
380 | - return _decodeVoiceWordImageWidget(index, topics!.topicAnswerList![index]); | |
378 | + itemBuilder: (BuildContext context, int index) { | |
379 | + return _decodeVoiceWordImageWidget( | |
380 | + index, topics!.topicAnswerList![index]); | |
381 | 381 | }), |
382 | 382 | ), |
383 | 383 | ], |
... | ... | @@ -385,73 +385,72 @@ class _TopicPicturePage extends StatelessWidget { |
385 | 385 | ); |
386 | 386 | }); |
387 | 387 | |
388 | - Widget _decodeVoiceWordImageWidget(int index,CourseProcessTopicsTopicAnswerList answerList) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
389 | - buildWhen: (_, s) => s is SelectItemChangeState, | |
390 | - builder: (context,state){ | |
391 | - final bloc = BlocProvider.of<TopicPictureBloc>(context); | |
392 | - return GestureDetector( | |
393 | - onTap: () => bloc.add(SelectItemEvent(index)), | |
394 | - child: Container( | |
395 | - width: 163.w, | |
396 | - height: 143.h, | |
397 | - padding: EdgeInsets.symmetric(horizontal: 10.w), | |
398 | - child: Container( | |
399 | - width: 143.w, | |
400 | - height: 143.h, | |
401 | - padding: EdgeInsets.only(left: 13.w,right: 13.w,top: 13.h,bottom: 13.h), | |
402 | - decoration: BoxDecoration( | |
403 | - color: Colors.white, | |
404 | - borderRadius: BorderRadius.circular(15), | |
405 | - border: Border.all( | |
406 | - width: 1.0, | |
407 | - color: const Color(0xFF140C10) | |
408 | - ), | |
409 | - ), | |
410 | - child: Column( | |
411 | - mainAxisAlignment: MainAxisAlignment.end, | |
412 | - children: [ | |
413 | - Expanded( | |
414 | - child: Container( | |
415 | - alignment: Alignment.center, | |
416 | - child: Text( | |
417 | - answerList.word??'', | |
418 | - style: TextStyle( | |
419 | - fontSize: 20.sp, | |
420 | - color: const Color(0xFF333333) | |
421 | - ) | |
422 | - ), | |
423 | - ), | |
388 | + Widget _decodeVoiceWordImageWidget( | |
389 | + int index, CourseProcessTopicsTopicAnswerList answerList) => | |
390 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
391 | + buildWhen: (_, s) => s is SelectItemChangeState, | |
392 | + builder: (context, state) { | |
393 | + final bloc = BlocProvider.of<TopicPictureBloc>(context); | |
394 | + return GestureDetector( | |
395 | + onTap: () => bloc.add(SelectItemEvent(index)), | |
396 | + child: Container( | |
397 | + width: 163.w, | |
398 | + height: 143.h, | |
399 | + padding: EdgeInsets.symmetric(horizontal: 10.w), | |
400 | + child: Container( | |
401 | + width: 143.w, | |
402 | + height: 143.h, | |
403 | + padding: EdgeInsets.only( | |
404 | + left: 13.w, right: 13.w, top: 13.h, bottom: 13.h), | |
405 | + decoration: BoxDecoration( | |
406 | + color: Colors.white, | |
407 | + borderRadius: BorderRadius.circular(15), | |
408 | + border: | |
409 | + Border.all(width: 1.0, color: const Color(0xFF140C10)), | |
424 | 410 | ), |
425 | - Container( | |
426 | - height: 30.h, | |
427 | - width: double.infinity, | |
428 | - decoration: BoxDecoration( | |
429 | - color: bloc.selectItem == index?const Color(0xFF00B6F1):Colors.white, | |
430 | - borderRadius: BorderRadius.circular(15.r), | |
431 | - border: Border.all( | |
432 | - width: 1.5, | |
433 | - color: const Color(0xFF140C10) | |
411 | + child: Column( | |
412 | + mainAxisAlignment: MainAxisAlignment.end, | |
413 | + children: [ | |
414 | + Expanded( | |
415 | + child: Container( | |
416 | + alignment: Alignment.center, | |
417 | + child: Text(answerList.word ?? '', | |
418 | + style: TextStyle( | |
419 | + fontSize: 20.sp, | |
420 | + color: const Color(0xFF333333))), | |
421 | + ), | |
434 | 422 | ), |
435 | - ), | |
436 | - alignment: Alignment.center, | |
437 | - child: Image.asset('choose'.assetPng), | |
438 | - ) | |
439 | - ], | |
423 | + Container( | |
424 | + height: 30.h, | |
425 | + width: double.infinity, | |
426 | + decoration: BoxDecoration( | |
427 | + color: bloc.selectItem == index | |
428 | + ? const Color(0xFF00B6F1) | |
429 | + : Colors.white, | |
430 | + borderRadius: BorderRadius.circular(15.r), | |
431 | + border: Border.all( | |
432 | + width: 1.5, color: const Color(0xFF140C10)), | |
433 | + ), | |
434 | + alignment: Alignment.center, | |
435 | + child: Image.asset('choose'.assetPng), | |
436 | + ) | |
437 | + ], | |
438 | + ), | |
439 | + ), | |
440 | 440 | ), |
441 | - ), | |
442 | - ), | |
443 | - ); | |
444 | - }); | |
441 | + ); | |
442 | + }); | |
445 | 443 | |
446 | 444 | ///语音问答 |
447 | - Widget _voiceAnswerItem(CourseProcessTopics? topics) => BlocBuilder<TopicPictureBloc,TopicPictureState>( | |
448 | - builder: (context, state) { | |
445 | + Widget _voiceAnswerItem(CourseProcessTopics? topics) => | |
446 | + BlocBuilder<TopicPictureBloc, TopicPictureState>( | |
447 | + builder: (context, state) { | |
449 | 448 | final bloc = BlocProvider.of<TopicPictureBloc>(context); |
450 | 449 | return Row( |
451 | 450 | mainAxisAlignment: MainAxisAlignment.center, |
452 | 451 | children: [ |
453 | 452 | OwImageWidget( |
454 | - name:topics?.picUrl??'', | |
453 | + name: topics?.picUrl ?? '', | |
455 | 454 | height: 186.h, |
456 | 455 | width: 186.w, |
457 | 456 | ), |
... | ... | @@ -470,12 +469,14 @@ class _TopicPicturePage extends StatelessWidget { |
470 | 469 | child: Row( |
471 | 470 | children: [ |
472 | 471 | Image.asset( |
473 | - bloc.voicePlayState == VoicePlayState.playing?'reade_answer'.assetGif:'voice'.assetPng, | |
472 | + bloc.voicePlayState == VoicePlayState.playing | |
473 | + ? 'reade_answer'.assetGif | |
474 | + : 'voice'.assetPng, | |
474 | 475 | height: 52.h, |
475 | 476 | width: 46.w, |
476 | 477 | ), |
477 | 478 | 10.horizontalSpace, |
478 | - Text(topics?.word??'') | |
479 | + Text(topics?.word ?? '') | |
479 | 480 | ], |
480 | 481 | ), |
481 | 482 | ), |
... | ... | @@ -494,13 +495,17 @@ class _TopicPicturePage extends StatelessWidget { |
494 | 495 | } |
495 | 496 | if (topics?.type == TopicType.voiceQuestion.value || |
496 | 497 | topics?.type == TopicType.voiceWord.value) { |
497 | - bloc.add(XSVoiceStartEvent(topics?.keyWord??'', '0',UserUtil.getUser()!.id.toString())); | |
498 | + bloc.add(XSVoiceStartEvent(topics?.keyWord ?? '', '0', | |
499 | + UserUtil.getUser()!.id.toString())); | |
498 | 500 | } else { |
499 | - bloc.add(XSVoiceStartEvent(topics?.word??'', '0',UserUtil.getUser()!.id.toString())); | |
501 | + bloc.add(XSVoiceStartEvent(topics?.word ?? '', '0', | |
502 | + UserUtil.getUser()!.id.toString())); | |
500 | 503 | } |
501 | 504 | }, |
502 | 505 | child: Image.asset( |
503 | - bloc.isVoicing?'micro_phone'.assetGif:'micro_phone'.assetPng, | |
506 | + bloc.isVoicing | |
507 | + ? 'micro_phone'.assetGif | |
508 | + : 'micro_phone'.assetPng, | |
504 | 509 | height: 75.w, |
505 | 510 | width: 75.w, |
506 | 511 | ), | ... | ... |
lib/pages/practice/widgets/practice_header_widget.dart
... | ... | @@ -13,35 +13,35 @@ class PracticeHeaderWidget extends StatelessWidget { |
13 | 13 | Widget build(BuildContext context) { |
14 | 14 | return Container( |
15 | 15 | color: Colors.white, |
16 | - height: kToolbarHeight, | |
16 | + height: kToolbarHeight + 3.h, | |
17 | 17 | child: AppBar( |
18 | - leading: IconButton( | |
19 | - icon: Image.asset( | |
18 | + leading: GestureDetector( | |
19 | + child: Image.asset( | |
20 | 20 | 'back_around'.assetPng, |
21 | - width: 40, | |
22 | - height: 40, | |
21 | + width: 40.w, | |
22 | + height: 40.h, | |
23 | 23 | ), |
24 | - onPressed: () { | |
25 | - onTap(); | |
26 | - }, | |
24 | + onTap: () => {onTap()}, | |
27 | 25 | ), |
28 | 26 | centerTitle: true, |
29 | 27 | title: Container( |
30 | - height: 40.h, | |
31 | - padding: EdgeInsets.symmetric(horizontal: 27.w, vertical: 6.h), | |
32 | - decoration: BoxDecoration( | |
33 | - color: const Color(0xFF00B6F1), | |
34 | - borderRadius: BorderRadius.circular(20.r), | |
35 | - border: Border.all( | |
36 | - width: 1.0, | |
37 | - color: const Color(0xFF333333), | |
38 | - ), | |
39 | - ), | |
40 | - child: Text( | |
41 | - title, | |
42 | - style: TextStyle(fontSize: 15.sp, color: Colors.white), | |
43 | - ), | |
28 | + height: 40.h, | |
29 | + width: 100.w, // 容器宽度 | |
30 | + // padding: EdgeInsets.symmetric(horizontal: 27.w, vertical: 10.h), | |
31 | + alignment: Alignment.center, | |
32 | + decoration: BoxDecoration( | |
33 | + color: const Color(0xFF00B6F1), | |
34 | + borderRadius: BorderRadius.circular(20.r), | |
35 | + border: Border.all( | |
36 | + width: 1.0, | |
37 | + color: const Color(0xFF333333), | |
44 | 38 | ), |
39 | + ), | |
40 | + child: Text( | |
41 | + title, | |
42 | + style: TextStyle(fontSize: 15.sp, color: Colors.white), | |
43 | + ), | |
44 | + ), | |
45 | 45 | )); |
46 | 46 | } |
47 | 47 | } | ... | ... |