1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-29 16:26:27 +00:00

Start to show user information

This commit is contained in:
Pierre HUBERT 2020-05-16 13:41:11 +02:00
parent 61098ffc43
commit 9b0c1323b6
3 changed files with 49 additions and 3 deletions

View File

@ -162,6 +162,8 @@ class UsersHelper {
customEmojies: _parseCustomEmojies(data["customEmojis"]), customEmojies: _parseCustomEmojies(data["customEmojis"]),
publicNote: data["publicNote"], publicNote: data["publicNote"],
canPostTexts: data["can_post_texts"], canPostTexts: data["can_post_texts"],
likes: data["pageLikes"],
userLike: data["user_like_page"],
); );
} }

View File

@ -1,5 +1,7 @@
import 'package:comunic/enums/likes_type.dart';
import 'package:comunic/enums/user_page_visibility.dart'; import 'package:comunic/enums/user_page_visibility.dart';
import 'package:comunic/lists/custom_emojies_list.dart'; import 'package:comunic/lists/custom_emojies_list.dart';
import 'package:comunic/models/like_element.dart';
import 'package:comunic/models/user.dart'; import 'package:comunic/models/user.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
@ -7,11 +9,13 @@ import 'package:meta/meta.dart';
/// ///
/// @author Pierre HUBERT /// @author Pierre HUBERT
class AdvancedUserInfo extends User { class AdvancedUserInfo extends User implements LikeElement {
final String publicNote; final String publicNote;
final bool canPostTexts; final bool canPostTexts;
bool userLike;
int likes;
const AdvancedUserInfo({ AdvancedUserInfo({
@required int id, @required int id,
@required String firstName, @required String firstName,
@required String lastName, @required String lastName,
@ -21,8 +25,12 @@ class AdvancedUserInfo extends User {
@required CustomEmojiesList customEmojies, @required CustomEmojiesList customEmojies,
@required this.publicNote, @required this.publicNote,
@required this.canPostTexts, @required this.canPostTexts,
@required this.userLike,
@required this.likes,
}) : assert(publicNote != null), }) : assert(publicNote != null),
assert(canPostTexts != null), assert(canPostTexts != null),
assert(userLike != null),
assert(likes != null),
super( super(
id: id, id: id,
firstName: firstName, firstName: firstName,
@ -31,4 +39,7 @@ class AdvancedUserInfo extends User {
virtualDirectory: virtualDirectory, virtualDirectory: virtualDirectory,
accountImageURL: accountImageURL, accountImageURL: accountImageURL,
customEmojies: customEmojies); customEmojies: customEmojies);
@override
LikesType get likeType => LikesType.USER;
} }

View File

@ -1,9 +1,12 @@
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/ui/widgets/account_image_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:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
/// Tablet mode of user page /// Tablet mode of user page
/// ///
@ -38,7 +41,12 @@ class _UserPageTabletState extends State<UserPageTablet> {
], ],
); );
Widget _buildLeftColumn() => Text("Here comes the head"); Widget _buildLeftColumn() => Column(
children: <Widget>[
_buildMainCard(),
_buildAboutCard(),
],
);
Widget _buildRightColumn() => PostsListWidget( Widget _buildRightColumn() => PostsListWidget(
disablePullToRefresh: true, disablePullToRefresh: true,
@ -56,4 +64,29 @@ class _UserPageTabletState extends State<UserPageTablet> {
PostsHelper().getUserPosts(_userInfo.id, from: from), PostsHelper().getUserPosts(_userInfo.id, from: from),
showPostsTarget: false, showPostsTarget: false,
); );
Widget _buildMainCard() => ConstrainedBox(
constraints: BoxConstraints(minWidth: 200),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Center(child: AccountImageWidget(user: _userInfo, width: 75)),
SizedBox(height: 10),
Text(
_userInfo.displayName,
style: TextStyle(fontSize: 20),
),
SizedBox(height: 10),
SizedBox(height: 10),
LikeWidget(likeElement: _userInfo),
SizedBox(height: 10),
],
),
),
),
);
Widget _buildAboutCard() => Container();
} }