diff --git a/lib/helpers/users_helper.dart b/lib/helpers/users_helper.dart index 15155bb..1c038ec 100644 --- a/lib/helpers/users_helper.dart +++ b/lib/helpers/users_helper.dart @@ -162,6 +162,8 @@ class UsersHelper { customEmojies: _parseCustomEmojies(data["customEmojis"]), publicNote: data["publicNote"], canPostTexts: data["can_post_texts"], + likes: data["pageLikes"], + userLike: data["user_like_page"], ); } diff --git a/lib/models/advanced_user_info.dart b/lib/models/advanced_user_info.dart index f201fe2..d45bcc9 100644 --- a/lib/models/advanced_user_info.dart +++ b/lib/models/advanced_user_info.dart @@ -1,5 +1,7 @@ +import 'package:comunic/enums/likes_type.dart'; import 'package:comunic/enums/user_page_visibility.dart'; import 'package:comunic/lists/custom_emojies_list.dart'; +import 'package:comunic/models/like_element.dart'; import 'package:comunic/models/user.dart'; import 'package:meta/meta.dart'; @@ -7,11 +9,13 @@ import 'package:meta/meta.dart'; /// /// @author Pierre HUBERT -class AdvancedUserInfo extends User { +class AdvancedUserInfo extends User implements LikeElement { final String publicNote; final bool canPostTexts; + bool userLike; + int likes; - const AdvancedUserInfo({ + AdvancedUserInfo({ @required int id, @required String firstName, @required String lastName, @@ -21,8 +25,12 @@ class AdvancedUserInfo extends User { @required CustomEmojiesList customEmojies, @required this.publicNote, @required this.canPostTexts, + @required this.userLike, + @required this.likes, }) : assert(publicNote != null), assert(canPostTexts != null), + assert(userLike != null), + assert(likes != null), super( id: id, firstName: firstName, @@ -31,4 +39,7 @@ class AdvancedUserInfo extends User { virtualDirectory: virtualDirectory, accountImageURL: accountImageURL, customEmojies: customEmojies); + + @override + LikesType get likeType => LikesType.USER; } diff --git a/lib/ui/widgets/tablet_mode/user_page_tablet.dart b/lib/ui/widgets/tablet_mode/user_page_tablet.dart index 5ec3b31..c9ac665 100644 --- a/lib/ui/widgets/tablet_mode/user_page_tablet.dart +++ b/lib/ui/widgets/tablet_mode/user_page_tablet.dart @@ -1,9 +1,12 @@ import 'package:comunic/enums/post_target.dart'; import 'package:comunic/helpers/posts_helper.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/posts_list_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; /// Tablet mode of user page /// @@ -38,7 +41,12 @@ class _UserPageTabletState extends State { ], ); - Widget _buildLeftColumn() => Text("Here comes the head"); + Widget _buildLeftColumn() => Column( + children: [ + _buildMainCard(), + _buildAboutCard(), + ], + ); Widget _buildRightColumn() => PostsListWidget( disablePullToRefresh: true, @@ -56,4 +64,29 @@ class _UserPageTabletState extends State { PostsHelper().getUserPosts(_userInfo.id, from: from), showPostsTarget: false, ); + + Widget _buildMainCard() => ConstrainedBox( + constraints: BoxConstraints(minWidth: 200), + child: Card( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + 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(); }