Blame view

lib/pages/user/user_page.dart 2.54 KB
22b7d4da   Key   feat: user, api path
1
  import 'package:flutter/material.dart';
089ccd5c   Key   fixed: user util ...
2
  import 'package:flutter_bloc/flutter_bloc.dart';
e12dbc82   Key   user module
3
  import 'package:flutter_screenutil/flutter_screenutil.dart';
089ccd5c   Key   fixed: user util ...
4
  import 'package:wow_english/common/blocs/cachebloc/cache_bloc.dart';
e12dbc82   Key   user module
5
6
  import 'package:wow_english/common/core/assets_const.dart';
  import 'package:wow_english/common/extension/string_extension.dart';
4b358e22   liangchengyou   feat:调整文件结构
7
  import 'package:wow_english/common/widgets/we_app_bar.dart';
089ccd5c   Key   fixed: user util ...
8
  import 'package:wow_english/models/user_entity.dart';
e12dbc82   Key   user module
9
  import 'package:wow_english/pages/user/bloc/user_bloc.dart';
22b7d4da   Key   feat: user, api path
10
11
12
13
14
15
  
  class UserPage extends StatelessWidget {
    const UserPage({super.key});
  
    @override
    Widget build(BuildContext context) {
e12dbc82   Key   user module
16
17
18
19
20
21
22
23
24
25
26
27
      return BlocProvider(
        create: (context) => UserBloc(),
        child: _UserView(),
      );
    }
  }
  
  class _UserView extends StatelessWidget {
    const _UserView({super.key});
  
    @override
    Widget build(BuildContext context) {
089ccd5c   Key   fixed: user util ...
28
29
      UserEntity? user = context.read<CacheBloc>().userEntity;
      return Scaffold(
e12dbc82   Key   user module
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
          backgroundColor: Colors.white,
          appBar: WEAppBar(
            // 测试用的
            titleText: user?.name ?? '个人中心',
          ),
          body: SingleChildScrollView(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Container(
                    child: Image.asset(AssetsConst.wowLogo.assetImg), constraints: BoxConstraints(maxHeight: 196.h)),
                _userInfo(context),
              ],
            ),
          ));
    }
  
    Widget _userInfo(BuildContext context) {
      return Row(
        children: [
          Image.asset(
            AssetsConst.wowLogo.assetImg,
            width: 80,
            height: 80,
          ),
          Column(
            children: [
              Row(
                children: [
                  Text(
                    context.read<CacheBloc>().userEntity?.name ?? '----',
                    style: TextStyle(
                      color: const Color(0xFF333333),
                      fontSize: 21.sp,
                    ),
                  ),
                  //Text(context.read<CacheBloc>().userEntity?.gender ?? '--'),
                  Image.asset(
                    AssetsConst.wowLogo.assetImg,
                    height: 18.h,
                  ),
                ],
              ),
              Row(
                children: [
                  Text(
                    "什么时候到期",
                    style: TextStyle(
                      color: const Color(0xFFE11212),
                      fontSize: 17.sp,
                    ),
                  )
                ],
              )
            ],
          ),
        ],
22b7d4da   Key   feat: user, api path
87
88
89
      );
    }
  }