mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
Apply conversation icon to more places
This commit is contained in:
parent
b9babd43a8
commit
f9502d1700
@ -1,9 +1,12 @@
|
|||||||
import 'package:comunic/helpers/conversations_helper.dart';
|
import 'package:comunic/helpers/conversations_helper.dart';
|
||||||
|
import 'package:comunic/helpers/users_helper.dart';
|
||||||
|
import 'package:comunic/lists/users_list.dart';
|
||||||
import 'package:comunic/models/conversation.dart';
|
import 'package:comunic/models/conversation.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/update_conversation_route.dart';
|
import 'package:comunic/ui/routes/update_conversation_route.dart';
|
||||||
import 'package:comunic/ui/screens/conversation_screen.dart';
|
import 'package:comunic/ui/screens/conversation_screen.dart';
|
||||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||||
|
import 'package:comunic/ui/widgets/conversation_image_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
import 'package:comunic/utils/ui_utils.dart';
|
import 'package:comunic/utils/ui_utils.dart';
|
||||||
@ -29,6 +32,7 @@ class ConversationRoute extends StatefulWidget {
|
|||||||
class _ConversationRouteState extends SafeState<ConversationRoute> {
|
class _ConversationRouteState extends SafeState<ConversationRoute> {
|
||||||
final ConversationsHelper _conversationsHelper = ConversationsHelper();
|
final ConversationsHelper _conversationsHelper = ConversationsHelper();
|
||||||
Conversation _conversation;
|
Conversation _conversation;
|
||||||
|
UsersList _users;
|
||||||
String _conversationName;
|
String _conversationName;
|
||||||
bool _error = false;
|
bool _error = false;
|
||||||
|
|
||||||
@ -47,10 +51,10 @@ class _ConversationRouteState extends SafeState<ConversationRoute> {
|
|||||||
_conversation = await _conversationsHelper
|
_conversation = await _conversationsHelper
|
||||||
.getSingle(widget.conversationID, force: true);
|
.getSingle(widget.conversationID, force: true);
|
||||||
|
|
||||||
if (_conversation == null) return setError(true);
|
_users = await UsersHelper().getList(_conversation.membersID);
|
||||||
|
|
||||||
final conversationName =
|
final conversationName =
|
||||||
await ConversationsHelper.getConversationNameAsync(_conversation);
|
ConversationsHelper.getConversationName(_conversation, _users);
|
||||||
|
|
||||||
if (!this.mounted) return null;
|
if (!this.mounted) return null;
|
||||||
|
|
||||||
@ -99,7 +103,12 @@ class _ConversationRouteState extends SafeState<ConversationRoute> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: isTablet(context) ? null : ComunicBackButton(),
|
leading: isTablet(context)
|
||||||
|
? (_conversation == null || _users == null
|
||||||
|
? null
|
||||||
|
: ConversationImageWidget(
|
||||||
|
conversation: _conversation, users: _users))
|
||||||
|
: ComunicBackButton(),
|
||||||
title: Text(
|
title: Text(
|
||||||
_conversationName == null ? tr("Loading") : _conversationName,
|
_conversationName == null ? tr("Loading") : _conversationName,
|
||||||
),
|
),
|
||||||
|
@ -11,6 +11,7 @@ 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/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/conversation_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';
|
||||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||||
@ -202,7 +203,10 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
|
|||||||
color: color,
|
color: color,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
leading: Icon(Icons.message),
|
leading: ConversationImageWidget(
|
||||||
|
conversation: conversation,
|
||||||
|
users: _usersList,
|
||||||
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
ConversationsHelper.getConversationName(conversation, _usersList)),
|
ConversationsHelper.getConversationName(conversation, _usersList)),
|
||||||
subtitle: Text(diffTimeFromNowToStr(membership.lastActive) +
|
subtitle: Text(diffTimeFromNowToStr(membership.lastActive) +
|
||||||
|
Loading…
Reference in New Issue
Block a user