Commit 82c8633c4dc35f8c5bae3f4f69b512cd9b6c3402

Authored by biao
1 parent fac6a671

音频添加 页面优化

.fvm/flutter_sdk
1   -/Users/stay/fvm/versions/3.19.2
2 1 \ No newline at end of file
  2 +/Users/biao/fvm/versions/3.19.2
3 3 \ No newline at end of file
... ...
.fvm/fvm_config.json
1 1 {
2   - "flutterSdkVersion": "3.19.2",
3   - "flavors": {}
  2 + "flutterSdkVersion": "3.19.2"
4 3 }
5 4 \ No newline at end of file
... ...
assets/images/micro_phone.gif

17.3 KB | W: | H:

17.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
assets/images/reade_answer.gif 100644 → 100755

5.31 KB | W: | H:

2.47 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
assets/images/voice.png

8.3 KB | W: | H:

13 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
assets/sounds/class_time.mp3 0 → 100644
No preview for this file type
assets/sounds/game_time.mp3 0 → 100644
No preview for this file type
assets/sounds/music_time.mp3 0 → 100644
No preview for this file type
assets/sounds/quiz_time.mp3 0 → 100644
No preview for this file type
assets/sounds/reading_time.mp3 0 → 100644
No preview for this file type
assets/sounds/video_time.mp3 0 → 100644
No preview for this file type
assets/sounds/welcome_to_wow.mp3 0 → 100644
No preview for this file type
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 = 13;
  2330 + CURRENT_PROJECT_VERSION = 15;
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 = 13;
  2674 + CURRENT_PROJECT_VERSION = 15;
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 = 13;
  2879 + CURRENT_PROJECT_VERSION = 15;
2880 2880 DEVELOPMENT_TEAM = T8P9KW8GWH;
2881 2881 ENABLE_BITCODE = NO;
2882 2882 INFOPLIST_FILE = Runner/Info.plist;
... ...
ios/Runner/Info.plist
... ... @@ -77,11 +77,11 @@
77 77 <true/>
78 78 </dict>
79 79 <key>NSCameraUsageDescription</key>
80   - <string>需要访问相机完成拍照</string>
  80 + <string>需要访问相机,完成修改头像功能</string>
81 81 <key>NSMicrophoneUsageDescription</key>
82   - <string>需要获取录音完成后续功能</string>
  82 + <string>需要获取录音,完成上课功能</string>
83 83 <key>NSPhotoLibraryUsageDescription</key>
84   - <string>需要获取照片用来修改头像</string>
  84 + <string>需要获取照片,完成上传头像功能</string>
85 85 <key>UIApplicationSupportsIndirectInputEvents</key>
86 86 <true/>
87 87 <key>UILaunchStoryboardName</key>
... ...
lib/pages/home/bloc.dart
  1 +import 'package:audioplayers/audioplayers.dart';
1 2 import 'package:bloc/bloc.dart';
  3 +import 'package:wow_english/common/extension/string_extension.dart';
