Line data Source code
1 : import 'package:amadeus_proto/api/models/profile.dart';
2 : import 'package:amadeus_proto/pages/profile/pages/profile_page.dart';
3 : import 'package:amadeus_proto/widget/padded_card.dart';
4 : import 'package:amadeus_proto/widget/sub_page.dart';
5 : import 'package:flutter/material.dart';
6 : import 'package:localization/localization.dart';
7 :
8 : class UserItem extends StatelessWidget {
9 0 : const UserItem({
10 : super.key,
11 : required this.user,
12 : });
13 :
14 : final Profile user;
15 :
16 0 : @override
17 : Widget build(BuildContext context) {
18 0 : return InkWell(
19 0 : child: PaddedCard(
20 0 : child: Row(
21 0 : children: [
22 0 : ClipOval(
23 : // child: Image.network(
24 : // friend.imageUrl,
25 : // height: 65,
26 : // loadingBuilder: imageLoader,
27 : // ),
28 0 : child: Image.asset(
29 : // Use local storage for demo
30 0 : user.imageUrl ?? "assets/images/fake users/user.png",
31 : height: 65,
32 : ),
33 : ),
34 : const SizedBox(
35 : width: 10,
36 : ),
37 0 : Expanded(
38 0 : child: Column(
39 : crossAxisAlignment: CrossAxisAlignment.start,
40 0 : children: [
41 0 : Text(
42 0 : user.username,
43 : textAlign: TextAlign.start,
44 0 : style: TextStyle(
45 0 : color: Theme.of(context).colorScheme.onSurface,
46 : fontSize: 18,
47 : height: 1.2,
48 : fontWeight: FontWeight.bold,
49 : ),
50 : ),
51 0 : if (user.bio != null)
52 0 : Text(
53 0 : user.bio!,
54 : overflow: TextOverflow.ellipsis,
55 : textAlign: TextAlign.start,
56 0 : style: TextStyle(
57 : height: 1.2,
58 0 : color: Theme.of(context).colorScheme.onSurfaceVariant,
59 : fontSize: 15,
60 : ),
61 : )
62 : ],
63 : ),
64 : ),
65 : // const Spacer(),
66 0 : Padding(
67 : padding: const EdgeInsets.all(10),
68 0 : child: PaddedCard(
69 : child:
70 0 : Text("acronym.level".i18n([user.level.level.toString()])),
71 : ),
72 : )
73 : ],
74 : ),
75 : ),
76 0 : onTap: () => Navigator.of(context).push(
77 0 : MaterialPageRoute(
78 0 : builder: (_) => SubPage(
79 0 : page: ProfilePage(
80 : isFriend: true,
81 0 : userId: user.id,
82 : ),
83 : ),
84 : ),
85 : ),
86 : );
87 : }
88 : }
|