1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Start to create about page

This commit is contained in:
Pierre HUBERT 2021-03-17 17:40:25 +01:00
parent 160a3e1f27
commit 1ba7784324
3 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,87 @@
import 'package:comunic/enums/user_page_visibility.dart';
import 'package:comunic/models/advanced_user_info.dart';
import 'package:comunic/models/displayed_content.dart';
import 'package:comunic/ui/widgets/text_widget.dart';
import 'package:comunic/utils/date_utils.dart';
import 'package:comunic/utils/intl_utils.dart';
/// About current user
///
/// @author Pierre Hubert
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutUserSection extends StatefulWidget {
final AdvancedUserInfo user;
const AboutUserSection({
Key key,
@required this.user,
}) : assert(user != null),
super(key: key);
@override
_AboutUserSectionState createState() => _AboutUserSectionState();
}
class _AboutUserSectionState extends State<AboutUserSection> {
@override
Widget build(BuildContext context) => ListView(
children: [
// Account URL
widget.user.hasPersonalWebsite
? ListTile(
leading: Icon(Icons.link),
title: Text(tr("Personal Website")),
subtitle: Text(widget.user.personalWebsite),
onTap: () => launch(widget.user.personalWebsite),
)
: Container(),
// Account note
widget.user.hasPublicNote
? ListTile(
leading: Icon(Icons.note),
title: Text(tr("Note")),
subtitle: TextWidget(
content: DisplayedString(widget.user.publicNote)),
)
: Container(),
// Virtual directory
widget.user.hasVirtualDirectory
? ListTile(
leading: Icon(Icons.alternate_email),
title: Text(tr("Virtual directory")),
subtitle: Text("@${widget.user.virtualDirectory}"))
: Container(),
// Number of friends
widget.user.isFriendsListPublic
? ListTile(
leading: Icon(Icons.group),
title: Text(tr("Number of friends")),
subtitle: Text(widget.user.numberFriends.toString()),
)
: Container(),
// Member for
ListTile(
leading: Icon(Icons.access_time_rounded),
title: Text(tr("Member for")),
subtitle:
Text(diffTimeFromNowToStr(widget.user.accountCreationTime)),
),
// Account visibility
ListTile(
leading: Icon(Icons.remove_red_eye),
title: Text(tr("Account visibility")),
subtitle: Text(widget.user.pageVisibility == UserPageVisibility.OPEN
? tr("Open page")
: (widget.user.pageVisibility == UserPageVisibility.PUBLIC
? tr("Public page")
: tr("Private page"))),
),
],
);
}

View File

@ -32,6 +32,8 @@ class UserPageHeader extends StatelessWidget {
child: AccountImageWidget(user: user),
),
Expanded(flex: 1, child: Text(" ${user.displayName}")),
// Private conversation
user.id == userID()
? Container()
: IconButton(

View File

@ -1,6 +1,7 @@
import 'package:comunic/models/advanced_user_info.dart';
import 'package:comunic/ui/screens/friends_list_screen.dart';
import 'package:comunic/ui/screens/other_friends_lists_screen.dart';
import 'package:comunic/ui/screens/user_page_sections/about_user_section.dart';
import 'package:comunic/ui/screens/user_page_sections/user_page_header.dart';
import 'package:comunic/ui/screens/user_page_sections/user_posts_section.dart';
import 'package:comunic/utils/intl_utils.dart';
@ -39,6 +40,12 @@ class _UserMobilePageState extends State<UserMobilePage>
),
),
// About user
UserPageTab(
label: tr("About"),
onBuild: (c) => AboutUserSection(user: widget.userInfo),
),
// User friends
UserPageTab(
label: tr("Friends"),