diff --git a/assets/images/micro_phone.png b/assets/images/micro_phone.png new file mode 100644 index 0000000..c382ebf --- /dev/null +++ b/assets/images/micro_phone.png diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 285ff64..2ddb912 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -37,7 +37,8 @@ class _HomePageView extends StatelessWidget { // Navigator.of(AppRouter.context).pushNamed(AppRouteName.topicWord); // Navigator.of(AppRouter.context).pushNamed(AppRouteName.lookVideo); // Navigator.of(AppRouter.context).pushNamed(AppRouteName.voicePic); - Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceWord); + // Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceWord); + Navigator.of(AppRouter.context).pushNamed(AppRouteName.voiceAnswer); } } diff --git a/lib/route/route.dart b/lib/route/route.dart index 80362aa..6fa7707 100644 --- a/lib/route/route.dart +++ b/lib/route/route.dart @@ -19,6 +19,7 @@ import 'package:wow_english/shop/home/shop_home_page.dart'; import 'package:wow_english/tab/tab_page.dart'; import 'package:wow_english/user/user_page.dart'; import 'package:wow_english/video/lookvideo/look_video_page.dart'; +import 'package:wow_english/voiceanswer/voice_answer_page.dart'; class AppRouteName { @@ -38,6 +39,7 @@ class AppRouteName { static const String topicWord = 'topicWord'; static const String voicePic = 'voicePic'; static const String voiceWord = 'voiceWord'; + static const String voiceAnswer = 'voiceAnswer'; static const String user = 'user'; static const String lookVideo = 'lookVideo'; static const String tab = '/'; @@ -84,6 +86,8 @@ class AppRouter { return CupertinoPageRoute(builder: (_) => const VoicePicPage()); case AppRouteName.voiceWord: return CupertinoPageRoute(builder: (_) => const VoiceWordPage()); + case AppRouteName.voiceAnswer: + return CupertinoPageRoute(builder: (_) => const VoiceAnswerPage()); case AppRouteName.lookVideo: return CupertinoPageRoute(builder: (_) => const LookVideoPage()); case AppRouteName.setPwd: diff --git a/lib/voiceanswer/bloc/voice_answer_bloc.dart b/lib/voiceanswer/bloc/voice_answer_bloc.dart new file mode 100644 index 0000000..745bb16 --- /dev/null +++ b/lib/voiceanswer/bloc/voice_answer_bloc.dart @@ -0,0 +1,13 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +part 'voice_answer_event.dart'; +part 'voice_answer_state.dart'; + +class VoiceAnswerBloc extends Bloc { + VoiceAnswerBloc() : super(VoiceAnswerInitial()) { + on((event, emit) { + // TODO: implement event handler + }); + } +} diff --git a/lib/voiceanswer/bloc/voice_answer_event.dart b/lib/voiceanswer/bloc/voice_answer_event.dart new file mode 100644 index 0000000..e18461e --- /dev/null +++ b/lib/voiceanswer/bloc/voice_answer_event.dart @@ -0,0 +1,4 @@ +part of 'voice_answer_bloc.dart'; + +@immutable +abstract class VoiceAnswerEvent {} diff --git a/lib/voiceanswer/bloc/voice_answer_state.dart b/lib/voiceanswer/bloc/voice_answer_state.dart new file mode 100644 index 0000000..07b6716 --- /dev/null +++ b/lib/voiceanswer/bloc/voice_answer_state.dart @@ -0,0 +1,6 @@ +part of 'voice_answer_bloc.dart'; + +@immutable +abstract class VoiceAnswerState {} + +class VoiceAnswerInitial extends VoiceAnswerState {} diff --git a/lib/voiceanswer/voice_answer_page.dart b/lib/voiceanswer/voice_answer_page.dart new file mode 100644 index 0000000..246f3b3 --- /dev/null +++ b/lib/voiceanswer/voice_answer_page.dart @@ -0,0 +1,94 @@ +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'; +import 'package:wow_english/practice/widgets/practice_header_widget.dart'; +import 'package:wow_english/voiceanswer/bloc/voice_answer_bloc.dart'; + +class VoiceAnswerPage extends StatelessWidget { + const VoiceAnswerPage({super.key}); + + @override + Widget build(BuildContext context) { + return BlocProvider( + create: (_) => VoiceAnswerBloc(), + child: _VoiceAnswerPage(), + ); + } +} + +class _VoiceAnswerPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BlocListener( + listener: (context, state) {}, + child: _voiceAnswerView(), + ); + } + + Widget _voiceAnswerView() => BlocBuilder( + builder: (context, state) { + final bloc = BlocProvider.of(context); + return Container( + color: Colors.white, + child: Stack( + children: [ + Positioned( + left: 0, + right: 0, + bottom: 0, + child: Image.asset( + 'bottom_grass'.assetPng, + fit: BoxFit.fitWidth, + )), + Column( + children: [ + PracticeHeaderWidget( + title: '1/8', + onTap: () { + Navigator.pop(context); + }, + ), + Expanded( + child: PageView.builder( + itemCount: 10, + itemBuilder: (context, int index) { + return _voiceAnswerItem(); + })) + ], + ) + ], + ), + ); + }); + + Widget _voiceAnswerItem() => BlocBuilder(builder: (context, state) { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.network( + 'https://img.liblibai.com/web/648331d5a2cb5.png?image_process=format,webp&x-oss-process=image/resize,w_2980,m_lfit/format,webp', + height: 186.h, + width: 186.w, + ), + 160.horizontalSpace, + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'voice'.assetPng, + height: 52.h, + width: 46.w, + ), + 70.verticalSpace, + Image.asset( + 'micro_phone'.assetPng, + height: 75.w, + width: 75.w, + ) + ], + ) + ], + ); + }); +}