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

Add like button on group page

This commit is contained in:
Pierre HUBERT 2020-04-15 19:23:08 +02:00
parent dde909457d
commit f8a70faf28
3 changed files with 22 additions and 8 deletions

View File

@ -210,7 +210,7 @@ class GroupsHelper {
timeCreate: map["time_create"], timeCreate: map["time_create"],
description: map["description"], description: map["description"],
url: map["url"], url: map["url"],
numberLikes: map["number_likes"], likes: map["number_likes"],
isLiking: map["is_liking"], userLike: map["is_liking"],
); );
} }

View File

@ -1,3 +1,5 @@
import 'package:comunic/enums/likes_type.dart';
import 'package:comunic/models/like_element.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'group.dart'; import 'group.dart';
@ -6,12 +8,12 @@ import 'group.dart';
/// ///
/// @author Pierre Hubert /// @author Pierre Hubert
class AdvancedGroupInfo extends Group { class AdvancedGroupInfo extends Group implements LikeElement {
final int timeCreate; final int timeCreate;
final String description; final String description;
final String url; final String url;
final int numberLikes; int likes;
final bool isLiking; bool userLike;
AdvancedGroupInfo({ AdvancedGroupInfo({
@required int id, @required int id,
@ -27,8 +29,8 @@ class AdvancedGroupInfo extends Group {
@required this.timeCreate, @required this.timeCreate,
@required this.description, @required this.description,
@required this.url, @required this.url,
@required this.numberLikes, @required this.likes,
@required this.isLiking, @required this.userLike,
}) : super( }) : super(
id: id, id: id,
name: name, name: name,
@ -40,4 +42,7 @@ class AdvancedGroupInfo extends Group {
postCreationLevel: postCreationLevel, postCreationLevel: postCreationLevel,
virtualDirectory: virtualDirectory, virtualDirectory: virtualDirectory,
following: following); following: following);
@override
LikesType likeType = LikesType.GROUP;
} }

View File

@ -2,6 +2,7 @@ import 'package:comunic/models/advanced_group_info.dart';
import 'package:comunic/ui/widgets/group_following_widget.dart'; import 'package:comunic/ui/widgets/group_following_widget.dart';
import 'package:comunic/ui/widgets/group_icon_widget.dart'; import 'package:comunic/ui/widgets/group_icon_widget.dart';
import 'package:comunic/ui/widgets/group_membership_widget.dart'; import 'package:comunic/ui/widgets/group_membership_widget.dart';
import 'package:comunic/ui/widgets/like_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
/// Authorized group page screen /// Authorized group page screen
@ -57,11 +58,19 @@ class _AuthorizedGroupPageScreenState extends State<AuthorizedGroupPageScreen> {
group: _group, group: _group,
onUpdated: () => widget.needRefresh(), onUpdated: () => widget.needRefresh(),
), ),
Container(height: 10,), Container(
height: 4,
),
GroupFollowingWidget( GroupFollowingWidget(
group: _group, group: _group,
onUpdated: () => widget.needRefresh(), onUpdated: () => widget.needRefresh(),
), ),
Container(
height: 2,
),
LikeWidget(
likeElement: _group,
)
], ],
) )
], ],