mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Ready to build presence section
This commit is contained in:
parent
6baf02e258
commit
1f0abe9c2b
@ -409,6 +409,7 @@ class GroupsHelper {
|
||||
.map((s) => ConversationsHelper.apiToConversation(s))
|
||||
.cast<Conversation>()
|
||||
.toList(),
|
||||
isForezGroup: map["is_forez_group"],
|
||||
);
|
||||
|
||||
/// Create [GroupMembership] object from API entry
|
||||
|
@ -17,6 +17,7 @@ class AdvancedGroupInfo extends Group implements LikeElement {
|
||||
int likes;
|
||||
bool userLike;
|
||||
List<Conversation> conversations;
|
||||
bool isForezGroup;
|
||||
|
||||
AdvancedGroupInfo({
|
||||
@required int id,
|
||||
@ -36,7 +37,9 @@ class AdvancedGroupInfo extends Group implements LikeElement {
|
||||
@required this.likes,
|
||||
@required this.userLike,
|
||||
@required this.conversations,
|
||||
}) : super(
|
||||
@required this.isForezGroup,
|
||||
}) : assert(isForezGroup != null),
|
||||
super(
|
||||
id: id,
|
||||
name: name,
|
||||
iconURL: iconURL,
|
||||
|
@ -19,7 +19,7 @@ enum GroupRegistrationLevel { OPEN, MODERATED, CLOSED }
|
||||
|
||||
enum GroupPostCreationLevel { MODERATORS, MEMBERS }
|
||||
|
||||
class Group {
|
||||
class Group implements Comparable<Group> {
|
||||
final int id;
|
||||
String name;
|
||||
final String iconURL;
|
||||
@ -70,4 +70,7 @@ class Group {
|
||||
membershipLevel == GroupMembershipLevel.MODERATOR ||
|
||||
(membershipLevel == GroupMembershipLevel.MEMBER &&
|
||||
postCreationLevel == GroupPostCreationLevel.MEMBERS);
|
||||
|
||||
@override
|
||||
int compareTo(Group other) => id.compareTo(other.id);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:comunic/models/advanced_group_info.dart';
|
||||
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
import 'package:comunic/ui/screens/group_sections/about_group_section.dart';
|
||||
import 'package:comunic/ui/screens/group_sections/forez_presence_section.dart';
|
||||
import 'package:comunic/ui/screens/group_sections/group_conversation_section.dart';
|
||||
import 'package:comunic/ui/screens/group_sections/group_members_screen.dart';
|
||||
import 'package:comunic/ui/screens/group_sections/group_posts_section.dart';
|
||||
@ -57,6 +58,13 @@ class _AuthorizedGroupPageScreenState
|
||||
label: tr("Posts"),
|
||||
),
|
||||
|
||||
// Forez presence tab
|
||||
_GroupPageTab(
|
||||
widget: (c) => ForezPresenceSection(),
|
||||
label: tr("Presence"),
|
||||
visible: _group.isForezGroup,
|
||||
),
|
||||
|
||||
// About the group
|
||||
_GroupPageTab(
|
||||
widget: (c) => AboutGroupSection(group: _group),
|
||||
@ -72,7 +80,7 @@ class _AuthorizedGroupPageScreenState
|
||||
|
||||
// Add group conversations
|
||||
..insertAll(
|
||||
1,
|
||||
2,
|
||||
_group.conversations
|
||||
.map((e) => _GroupPageTab(
|
||||
widget: (c) => GroupConversationSection(conv: e),
|
||||
|
17
lib/ui/screens/group_sections/forez_presence_section.dart
Normal file
17
lib/ui/screens/group_sections/forez_presence_section.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Forez presence section
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
class ForezPresenceSection extends StatefulWidget {
|
||||
@override
|
||||
_ForezPresenceSectionState createState() => _ForezPresenceSectionState();
|
||||
}
|
||||
|
||||
class _ForezPresenceSectionState extends State<ForezPresenceSection> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
@ -61,7 +61,8 @@ class _GroupsListScreenState extends SafeState<GroupsListScreen> {
|
||||
}
|
||||
|
||||
Widget _buildGroupsList() => ListView(
|
||||
children: _groups.values
|
||||
children: (_groups.values.toList()
|
||||
..sort((one, two) => two.id.compareTo(one.id)))
|
||||
.map((g) => ListTile(
|
||||
leading: GroupIcon(group: g),
|
||||
title: Text(g.displayName),
|
||||
|
Loading…
Reference in New Issue
Block a user