Skip to content

Commit 4876695

Browse files
committed
feat: add bio & gender to UserInfoCard
1 parent 098523f commit 4876695

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

lib/components/cards/user_info_card.dart

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class UserInfoCard extends StatelessWidget {
170170
GestureDetector(
171171
onTap: () => Utils.copyText(data.uid.toString()),
172172
child: Text(
173-
'UID: ${data.uid.toString()}',
173+
'UID: ${data.uid}',
174174
style: const TextStyle(
175175
fontSize: 14,
176176
),
@@ -203,6 +203,10 @@ class UserInfoCard extends StatelessWidget {
203203
],
204204
),
205205
),
206+
Padding(
207+
padding: const EdgeInsets.only(left: 20, top: 4, right: 20),
208+
child: Text((data.bio?.isEmpty ?? true) ? '这个人很懒,什么都没写' : data.bio!),
209+
),
206210
Padding(
207211
padding: const EdgeInsets.only(left: 20, top: 4, right: 20),
208212
child: Row(
@@ -211,11 +215,11 @@ class UserInfoCard extends StatelessWidget {
211215
TextSpan(
212216
children: [
213217
TextSpan(
214-
text: '${data.feed.toString()} ',
218+
text: '${data.feed} ',
215219
style: TextStyle(fontWeight: FontWeight.bold)),
216220
TextSpan(text: '动态 '),
217221
TextSpan(
218-
text: '${data.beLikeNum.toString()} ',
222+
text: '${data.beLikeNum} ',
219223
style: TextStyle(fontWeight: FontWeight.bold)),
220224
TextSpan(text: '赞 '),
221225
],
@@ -232,7 +236,7 @@ class UserInfoCard extends StatelessWidget {
232236
child: Text.rich(TextSpan(
233237
children: [
234238
TextSpan(
235-
text: '${data.follow.toString()} ',
239+
text: '${data.follow} ',
236240
style: TextStyle(fontWeight: FontWeight.bold)),
237241
TextSpan(text: '关注 '),
238242
],
@@ -249,7 +253,7 @@ class UserInfoCard extends StatelessWidget {
249253
child: Text.rich(TextSpan(
250254
children: [
251255
TextSpan(
252-
text: '${data.fans.toString()} ',
256+
text: '${data.fans} ',
253257
style: TextStyle(fontWeight: FontWeight.bold)),
254258
TextSpan(text: '粉丝'),
255259
],
@@ -259,14 +263,19 @@ class UserInfoCard extends StatelessWidget {
259263
),
260264
),
261265
Padding(
262-
padding: const EdgeInsets.only(left: 20, top: 4, right: 20),
263-
child: Text(
264-
'${DateUtil.fromToday(data.logintime)}活跃',
265-
style: const TextStyle(
266-
fontSize: 14,
267-
),
268-
),
269-
),
266+
padding: const EdgeInsets.only(left: 20, top: 4, right: 20),
267+
child: Row(
268+
children: [
269+
Icon(data.gender == 1 ? Icons.male : Icons.female, size: 20.0),
270+
SizedBox(width: 5),
271+
Text(
272+
'${DateUtil.fromToday(data.logintime)}活跃',
273+
style: const TextStyle(
274+
fontSize: 14,
275+
),
276+
),
277+
],
278+
)),
270279
],
271280
);
272281
}

0 commit comments

Comments
 (0)