mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Show user membership
This commit is contained in:
parent
cfc3552011
commit
e3c11e48b2
@ -164,6 +164,7 @@ class UsersHelper {
|
||||
canPostTexts: data["can_post_texts"],
|
||||
isFriendsListPublic: data["friend_list_public"],
|
||||
numberFriends: data["number_friends"],
|
||||
accountCreationTime: data["account_creation_time"],
|
||||
likes: data["pageLikes"],
|
||||
userLike: data["user_like_page"],
|
||||
);
|
||||
|
@ -14,6 +14,7 @@ class AdvancedUserInfo extends User implements LikeElement {
|
||||
final bool canPostTexts;
|
||||
final bool isFriendsListPublic;
|
||||
final int numberFriends;
|
||||
final int accountCreationTime;
|
||||
bool userLike;
|
||||
int likes;
|
||||
|
||||
@ -29,12 +30,14 @@ class AdvancedUserInfo extends User implements LikeElement {
|
||||
@required this.canPostTexts,
|
||||
@required this.isFriendsListPublic,
|
||||
@required this.numberFriends,
|
||||
@required this.accountCreationTime,
|
||||
@required this.userLike,
|
||||
@required this.likes,
|
||||
}) : assert(publicNote != null),
|
||||
assert(canPostTexts != null),
|
||||
assert(isFriendsListPublic != null),
|
||||
assert(numberFriends != null),
|
||||
assert(accountCreationTime != null),
|
||||
assert(userLike != null),
|
||||
assert(likes != null),
|
||||
super(
|
||||
|
@ -10,6 +10,8 @@ import 'package:comunic/ui/widgets/post_create_form_widget.dart';
|
||||
import 'package:comunic/ui/widgets/posts_list_widget.dart';
|
||||
import 'package:comunic/utils/account_utils.dart';
|
||||
import 'package:comunic/utils/conversations_utils.dart';
|
||||
import 'package:comunic/utils/date_utils.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
|
||||
@ -138,7 +140,19 @@ class _UserPageTabletState extends State<UserPageTablet> {
|
||||
);
|
||||
|
||||
/// Build user information card
|
||||
Widget _buildAboutCard() => Container();
|
||||
Widget _buildAboutCard() => _LeftPaneContainer(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
// User membership
|
||||
_AboutUserEntry(
|
||||
icon: Icons.access_time,
|
||||
title: tr("Membership"),
|
||||
value: tr("Member for %t%", args: {
|
||||
"t": diffTimeFromNowToStr(_userInfo.accountCreationTime)
|
||||
})),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _LeftPaneContainer extends StatelessWidget {
|
||||
@ -171,3 +185,42 @@ class _MainCardSpacer extends StatelessWidget {
|
||||
Widget build(BuildContext context) =>
|
||||
visible ? SizedBox(height: 10) : Container();
|
||||
}
|
||||
|
||||
class _AboutUserEntry extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final String value;
|
||||
final bool visible;
|
||||
|
||||
const _AboutUserEntry({
|
||||
Key key,
|
||||
@required this.icon,
|
||||
@required this.title,
|
||||
@required this.value,
|
||||
this.visible = true,
|
||||
}) : assert(icon != null),
|
||||
assert(title != null),
|
||||
assert(visible != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!visible) return Container();
|
||||
|
||||
return ListTile(
|
||||
title: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
WidgetSpan(
|
||||
child: Icon(icon, size: 15),
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
),
|
||||
TextSpan(text: " $title")
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: Text(value),
|
||||
dense: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user