1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 04:49:21 +00:00

Make presence tab work

This commit is contained in:
Pierre HUBERT 2021-04-24 10:17:18 +02:00
parent c4790635df
commit 44b6fb65bc

View File

@ -4,6 +4,7 @@ import 'package:comunic/ui/dialogs/alert_dialog.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/routes/main_route/page_info.dart';
import 'package:comunic/ui/screens/conversations_list_screen.dart'; import 'package:comunic/ui/screens/conversations_list_screen.dart';
import 'package:comunic/ui/screens/group_sections/forez_presence_section.dart';
import 'package:comunic/ui/widgets/safe_state.dart'; import 'package:comunic/ui/widgets/safe_state.dart';
import 'package:comunic/ui/widgets/status_widget.dart'; import 'package:comunic/ui/widgets/status_widget.dart';
import 'package:comunic/ui/widgets/tab_transition_widget.dart'; import 'package:comunic/ui/widgets/tab_transition_widget.dart';
@ -114,14 +115,14 @@ class _ForezRouteBodyState extends SafeState<ForezRouteBody> {
_Tab( _Tab(
icon: Icons.calendar_today, icon: Icons.calendar_today,
title: tr("Presence"), title: tr("Presence"),
widget: Text("Presence"), widget: () => ForezPresenceSection(groupID: forezGroup.id),
), ),
// Conversations tab // Conversations tab
_Tab( _Tab(
icon: Icons.question_answer, icon: Icons.question_answer,
title: tr("Conversations"), title: tr("Conversations"),
widget: ConversationsListScreen(), widget: () => ConversationsListScreen(),
isUnread: (c) => StatusWidgetState.of(c).unreadConversations > 0, isUnread: (c) => StatusWidgetState.of(c).unreadConversations > 0,
), ),
@ -129,7 +130,7 @@ class _ForezRouteBodyState extends SafeState<ForezRouteBody> {
_Tab( _Tab(
icon: Icons.import_contacts, icon: Icons.import_contacts,
title: tr("Directory"), title: tr("Directory"),
widget: Text("Directory"), widget: () => Text("Directory"),
), ),
]; ];
@ -147,13 +148,13 @@ class _ForezRouteBodyState extends SafeState<ForezRouteBody> {
.toList(); .toList();
List<Widget> get _tabsPages => List<Widget> get _tabsPages =>
_list.map((e) => TabTransitionWidget(e.widget)).toList(); _list.map((e) => TabTransitionWidget(e.widget())).toList();
} }
class _Tab { class _Tab {
final IconData icon; final IconData icon;
final String title; final String title;
final Widget widget; final Widget Function() widget;
final bool Function(BuildContext) isUnread; final bool Function(BuildContext) isUnread;
const _Tab({ const _Tab({