2 4  
3 5 import '../../common/core/app_config_helper.dart';
4 6 import '../../common/request/dao/system_dao.dart';
... ... @@ -16,6 +18,7 @@ class HomeBloc extends Bloc&lt;HomeEvent, HomeState&gt; {
16 18 bool exchangeResult = false;
17 19  
18 20 void _init(InitEvent event, Emitter<HomeState> emit) async {
  21 + AudioPlayer().play(AssetSource('welcome_to_wow'.assetMp3));
19 22 await _checkUpdate(emit);
20 23 }
21 24  
... ...
lib/pages/home/view.dart
  1 +import 'package:audioplayers/audioplayers.dart';
1 2 import 'package:flutter/material.dart';
2 3 import 'package:flutter_app_update/azhon_app_update.dart';
3 4 import 'package:flutter_app_update/update_model.dart';
... ... @@ -70,6 +71,8 @@ class _HomePageView extends StatelessWidget {
70 71 child: GestureDetector(
71 72 onTap: () {
72 73 _checkPermission(() {
  74 + AudioPlayer()
  75 + .play(AssetSource('class_time'.assetMp3));
73 76 pushNamed(AppRouteName.courseUnit)
74 77 .then((value) => {
75 78 if (value != null)
... ... @@ -120,19 +123,9 @@ class _HomePageView extends StatelessWidget {
120 123 child: Column(
121 124 mainAxisAlignment: MainAxisAlignment.center,
122 125 children: [
123   - Stack(
124   - alignment: AlignmentDirectional.center,
125   - children: [
126   - Image.asset(
127   - 'bg_frame_module'.assetPng,
128   - width: 162.5.w,
129   - height: 203.5.h),
130   - Image.asset('xe_shop'.assetPng,
131   - width: 140.5.w, height: 172.h)
132   - ]),
133   - 44.verticalSpace,
134   - // Image.asset('label_module_game'.assetPng,
135   - // width: 124.w, height: 34.h),
  126 + Image.asset('xe_shop'.assetPng,
  127 + width: 140.5.w, height: 172.h),
  128 + 44.verticalSpace
136 129 ],
137 130 ));
138 131 }),
... ... @@ -143,6 +136,8 @@ class _HomePageView extends StatelessWidget {
143 136 return GestureDetector(
144 137 onTap: () {
145 138 _checkPermission(() {
  139 + AudioPlayer().play(
  140 + AssetSource('game_time'.assetMp3));
146 141 pushNamed(AppRouteName.games);
147 142 }, bloc);
148 143 },
... ...
lib/pages/practice/topic_picture_page.dart
... ... @@ -59,7 +59,12 @@ class _TopicPicturePage extends StatelessWidget {
59 59 builder: (context, state) {
60 60 final bloc = BlocProvider.of<TopicPictureBloc>(context);
61 61 return Container(
62   - color: Colors.white,
  62 + decoration: BoxDecoration(
  63 + image: DecorationImage(
  64 + image: AssetImage('read_background'.assetPng), // 背景图片路径
  65 + fit: BoxFit.cover, // 适应图片的方式
  66 + ),
  67 + ),
63 68 child: Stack(
64 69 children: [
65 70 Column(
... ... @@ -75,6 +80,7 @@ class _TopicPicturePage extends StatelessWidget {
75 80 // Navigator.pop(context);
76 81 },
77 82 ),
  83 + 35.verticalSpace,
78 84 Expanded(
79 85 child: PageView.builder(
80 86 itemCount: bloc.entity?.topics?.length,
... ... @@ -109,12 +115,7 @@ class _TopicPicturePage extends StatelessWidget {
109 115 }),
110 116 )
111 117 ],
112   - ),
113   - Positioned(
114   - left: 0,
115   - right: 0,
116   - bottom: 0,
117   - child: Image.asset('bottom_grass'.assetPng))
  118 + )
118 119 ],
119 120 ),
120 121 );
... ... @@ -299,7 +300,7 @@ class _TopicPicturePage extends StatelessWidget {
299 300 26.verticalSpace,
300 301 SizedBox(
301 302 height: 143.h,
302   - width: 163.w * (topics?.topicAnswerList?.length ?? 0),
  303 + width: 203.w * (topics?.topicAnswerList?.length ?? 0),
303 304 child: ListView.builder(
304 305 scrollDirection: Axis.horizontal,
305 306 physics: const NeverScrollableScrollPhysics(),
... ... @@ -321,7 +322,7 @@ class _TopicPicturePage extends StatelessWidget {
321 322 builder: (context, state) {
322 323 final bloc = BlocProvider.of<TopicPictureBloc>(context);
323 324 return Container(
324   - padding: EdgeInsets.symmetric(horizontal: 10.w),
  325 + padding: EdgeInsets.symmetric(horizontal: 20.w),
325 326 child: GestureDetector(
326 327 onTap: () => bloc.add(SelectItemEvent(index)),
327 328 child: Container(
... ... @@ -333,15 +334,13 @@ class _TopicPicturePage extends StatelessWidget {
333 334 borderRadius: BorderRadius.circular(15),
334 335 ),
335 336 height: 143.h,
336   - width: 143.w,
  337 + width: 163.w,
337 338 child: Container(
338 339 decoration: BoxDecoration(
339 340 color: Colors.white,
340 341 borderRadius: BorderRadius.circular(15),
341   - border: Border.all(
342   - width: 1.0, color: const Color(0xFF140C10)),
343 342 image: DecorationImage(
344   - fit: BoxFit.fitWidth,
  343 + fit: BoxFit.fill,
345 344 image: NetworkImage(answerList?.picUrl ?? ''))),
346 345 ),
347 346 ),
... ... @@ -449,12 +448,18 @@ class _TopicPicturePage extends StatelessWidget {
449 448 return Row(
450 449 mainAxisAlignment: MainAxisAlignment.center,
451 450 children: [
452   - OwImageWidget(
453   - name: topics?.picUrl ?? '',
454   - height: 186.h,
455   - width: 186.w,
  451 + ClipRRect(
  452 + borderRadius: BorderRadius.circular(20),
  453 + child: Container(
  454 + color: Colors.white,
  455 + child: OwImageWidget(
  456 + name: topics?.picUrl ?? '',
  457 + height: 186.h,
  458 + width: 186.w,
  459 + ),
  460 + ),
456 461 ),
457   - 160.horizontalSpace,
  462 + 120.horizontalSpace,
458 463 Column(
459 464 mainAxisAlignment: MainAxisAlignment.center,
460 465 children: [
... ... @@ -472,8 +477,8 @@ class _TopicPicturePage extends StatelessWidget {
472 477 bloc.voicePlayState == VoicePlayState.playing
473 478 ? 'reade_answer'.assetGif
474 479 : 'voice'.assetPng,
475   - height: 52.h,
476   - width: 46.w,
  480 + height: 45.h,
  481 + width: 45.w,
477 482 ),
478 483 10.horizontalSpace,
479 484 Text(topics?.word ?? '')
... ... @@ -506,8 +511,8 @@ class _TopicPicturePage extends StatelessWidget {
506 511 bloc.isVoicing
507 512 ? 'micro_phone'.assetGif
508 513 : 'micro_phone'.assetPng,
509   - height: 75.w,
510   - width: 75.w,
  514 + height: 46.h,
  515 + width: 46.w,
511 516 ),
512 517 )
513 518 ],
... ...
lib/pages/practice/widgets/practice_header_widget.dart
... ... @@ -12,9 +12,10 @@ class PracticeHeaderWidget extends StatelessWidget {
12 12 @override
13 13 Widget build(BuildContext context) {
14 14 return Container(
15   - color: Colors.white,
  15 + color: Colors.transparent,
16 16 height: kToolbarHeight + 3.h,
17 17 child: AppBar(
  18 + backgroundColor: Colors.transparent,
18 19 leading: GestureDetector(
19 20 child: Image.asset(
20 21 'back_around'.assetPng,
... ... @@ -25,7 +26,7 @@ class PracticeHeaderWidget extends StatelessWidget {
25 26 ),
26 27 centerTitle: true,
27 28 title: Container(
28   - height: 40.h,
  29 + height: 20.h,
29 30 width: 100.w, // 容器宽度
30 31 // padding: EdgeInsets.symmetric(horizontal: 27.w, vertical: 10.h),
31 32 alignment: Alignment.center,
... ...
lib/pages/reading/bloc/reading_event.dart
... ... @@ -39,7 +39,7 @@ class XSVoiceStartEvent extends ReadingPageEvent {
39 39 final String content;
40 40 final String type;
41 41 final String? userId;
42   - XSVoiceStartEvent(this.content,this.type,this.userId);
  42 + XSVoiceStartEvent(this.content, this.type, this.userId);
43 43 }
44 44  
45 45 ///先声评测停止
... ... @@ -52,4 +52,7 @@ class OnXSVoiceStateChangeEvent extends ReadingPageEvent {}
52 52 class VoicePlayStateChangeEvent extends ReadingPageEvent {}
53 53  
54 54 ///录音播放
55   -class PlayRecordAudioEvent extends ReadingPageEvent {}
56 55 \ No newline at end of file
  56 +class PlayRecordAudioEvent extends ReadingPageEvent {}
  57 +
  58 +///播放下一页
  59 +class PlayNextPageEvent extends ReadingPageEvent {}
... ...
lib/pages/reading/reading_page.dart
... ... @@ -21,17 +21,16 @@ class ReadingPage extends StatelessWidget {
21 21 @override
22 22 Widget build(BuildContext context) {
23 23 return BlocProvider(
24   - create: (_) => ReadingPageBloc(context, PageController(), courseLessonId ?? '')
25   - ..add(InitBlocEvent())
26   - ..add(RequestDataEvent())
27   - ..add(XSVoiceInitEvent(
28   - {
29   - 'appKey':AppConsts.xsAppKey,
30   - 'service':AppConsts.xsAppService,
31   - 'secretKey':AppConsts.xsAppSecretKey,
32   - 'userId':UserUtil.getUser()!.id.toString(),
33   - }
34   - )),
  24 + create: (_) =>
  25 + ReadingPageBloc(context, PageController(), courseLessonId ?? '')
  26 + ..add(InitBlocEvent())
  27 + ..add(RequestDataEvent())
  28 + ..add(XSVoiceInitEvent({
  29 + 'appKey': AppConsts.xsAppKey,
  30 + 'service': AppConsts.xsAppService,
  31 + 'secretKey': AppConsts.xsAppSecretKey,
  32 + 'userId': UserUtil.getUser()!.id.toString(),
  33 + })),
35 34 child: _ReadingPage(),
36 35 );
37 36 }
... ... @@ -60,8 +59,8 @@ class _ReadingPage extends StatelessWidget {
60 59 );
61 60 }
62 61  
63   - Widget _readingPageView() => BlocBuilder<ReadingPageBloc, ReadingPageState>(
64   - builder: (context, state) {
  62 + Widget _readingPageView() =>
  63 + BlocBuilder<ReadingPageBloc, ReadingPageState>(builder: (context, state) {
65 64 final bloc = BlocProvider.of<ReadingPageBloc>(context);
66 65 return Container(
67 66 color: Colors.white,
... ... @@ -84,16 +83,14 @@ class _ReadingPage extends StatelessWidget {
84 83 children: [
85 84 Padding(
86 85 padding:
87   - EdgeInsets.only(left: ScreenUtil().bottomBarHeight),
  86 + EdgeInsets.only(left: ScreenUtil().bottomBarHeight),
88 87 child: IconButton(
89 88 onPressed: () {
90   - popPage(
91   - data:{
92   - 'currentStep':bloc.currentPage,
93   - 'courseLessonId':bloc.courseLessonId,
94   - 'isCompleted':bloc.isLastPage(),
95   - }
96   - );
  89 + popPage(data: {
  90 + 'currentStep': bloc.currentPage,
  91 + 'courseLessonId': bloc.courseLessonId,
  92 + 'isCompleted': bloc.isLastPage(),
  93 + });
97 94 },
98 95 icon: Image.asset(
99 96 'back_around'.assetPng,
... ... @@ -167,7 +164,7 @@ class _ReadingPage extends StatelessWidget {
167 164 },
168 165 child: Image.asset(
169 166 bloc.voicePlayState == VoicePlayState.playing &&
170   - bloc.isOriginAudioPlaying
  167 + bloc.isOriginAudioPlaying
171 168 ? 'reade_answer'.assetGif
172 169 : 'voice'.assetPng,
173 170 height: 40.h,
... ... @@ -179,12 +176,12 @@ class _ReadingPage extends StatelessWidget {
179 176 ),
180 177 Expanded(
181 178 child: Text(
182   - bloc.currentPageData()?.word?.trim() ?? '',
183   - style: TextStyle(
184   - color: const Color(0xFF333333), fontSize: 21.sp),
185   - maxLines: 2,
186   - overflow: TextOverflow.ellipsis,
187   - )),
  179 + bloc.currentPageData()?.word?.trim() ?? '',
  180 + style: TextStyle(
  181 + color: const Color(0xFF333333), fontSize: 21.sp),
  182 + maxLines: 2,
  183 + overflow: TextOverflow.ellipsis,
  184 + )),
188 185 SizedBox(
189 186 width: 10.w,
190 187 ),
... ... @@ -241,8 +238,7 @@ class _ReadingPage extends StatelessWidget {
241 238 return Stack(
242 239 children: [
243 240 Positioned.fill(
244   - child:
245   - Image.network(readings.picUrl ?? '', fit: BoxFit.cover),
  241 + child: Image.network(readings.picUrl ?? '', fit: BoxFit.cover),
246 242 ),
247 243 ],
248 244 );
... ...
lib/pages/section/section_page.dart
  1 +import 'package:audioplayers/audioplayers.dart';
1 2 import 'package:flutter/cupertino.dart';
2 3 import 'package:flutter/material.dart';
3 4 import 'package:flutter_bloc/flutter_bloc.dart';
... ... @@ -96,12 +97,18 @@ class _SectionPageView extends StatelessWidget {
96 97 state.courseType != SectionType.pictureBook.value) {
97 98 ///视频类型
98 99 ///获取视频课程内容
  100 + if (state.courseType == 1) {
  101 + AudioPlayer().play(AssetSource('music_time'.assetMp3));
  102 + } else {
  103 + AudioPlayer().play(AssetSource('video_time'.assetMp3));
  104 + }
99 105 bloc.add(RequestVideoLessonEvent(
100 106 state.courseLessonId, state.courseType));
101 107 return;
102 108 }
103 109  
104 110 if (state.courseType == SectionType.pictureBook.value) {
  111 + AudioPlayer().play(AssetSource('reading_time'.assetMp3));
105 112 //绘本
106 113 pushNamed(AppRouteName.reading,
107 114 arguments: {'courseLessonId': state.courseLessonId})
... ... @@ -121,6 +128,7 @@ class _SectionPageView extends StatelessWidget {
121 128  
122 129 if (state.courseType == SectionType.practice.value) {
123 130 //练习
  131 + AudioPlayer().play(AssetSource('quiz_time'.assetMp3));
124 132 pushNamed(AppRouteName.topicPic,
125 133 arguments: {'courseLessonId': state.courseLessonId})
126 134 .then((value) {
... ...
lib/pages/user/user_page.dart
... ... @@ -173,15 +173,7 @@ class _UserView extends StatelessWidget {
173 173 UserUtil.getUser()?.phoneNum == '17718485544')
174 174 ? 12.verticalSpace
175 175 : 1.verticalSpace),
176   - OutlinedButton(
177   - onPressed: () => pushNamed(AppRouteName.fogPwd),
178   - style: normalButtonStyle,
179   - child: Text(
180   - "修改密码",
181   - style: textStyle21sp,
182   - ),
183   - ),
184   - 12.verticalSpace,
  176 +
185 177 Offstage(
186 178 offstage: AppConfigHelper.shouldHidePay(),
187 179 child: OutlinedButton(
... ... @@ -199,6 +191,15 @@ class _UserView extends StatelessWidget {
199 191 style: textStyle21sp,
200 192 )),
201 193 ),
  194 + 12.verticalSpace,
  195 + OutlinedButton(
  196 + onPressed: () => pushNamed(AppRouteName.fogPwd),
  197 + style: normalButtonStyle,
  198 + child: Text(
  199 + "修改密码",
  200 + style: textStyle21sp,
  201 + ),
  202 + ),
202 203 Offstage(
203 204 offstage: AppConfigHelper.shouldHidePay(),
204 205 child: 12.verticalSpace,
... ...