user_page.dart
2.54 KB
1
2
3
4
5
6
7
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
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/common/blocs/cachebloc/cache_bloc.dart';
import 'package:wow_english/common/core/assets_const.dart';
import 'package:wow_english/common/extension/string_extension.dart';
import 'package:wow_english/common/widgets/we_app_bar.dart';
import 'package:wow_english/models/user_entity.dart';
import 'package:wow_english/pages/user/bloc/user_bloc.dart';
class UserPage extends StatelessWidget {
const UserPage({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => UserBloc(),
child: _UserView(),
);
}
}
class _UserView extends StatelessWidget {
const _UserView({super.key});
@override
Widget build(BuildContext context) {
UserEntity? user = context.read<CacheBloc>().userEntity;
return Scaffold(
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,
),
)
],
)
],
),
],
);
}
}