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]
|
||||
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
|
||||
void openFriendsList() => pushPage(
|
||||
|
@ -66,17 +66,17 @@ class _TabletRouteState extends MainController {
|
||||
Container(height: 10),
|
||||
GlobalSearchField(),
|
||||
Container(height: 10),
|
||||
Expanded(child: MembershipsPanel())
|
||||
Expanded(child: MembershipsPanel(currentPage: currentPage))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Widget _buildRightPane() => Container(
|
||||
key: currentPage.key,
|
||||
width: MediaQuery.of(context).size.width - _SideBarSize,
|
||||
child: currentPage.child,
|
||||
);
|
||||
key: currentPage.key,
|
||||
width: MediaQuery.of(context).size.width - _SideBarSize,
|
||||
child: currentPage.child,
|
||||
);
|
||||
|
||||
@override
|
||||
void pushPage(PageInfo page) {
|
||||
|
@ -9,6 +9,7 @@ import 'package:comunic/lists/users_list.dart';
|
||||
import 'package:comunic/models/friend.dart';
|
||||
import 'package:comunic/models/membership.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/group_icon_widget.dart';
|
||||
import 'package:comunic/ui/widgets/group_membership_widget.dart';
|
||||
@ -23,6 +24,14 @@ import 'package:flutter/material.dart';
|
||||
/// @author Pierre Hubert
|
||||
|
||||
class MembershipsPanel extends StatefulWidget {
|
||||
final PageInfo currentPage;
|
||||
|
||||
const MembershipsPanel({
|
||||
Key key,
|
||||
@required this.currentPage,
|
||||
}) : assert(currentPage != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
_MembershipsPanelState createState() => _MembershipsPanelState();
|
||||
}
|
||||
@ -127,11 +136,17 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
|
||||
style: TextStyle(color: connected ? Colors.green : null),
|
||||
);
|
||||
|
||||
return ListTile(
|
||||
leading: AccountImageWidget(user: user, width: _MembershipIconsWidth),
|
||||
title: Text(user.displayName),
|
||||
subtitle: subtitle,
|
||||
onTap: () => MainController.of(context).openUserPage(user.id),
|
||||
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),
|
||||
title: Text(user.displayName),
|
||||
subtitle: subtitle,
|
||||
onTap: () => MainController.of(context).openUserPage(user.id),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -150,14 +165,20 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
|
||||
subtitle = Text(diffTimeFromNowToStr(membership.lastActive));
|
||||
}
|
||||
|
||||
return ListTile(
|
||||
leading: GroupIcon(
|
||||
group: group,
|
||||
width: _MembershipIconsWidth,
|
||||
return Container(
|
||||
color: widget.currentPage.type == PageType.GROUP_PAGE &&
|
||||
widget.currentPage.id == group.id
|
||||
? Colors.grey.shade800
|
||||
: null,
|
||||
child: ListTile(
|
||||
leading: GroupIcon(
|
||||
group: group,
|
||||
width: _MembershipIconsWidth,
|
||||
),
|
||||
title: Text(group.displayName),
|
||||
subtitle: subtitle,
|
||||
onTap: () => MainController.of(context).openGroup(group.id),
|
||||
),
|
||||
title: Text(group.displayName),
|
||||
subtitle: subtitle,
|
||||
onTap: () => MainController.of(context).openGroup(group.id),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user