character_entry_view.dart
5.9 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import 'package:cp_offline_manage/common/colors.dart';
import 'package:cp_offline_manage/pages/login/login_logic.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'character_entry_logic.dart';
class Character_entryPage extends GetView<Character_entryLogic> {
const Character_entryPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
_buildHeader(),
GetBuilder<Character_entryLogic>(
builder: (logic) {
return _buildBody(context);
},
),
Obx(() {
return Container(
margin: EdgeInsets.only(bottom: 60),
height: 50,
width: double.infinity,
color:
controller.isEnable.value ? Color(0xFFFF562F) : Colors.grey,
child: TextButton(
onPressed: controller.isEnable.value
? () {
controller.jumpToLoginPage();
}
: null,
child: Text(
'下一步',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16),
),
),
);
})
],
),
);
}
// 头部
Widget _buildHeader() {
return Container(
height: 180,
color: ColorConfig.colorF0F0F0,
child: Column(
children: [
Container(
width: double.infinity, // 将 Container 的宽度设置为屏幕宽度
margin: EdgeInsets.only(top: 80, left: 20),
child: Text(
"请选择您的身份",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20),
textAlign: TextAlign.left,
),
),
Container(
width: double.infinity, // 将 Container 的宽度设置为屏幕宽度
margin: EdgeInsets.only(top: 15, left: 20),
child: Text(
"我们会对每种身份设定合理的权限",
style: TextStyle(color: Colors.black, fontSize: 16),
textAlign: TextAlign.left,
),
),
],
),
);
}
// body
Widget _buildBody(BuildContext context) {
return Expanded(
child: Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.only(top: 20),
child: Column(
children: List.generate(controller.characterList.length, (index) {
var item = controller.characterList[index];
return _bodyItem(index, controller);
}),
),
));
}
Widget _bodyItem(int index, Character_entryLogic logic) {
var item = logic.characterList[index];
return Container(
color: ColorConfig.colorF0F0F0,
alignment: Alignment.centerLeft,
margin: EdgeInsets.symmetric(horizontal: 15),
child: Column(
children: [
Container(
child: Row(
children: [
Expanded(
child: Column(
children: [
InkWell(
child: Container(
height: 80,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(
left: 20,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
item["title"].toString(),
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20),
textAlign: TextAlign.left,
),
SizedBox(
height: 6,
),
Text(
item["desc"].toString(),
style: TextStyle(
color: Colors.black, fontSize: 15),
textAlign: TextAlign.left,
),
],
),
),
onTap: () {
controller.updateState(index);
},
),
],
)),
Container(
width: 40,
alignment: Alignment.center,
child: Image(
image: AssetImage("assets/images/home_icon/" +
(item["isSelected"] as bool
? "icon_selected.png"
: "icon_unselected.png")),
width: 24,
height: 24,
)),
],
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(
width: 1,
color: item["isSelected"] as bool
? Color(0xFFFF562F)
: Colors.transparent,
),
),
),
Container(
color: Color(0xFFFAFAFA),
alignment: Alignment.centerLeft,
height: 20,
)
],
));
}
}