1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22:39:22 +00:00

Display user website

This commit is contained in:
Pierre HUBERT 2020-05-17 14:53:26 +02:00
parent 3794eca68b
commit cac23dd620
3 changed files with 27 additions and 3 deletions

View File

@ -165,6 +165,7 @@ class UsersHelper {
isFriendsListPublic: data["friend_list_public"], isFriendsListPublic: data["friend_list_public"],
numberFriends: data["number_friends"], numberFriends: data["number_friends"],
accountCreationTime: data["account_creation_time"], accountCreationTime: data["account_creation_time"],
personalWebsite: data["personnalWebsite"],
likes: data["pageLikes"], likes: data["pageLikes"],
userLike: data["user_like_page"], userLike: data["user_like_page"],
); );

View File

@ -15,6 +15,7 @@ class AdvancedUserInfo extends User implements LikeElement {
final bool isFriendsListPublic; final bool isFriendsListPublic;
final int numberFriends; final int numberFriends;
final int accountCreationTime; final int accountCreationTime;
final String personalWebsite;
bool userLike; bool userLike;
int likes; int likes;
@ -31,6 +32,7 @@ class AdvancedUserInfo extends User implements LikeElement {
@required this.isFriendsListPublic, @required this.isFriendsListPublic,
@required this.numberFriends, @required this.numberFriends,
@required this.accountCreationTime, @required this.accountCreationTime,
@required this.personalWebsite,
@required this.userLike, @required this.userLike,
@required this.likes, @required this.likes,
}) : assert(publicNote != null), }) : assert(publicNote != null),
@ -38,6 +40,7 @@ class AdvancedUserInfo extends User implements LikeElement {
assert(isFriendsListPublic != null), assert(isFriendsListPublic != null),
assert(numberFriends != null), assert(numberFriends != null),
assert(accountCreationTime != null), assert(accountCreationTime != null),
assert(personalWebsite != null),
assert(userLike != null), assert(userLike != null),
assert(likes != null), assert(likes != null),
super( super(
@ -51,6 +54,8 @@ class AdvancedUserInfo extends User implements LikeElement {
bool get hasPublicNote => publicNote.isNotEmpty; bool get hasPublicNote => publicNote.isNotEmpty;
bool get hasPersonalWebsite => personalWebsite.isNotEmpty;
@override @override
LikesType get likeType => LikesType.USER; LikesType get likeType => LikesType.USER;
} }

View File

@ -1,6 +1,7 @@
import 'package:comunic/enums/post_target.dart'; import 'package:comunic/enums/post_target.dart';
import 'package:comunic/helpers/posts_helper.dart'; import 'package:comunic/helpers/posts_helper.dart';
import 'package:comunic/models/advanced_user_info.dart'; import 'package:comunic/models/advanced_user_info.dart';
import 'package:comunic/models/displayed_content.dart';
import 'package:comunic/models/friend_status.dart'; import 'package:comunic/models/friend_status.dart';
import 'package:comunic/ui/routes/main_route/main_route.dart'; import 'package:comunic/ui/routes/main_route/main_route.dart';
import 'package:comunic/ui/widgets/FrienshipStatusWidget.dart'; import 'package:comunic/ui/widgets/FrienshipStatusWidget.dart';
@ -8,11 +9,11 @@ import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/ui/widgets/like_widget.dart'; import 'package:comunic/ui/widgets/like_widget.dart';
import 'package:comunic/ui/widgets/post_create_form_widget.dart'; import 'package:comunic/ui/widgets/post_create_form_widget.dart';
import 'package:comunic/ui/widgets/posts_list_widget.dart'; import 'package:comunic/ui/widgets/posts_list_widget.dart';
import 'package:comunic/ui/widgets/text_widget.dart';
import 'package:comunic/utils/account_utils.dart'; import 'package:comunic/utils/account_utils.dart';
import 'package:comunic/utils/conversations_utils.dart'; import 'package:comunic/utils/conversations_utils.dart';
import 'package:comunic/utils/date_utils.dart'; import 'package:comunic/utils/date_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
@ -156,8 +157,18 @@ class _UserPageTabletState extends State<UserPageTablet> {
_AboutUserEntry( _AboutUserEntry(
icon: Icons.note, icon: Icons.note,
title: tr("Note"), title: tr("Note"),
value: parseEmojies(_userInfo.publicNote), value: _userInfo.publicNote,
visible: _userInfo.hasPublicNote, visible: _userInfo.hasPublicNote,
parsed: true,
),
// User website
_AboutUserEntry(
icon: Icons.link,
title: tr("Website"),
value: _userInfo.personalWebsite,
visible: _userInfo.hasPersonalWebsite,
parsed: true,
), ),
], ],
), ),
@ -200,6 +211,7 @@ class _AboutUserEntry extends StatelessWidget {
final String title; final String title;
final String value; final String value;
final bool visible; final bool visible;
final bool parsed;
const _AboutUserEntry({ const _AboutUserEntry({
Key key, Key key,
@ -207,6 +219,7 @@ class _AboutUserEntry extends StatelessWidget {
@required this.title, @required this.title,
@required this.value, @required this.value,
this.visible = true, this.visible = true,
this.parsed = false,
}) : assert(icon != null), }) : assert(icon != null),
assert(title != null), assert(title != null),
assert(visible != null), assert(visible != null),
@ -228,7 +241,12 @@ class _AboutUserEntry extends StatelessWidget {
], ],
), ),
), ),
subtitle: Text(value), subtitle: parsed
? TextWidget(
content: DisplayedString(value),
style: TextStyle(),
)
: Text(value),
dense: true, dense: true,
); );
} }