mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Highlight active user / group in memberships panel
This commit is contained in:
parent
1bd2bdd1aa
commit
773cf17da0
@ -99,7 +99,9 @@ abstract class MainController extends State<MainRoute> {
|
|||||||
|
|
||||||
/// Open a specific group page specified by its [groupID]
|
/// Open a specific group page specified by its [groupID]
|
||||||
void openGroup(int groupID) => pushPage(PageInfo(
|
void openGroup(int groupID) => pushPage(PageInfo(
|
||||||
type: PageType.GROUP_PAGE, child: GroupPageScreen(groupID: groupID)));
|
type: PageType.GROUP_PAGE,
|
||||||
|
child: GroupPageScreen(groupID: groupID),
|
||||||
|
id: groupID));
|
||||||
|
|
||||||
/// Display the list of friends of current user
|
/// Display the list of friends of current user
|
||||||
void openFriendsList() => pushPage(
|
void openFriendsList() => pushPage(
|
||||||
|
@ -66,7 +66,7 @@ class _TabletRouteState extends MainController {
|
|||||||
Container(height: 10),
|
Container(height: 10),
|
||||||
GlobalSearchField(),
|
GlobalSearchField(),
|
||||||
Container(height: 10),
|
Container(height: 10),
|
||||||
Expanded(child: MembershipsPanel())
|
Expanded(child: MembershipsPanel(currentPage: currentPage))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -9,6 +9,7 @@ import 'package:comunic/lists/users_list.dart';
|
|||||||
import 'package:comunic/models/friend.dart';
|
import 'package:comunic/models/friend.dart';
|
||||||
import 'package:comunic/models/membership.dart';
|
import 'package:comunic/models/membership.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/routes/main_route/page_info.dart';
|
||||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
import 'package:comunic/ui/widgets/account_image_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';
|
||||||
@ -23,6 +24,14 @@ import 'package:flutter/material.dart';
|
|||||||
/// @author Pierre Hubert
|
/// @author Pierre Hubert
|
||||||
|
|
||||||
class MembershipsPanel extends StatefulWidget {
|
class MembershipsPanel extends StatefulWidget {
|
||||||
|
final PageInfo currentPage;
|
||||||
|
|
||||||
|
const MembershipsPanel({
|
||||||
|
Key key,
|
||||||
|
@required this.currentPage,
|
||||||
|
}) : assert(currentPage != null),
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MembershipsPanelState createState() => _MembershipsPanelState();
|
_MembershipsPanelState createState() => _MembershipsPanelState();
|
||||||
}
|
}
|
||||||
@ -127,11 +136,17 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
|
|||||||
style: TextStyle(color: connected ? Colors.green : null),
|
style: TextStyle(color: connected ? Colors.green : null),
|
||||||
);
|
);
|
||||||
|
|
||||||
return ListTile(
|
return Container(
|
||||||
|
color: widget.currentPage.type == PageType.USER_PAGE &&
|
||||||
|
widget.currentPage.id == user.id
|
||||||
|
? Colors.grey.shade800
|
||||||
|
: null,
|
||||||
|
child: ListTile(
|
||||||
leading: AccountImageWidget(user: user, width: _MembershipIconsWidth),
|
leading: AccountImageWidget(user: user, width: _MembershipIconsWidth),
|
||||||
title: Text(user.displayName),
|
title: Text(user.displayName),
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
onTap: () => MainController.of(context).openUserPage(user.id),
|
onTap: () => MainController.of(context).openUserPage(user.id),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +165,12 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
|
|||||||
subtitle = Text(diffTimeFromNowToStr(membership.lastActive));
|
subtitle = Text(diffTimeFromNowToStr(membership.lastActive));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ListTile(
|
return Container(
|
||||||
|
color: widget.currentPage.type == PageType.GROUP_PAGE &&
|
||||||
|
widget.currentPage.id == group.id
|
||||||
|
? Colors.grey.shade800
|
||||||
|
: null,
|
||||||
|
child: ListTile(
|
||||||
leading: GroupIcon(
|
leading: GroupIcon(
|
||||||
group: group,
|
group: group,
|
||||||
width: _MembershipIconsWidth,
|
width: _MembershipIconsWidth,
|
||||||
@ -158,6 +178,7 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
|
|||||||
title: Text(group.displayName),
|
title: Text(group.displayName),
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
onTap: () => MainController.of(context).openGroup(group.id),
|
onTap: () => MainController.of(context).openGroup(group.id),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user