account_page.dart
4 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
90
91
92
93
94
95
96
97
98
99
100
101
import 'package:appframe/bloc/setting/account_cubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class AccountPage extends StatelessWidget {
const AccountPage({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => AccountCubit(AccountState()),
child: BlocConsumer<AccountCubit, AccountState>(
builder: (context, state) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: Text('账号与安全', style: TextStyle(color: Colors.white, fontSize: 18)),
centerTitle: true,
backgroundColor: Color(0xFF7691FA),
iconTheme: IconThemeData(
color: Colors.white, // 设置返回图标按钮的颜色
),
),
body: state.loaded
? Column(
children: [
// 用户头像和昵称部分
Container(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
CircleAvatar(
radius: 26.0,
backgroundImage: NetworkImage(state.imgIcon),
),
SizedBox(height: 16.0),
Text(
state.name,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
Text(
state.nickname,
style: TextStyle(fontSize: 12.0),
),
],
),
),
// 设置项列表
Expanded(
child: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: [
Card(
color: Color(0xFFF7F9FF),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
child: ListTile(
leading: Icon(Icons.mobile_friendly),
title: Text('手机号绑定'),
subtitle: Text(
state.phone != '' ? '${state.phone.substring(0, 3)}****${state.phone.substring(7, 11)}' : '未绑定',
style: TextStyle(
fontSize: 14.0,
color: Colors.grey,
),
),
trailing: Icon(Icons.arrow_forward_ios, size: 14),
onTap: () {
context.read<AccountCubit>().goBind();
},
),
),
// Divider(),
],
),
),
),
],
)
: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(),
SizedBox(height: 16),
Text('加载中...'),
],
),
),
);
},
listener: (context, state) {},
),
);
}
}