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))
|
.map((s) => ConversationsHelper.apiToConversation(s))
|
||||||
.cast<Conversation>()
|
.cast<Conversation>()
|
||||||
.toList(),
|
.toList(),
|
||||||
|
isForezGroup: map["is_forez_group"],
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Create [GroupMembership] object from API entry
|
/// Create [GroupMembership] object from API entry
|
||||||
|
@ -17,6 +17,7 @@ class AdvancedGroupInfo extends Group implements LikeElement {
|
|||||||
int likes;
|
int likes;
|
||||||
bool userLike;
|
bool userLike;
|
||||||
List<Conversation> conversations;
|
List<Conversation> conversations;
|
||||||
|
bool isForezGroup;
|
||||||
|
|
||||||
AdvancedGroupInfo({
|
AdvancedGroupInfo({
|
||||||
@required int id,
|
@required int id,
|
||||||
@ -36,7 +37,9 @@ class AdvancedGroupInfo extends Group implements LikeElement {
|
|||||||
@required this.likes,
|
@required this.likes,
|
||||||
@required this.userLike,
|
@required this.userLike,
|
||||||
@required this.conversations,
|
@required this.conversations,
|
||||||
}) : super(
|
@required this.isForezGroup,
|
||||||
|
}) : assert(isForezGroup != null),
|
||||||
|
super(
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
iconURL: iconURL,
|
iconURL: iconURL,
|
||||||
|
@ -19,7 +19,7 @@ enum GroupRegistrationLevel { OPEN, MODERATED, CLOSED }
|
|||||||
|
|
||||||
enum GroupPostCreationLevel { MODERATORS, MEMBERS }
|
enum GroupPostCreationLevel { MODERATORS, MEMBERS }
|
||||||
|
|
||||||
class Group {
|
class Group implements Comparable<Group> {
|
||||||
final int id;
|
final int id;
|
||||||
String name;
|
String name;
|
||||||
final String iconURL;
|
final String iconURL;
|
||||||
@ -70,4 +70,7 @@ class Group {
|
|||||||
membershipLevel == GroupMembershipLevel.MODERATOR ||
|
membershipLevel == GroupMembershipLevel.MODERATOR ||
|
||||||
(membershipLevel == GroupMembershipLevel.MEMBER &&
|
(membershipLevel == GroupMembershipLevel.MEMBER &&
|
||||||
postCreationLevel == GroupPostCreationLevel.MEMBERS);
|
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/models/advanced_group_info.dart';
|
||||||
import 'package:comunic/ui/routes/main_route/main_route.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/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_conversation_section.dart';
|
||||||
import 'package:comunic/ui/screens/group_sections/group_members_screen.dart';
|
import 'package:comunic/ui/screens/group_sections/group_members_screen.dart';
|
||||||
import 'package:comunic/ui/screens/group_sections/group_posts_section.dart';
|
import 'package:comunic/ui/screens/group_sections/group_posts_section.dart';
|
||||||
@ -57,6 +58,13 @@ class _AuthorizedGroupPageScreenState
|
|||||||
label: tr("Posts"),
|
label: tr("Posts"),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Forez presence tab
|
||||||
|
_GroupPageTab(
|
||||||
|
widget: (c) => ForezPresenceSection(),
|
||||||
|
label: tr("Presence"),
|
||||||
|
visible: _group.isForezGroup,
|
||||||
|
),
|
||||||
|
|
||||||
// About the group
|
// About the group
|
||||||
_GroupPageTab(
|
_GroupPageTab(
|
||||||
widget: (c) => AboutGroupSection(group: _group),
|
widget: (c) => AboutGroupSection(group: _group),
|
||||||
@ -72,7 +80,7 @@ class _AuthorizedGroupPageScreenState
|
|||||||
|
|
||||||
// Add group conversations
|
// Add group conversations
|
||||||
..insertAll(
|
..insertAll(
|
||||||
1,
|
2,
|
||||||
_group.conversations
|
_group.conversations
|
||||||
.map((e) => _GroupPageTab(
|
.map((e) => _GroupPageTab(
|
||||||
widget: (c) => GroupConversationSection(conv: e),
|
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(
|
Widget _buildGroupsList() => ListView(
|
||||||
children: _groups.values
|
children: (_groups.values.toList()
|
||||||
|
..sort((one, two) => two.id.compareTo(one.id)))
|
||||||
.map((g) => ListTile(
|
.map((g) => ListTile(
|
||||||
leading: GroupIcon(group: g),
|
leading: GroupIcon(group: g),
|
||||||
title: Text(g.displayName),
|
title: Text(g.displayName),
|
||||||
|
Loading…
Reference in New Issue
Block a user