Commit 725dc3f264ab5fbf01c60adb6bfb64b5dcc5ad14
1 parent
95e3448c
feat:语音问答界面UI
Showing
7 changed files
with
123 additions
and
1 deletions
assets/images/micro_phone.png
0 → 100644
20 KB
lib/home/home_page.dart
@@ -37,7 +37,8 @@ class _HomePageView extends StatelessWidget { | @@ -37,7 +37,8 @@ class _HomePageView extends StatelessWidget { | ||
37 | // Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicWord); | 37 | // Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicWord); |
38 | // Navigator.of(AppRouter.context).pushNamed(AppRouteName.lookVideo); | 38 | // Navigator.of(AppRouter.context).pushNamed(AppRouteName.lookVideo); |
39 | // Navigator.of(AppRouter.context).pushNamed(AppRouteName.voicePic); | 39 | // Navigator.of(AppRouter.context).pushNamed(AppRouteName.voicePic); |
40 | - Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceWord); | 40 | + // Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceWord); |
41 | + Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceAnswer); | ||
41 | } | 42 | } |
42 | } | 43 | } |
43 | 44 |
lib/route/route.dart
@@ -19,6 +19,7 @@ import 'package:wow_english/shop/home/shop_home_page.dart'; | @@ -19,6 +19,7 @@ import 'package:wow_english/shop/home/shop_home_page.dart'; | ||
19 | import 'package:wow_english/tab/tab_page.dart'; | 19 | import 'package:wow_english/tab/tab_page.dart'; |
20 | import 'package:wow_english/user/user_page.dart'; | 20 | import 'package:wow_english/user/user_page.dart'; |
21 | import 'package:wow_english/video/lookvideo/look_video_page.dart'; | 21 | import 'package:wow_english/video/lookvideo/look_video_page.dart'; |
22 | +import 'package:wow_english/voiceanswer/voice_answer_page.dart'; | ||
22 | 23 | ||
23 | 24 | ||
24 | class AppRouteName { | 25 | class AppRouteName { |
@@ -38,6 +39,7 @@ class AppRouteName { | @@ -38,6 +39,7 @@ class AppRouteName { | ||
38 | static const String topicWord = 'topicWord'; | 39 | static const String topicWord = 'topicWord'; |
39 | static const String voicePic = 'voicePic'; | 40 | static const String voicePic = 'voicePic'; |
40 | static const String voiceWord = 'voiceWord'; | 41 | static const String voiceWord = 'voiceWord'; |
42 | + static const String voiceAnswer = 'voiceAnswer'; | ||
41 | static const String user = 'user'; | 43 | static const String user = 'user'; |
42 | static const String lookVideo = 'lookVideo'; | 44 | static const String lookVideo = 'lookVideo'; |
43 | static const String tab = '/'; | 45 | static const String tab = '/'; |
@@ -84,6 +86,8 @@ class AppRouter { | @@ -84,6 +86,8 @@ class AppRouter { | ||
84 | return CupertinoPageRoute(builder: (_) => const VoicePicPage()); | 86 | return CupertinoPageRoute(builder: (_) => const VoicePicPage()); |
85 | case AppRouteName.voiceWord: | 87 | case AppRouteName.voiceWord: |
86 | return CupertinoPageRoute(builder: (_) => const VoiceWordPage()); | 88 | return CupertinoPageRoute(builder: (_) => const VoiceWordPage()); |
89 | + case AppRouteName.voiceAnswer: | ||
90 | + return CupertinoPageRoute(builder: (_) => const VoiceAnswerPage()); | ||
87 | case AppRouteName.lookVideo: | 91 | case AppRouteName.lookVideo: |
88 | return CupertinoPageRoute(builder: (_) => const LookVideoPage()); | 92 | return CupertinoPageRoute(builder: (_) => const LookVideoPage()); |
89 | case AppRouteName.setPwd: | 93 | case AppRouteName.setPwd: |
lib/voiceanswer/bloc/voice_answer_bloc.dart
0 → 100644
1 | +import 'package:flutter/cupertino.dart'; | ||
2 | +import 'package:flutter_bloc/flutter_bloc.dart'; | ||
3 | + | ||
4 | +part 'voice_answer_event.dart'; | ||
5 | +part 'voice_answer_state.dart'; | ||
6 | + | ||
7 | +class VoiceAnswerBloc extends Bloc<VoiceAnswerEvent, VoiceAnswerState> { | ||
8 | + VoiceAnswerBloc() : super(VoiceAnswerInitial()) { | ||
9 | + on<VoiceAnswerEvent>((event, emit) { | ||
10 | + // TODO: implement event handler | ||
11 | + }); | ||
12 | + } | ||
13 | +} |
lib/voiceanswer/bloc/voice_answer_event.dart
0 → 100644
lib/voiceanswer/bloc/voice_answer_state.dart
0 → 100644
lib/voiceanswer/voice_answer_page.dart
0 → 100644
1 | +import 'package:flutter/material.dart'; | ||
2 | +import 'package:flutter_bloc/flutter_bloc.dart'; | ||
3 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
4 | +import 'package:wow_english/common/extension/string_extension.dart'; | ||
5 | +import 'package:wow_english/practice/widgets/practice_header_widget.dart'; | ||
6 | +import 'package:wow_english/voiceanswer/bloc/voice_answer_bloc.dart'; | ||
7 | + | ||
8 | +class VoiceAnswerPage extends StatelessWidget { | ||
9 | + const VoiceAnswerPage({super.key}); | ||
10 | + | ||
11 | + @override | ||
12 | + Widget build(BuildContext context) { | ||
13 | + return BlocProvider( | ||
14 | + create: (_) => VoiceAnswerBloc(), | ||
15 | + child: _VoiceAnswerPage(), | ||
16 | + ); | ||
17 | + } | ||
18 | +} | ||
19 | + | ||
20 | +class _VoiceAnswerPage extends StatelessWidget { | ||
21 | + @override | ||
22 | + Widget build(BuildContext context) { | ||
23 | + return BlocListener<VoiceAnswerBloc,VoiceAnswerState>( | ||
24 | + listener: (context, state) {}, | ||
25 | + child: _voiceAnswerView(), | ||
26 | + ); | ||
27 | + } | ||
28 | + | ||
29 | + Widget _voiceAnswerView() => BlocBuilder<VoiceAnswerBloc,VoiceAnswerState>( | ||
30 | + builder: (context, state) { | ||
31 | + final bloc = BlocProvider.of<VoiceAnswerBloc>(context); | ||
32 | + return Container( | ||
33 | + color: Colors.white, | ||
34 | + child: Stack( | ||
35 | + children: [ | ||
36 | + Positioned( | ||
37 | + left: 0, | ||
38 | + right: 0, | ||
39 | + bottom: 0, | ||
40 | + child: Image.asset( | ||
41 | + 'bottom_grass'.assetPng, | ||
42 | + fit: BoxFit.fitWidth, | ||
43 | + )), | ||
44 | + Column( | ||
45 | + children: [ | ||
46 | + PracticeHeaderWidget( | ||
47 | + title: '1/8', | ||
48 | + onTap: () { | ||
49 | + Navigator.pop(context); | ||
50 | + }, | ||
51 | + ), | ||
52 | + Expanded( | ||
53 | + child: PageView.builder( | ||
54 | + itemCount: 10, | ||
55 | + itemBuilder: (context, int index) { | ||
56 | + return _voiceAnswerItem(); | ||
57 | + })) | ||
58 | + ], | ||
59 | + ) | ||
60 | + ], | ||
61 | + ), | ||
62 | + ); | ||
63 | + }); | ||
64 | + | ||
65 | + Widget _voiceAnswerItem() => BlocBuilder<VoiceAnswerBloc,VoiceAnswerState>(builder: (context, state) { | ||
66 | + return Row( | ||
67 | + mainAxisAlignment: MainAxisAlignment.center, | ||
68 | + children: [ | ||
69 | + Image.network( | ||
70 | + 'https://img.liblibai.com/web/648331d5a2cb5.png?image_process=format,webp&x-oss-process=image/resize,w_2980,m_lfit/format,webp', | ||
71 | + height: 186.h, | ||
72 | + width: 186.w, | ||
73 | + ), | ||
74 | + 160.horizontalSpace, | ||
75 | + Column( | ||
76 | + mainAxisAlignment: MainAxisAlignment.center, | ||
77 | + children: [ | ||
78 | + Image.asset( | ||
79 | + 'voice'.assetPng, | ||
80 | + height: 52.h, | ||
81 | + width: 46.w, | ||
82 | + ), | ||
83 | + 70.verticalSpace, | ||
84 | + Image.asset( | ||
85 | + 'micro_phone'.assetPng, | ||
86 | + height: 75.w, | ||
87 | + width: 75.w, | ||
88 | + ) | ||
89 | + ], | ||
90 | + ) | ||
91 | + ], | ||
92 | + ); | ||
93 | + }); | ||
94 | +} |