Commit 1dc46cf7dcef760b26cfc8b6818ff8afc6e36808
1 parent
ad8454ca
feat:绘本ui
Showing
5 changed files
with
127 additions
and
0 deletions
lib/main.dart
| ... | ... | @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; |
| 3 | 3 | import 'package:flutter/services.dart'; |
| 4 | 4 | import 'package:limiting_direction_csx/limiting_direction_csx.dart'; |
| 5 | 5 | import 'package:wow_english/app/app.dart'; |
| 6 | +import 'package:flutter/services.dart'; | |
| 6 | 7 | |
| 7 | 8 | void main() async { |
| 8 | 9 | ///设置设备默认方向 |
| ... | ... | @@ -11,6 +12,13 @@ void main() async { |
| 11 | 12 | await LimitingDirectionCsx.setScreenDirection(DeviceDirectionMask.Landscape); |
| 12 | 13 | } else { |
| 13 | 14 | await SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft,DeviceOrientation.landscapeRight]); |
| 15 | + // SystemChrome.setEnabledSystemUIMode( | |
| 16 | + // SystemUiMode.manual, | |
| 17 | + // overlays: [SystemUiOverlay.top], | |
| 18 | + // ); | |
| 19 | + SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( //设置状态栏透明 | |
| 20 | + statusBarColor: Colors.transparent, | |
| 21 | + )); | |
| 14 | 22 | } |
| 15 | 23 | runApp(const App()); |
| 16 | 24 | } | ... | ... |
lib/pages/reading/bloc/reading_bloc.dart
0 → 100644
| 1 | +import 'package:flutter/cupertino.dart'; | |
| 2 | +import 'package:flutter_bloc/flutter_bloc.dart'; | |
| 3 | + | |
| 4 | +part 'reading_event.dart'; | |
| 5 | +part 'reading_state.dart'; | |
| 6 | + | |
| 7 | +class ReadingPageBloc extends Bloc<ReadingPageEvent, ReadingPageState> { | |
| 8 | + ReadingPageBloc() : super(ReadingPageInitial()) { | |
| 9 | + on<ReadingPageEvent>((event, emit) { | |
| 10 | + // TODO: implement event handler | |
| 11 | + }); | |
| 12 | + } | |
| 13 | +} | ... | ... |
lib/pages/reading/bloc/reading_event.dart
0 → 100644
lib/pages/reading/bloc/reading_state.dart
0 → 100644
lib/pages/reading/reading_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/pages/practice/widgets/practice_header_widget.dart'; | |
| 6 | + | |
| 7 | +import 'bloc/reading_bloc.dart'; | |
| 8 | + | |
| 9 | +class ReadingItemPage extends StatelessWidget { | |
| 10 | + const ReadingItemPage({super.key}); | |
| 11 | + | |
| 12 | + @override | |
| 13 | + Widget build(BuildContext context) { | |
| 14 | + return BlocProvider( | |
| 15 | + create: (_) => ReadingPageBloc(), | |
| 16 | + child: _ReadingPage(), | |
| 17 | + ); | |
| 18 | + } | |
| 19 | +} | |
| 20 | + | |
| 21 | +class _ReadingPage extends StatelessWidget { | |
| 22 | + @override | |
| 23 | + Widget build(BuildContext context) { | |
| 24 | + return BlocListener<ReadingPageBloc, ReadingPageState>( | |
| 25 | + listener: (context, state) {}, | |
| 26 | + child: _voiceAnswerView(), | |
| 27 | + ); | |
| 28 | + } | |
| 29 | + | |
| 30 | + Widget _voiceAnswerView() => | |
| 31 | + BlocBuilder<ReadingPageBloc, ReadingPageState>(builder: (context, state) { | |
| 32 | + final bloc = BlocProvider.of<ReadingPageBloc>(context); | |
| 33 | + return Container( | |
| 34 | + color: Colors.white, | |
| 35 | + child: Stack( | |
| 36 | + children: [ | |
| 37 | + Positioned( | |
| 38 | + left: 0, | |
| 39 | + right: 0, | |
| 40 | + bottom: 0, | |
| 41 | + child: Image.asset( | |
| 42 | + 'bottom_grass'.assetPng, | |
| 43 | + fit: BoxFit.fitWidth, | |
| 44 | + )), | |
| 45 | + Column( | |
| 46 | + children: [ | |
| 47 | + PracticeHeaderWidget( | |
| 48 | + title: '1/8', | |
| 49 | + onTap: () { | |
| 50 | + Navigator.pop(context); | |
| 51 | + }, | |
| 52 | + ), | |
| 53 | + Expanded( | |
| 54 | + child: PageView.builder( | |
| 55 | + itemCount: 10, | |
| 56 | + itemBuilder: (context, int index) { | |
| 57 | + return _voiceAnswerItem(); | |
| 58 | + })) | |
| 59 | + ], | |
| 60 | + ) | |
| 61 | + ], | |
| 62 | + ), | |
| 63 | + ); | |
| 64 | + }); | |
| 65 | + | |
| 66 | + Widget _voiceAnswerItem() => | |
| 67 | + BlocBuilder<VoiceAnswerBloc, VoiceAnswerState>(builder: (context, state) { | |
| 68 | + return Row( | |
| 69 | + mainAxisAlignment: MainAxisAlignment.center, | |
| 70 | + children: [ | |
| 71 | + Image.network( | |
| 72 | + 'https://img.liblibai.com/web/648331d5a2cb5.png?image_process=format,webp&x-oss-process=image/resize,w_2980,m_lfit/format,webp', | |
| 73 | + height: 186.h, | |
| 74 | + width: 186.w, | |
| 75 | + ), | |
| 76 | + 160.horizontalSpace, | |
| 77 | + Column( | |
| 78 | + mainAxisAlignment: MainAxisAlignment.center, | |
| 79 | + children: [ | |
| 80 | + Image.asset( | |
| 81 | + 'voice'.assetPng, | |
| 82 | + height: 52.h, | |
| 83 | + width: 46.w, | |
| 84 | + ), | |
| 85 | + 70.verticalSpace, | |
| 86 | + Image.asset( | |
| 87 | + 'micro_phone'.assetPng, | |
| 88 | + height: 75.w, | |
| 89 | + width: 75.w, | |
| 90 | + ) | |
| 91 | + ], | |
| 92 | + ) | |
| 93 | + ], | |
| 94 | + ); | |
| 95 | + }); | |
| 96 | +} | ... | ... |