Blame view

lib/pages/voiceanswer/voice_answer_page.dart 2.88 KB
725dc3f2   liangchengyou   feat:语音问答界面UI
1
2
3
4
  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';
4b358e22   liangchengyou   feat:调整文件结构
5
6
7
  import 'package:wow_english/pages/practice/widgets/practice_header_widget.dart';
  
  import 'bloc/voice_answer_bloc.dart';
725dc3f2   liangchengyou   feat:语音问答界面UI
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  
  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<VoiceAnswerBloc,VoiceAnswerState>(
        listener: (context, state) {},
        child: _voiceAnswerView(),
      );
    }
  
    Widget _voiceAnswerView() => BlocBuilder<VoiceAnswerBloc,VoiceAnswerState>(
        builder: (context, state) {
          final bloc = BlocProvider.of<VoiceAnswerBloc>(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<VoiceAnswerBloc,VoiceAnswerState>(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,
                  )
                ],
              )
            ],
          );
        });
  }