From 1cdbfc4f0bde747d0e0568f9099e98402a6e2ec7 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sun, 26 Apr 2020 19:08:55 +0200 Subject: [PATCH] Minor fixes --- lib/utils/presence_extension.dart | 4 +- lib/views/chat_list.dart | 168 ++++++++++++++++-------------- 2 files changed, 90 insertions(+), 82 deletions(-) diff --git a/lib/utils/presence_extension.dart b/lib/utils/presence_extension.dart index f833620..853db87 100644 --- a/lib/utils/presence_extension.dart +++ b/lib/utils/presence_extension.dart @@ -4,9 +4,7 @@ import 'package:flutter/material.dart'; extension PresenceExtension on Presence { bool get isStatus => - (statusMsg?.isNotEmpty ?? false) || - this.displayname != null || - this.avatarUrl != null; + (statusMsg?.isNotEmpty ?? false) || this.displayname != null; String getLocalizedStatusMessage(BuildContext context) { if (!isStatus) return null; diff --git a/lib/views/chat_list.dart b/lib/views/chat_list.dart index bb32816..e0141ae 100644 --- a/lib/views/chat_list.dart +++ b/lib/views/chat_list.dart @@ -229,88 +229,98 @@ class _ChatListState extends State { setState(() => selectMode = SelectMode.normal); } return Scaffold( - drawer: Drawer( - child: SafeArea( - child: ListView( - padding: EdgeInsets.zero, - children: [ - ListTile( - leading: Icon(Icons.edit), - title: Text(I18n.of(context).setStatus), - onTap: () => _setStatus(context), - ), - Divider(height: 1), - ListTile( - leading: Icon(Icons.people_outline), - title: Text(I18n.of(context).createNewGroup), - onTap: () => _drawerTapAction(NewGroupView()), - ), - ListTile( - leading: Icon(Icons.person_add), - title: Text(I18n.of(context).newPrivateChat), - onTap: () => _drawerTapAction(NewPrivateChatView()), - ), - Divider(height: 1), - ListTile( - leading: Icon(Icons.archive), - title: Text(I18n.of(context).archive), - onTap: () => _drawerTapAction( - Archive(), + drawer: selectMode == SelectMode.share + ? null + : Drawer( + child: SafeArea( + child: ListView( + padding: EdgeInsets.zero, + children: [ + ListTile( + leading: Icon(Icons.edit), + title: Text(I18n.of(context).setStatus), + onTap: () => _setStatus(context), + ), + Divider(height: 1), + ListTile( + leading: Icon(Icons.people_outline), + title: Text(I18n.of(context).createNewGroup), + onTap: () => _drawerTapAction(NewGroupView()), + ), + ListTile( + leading: Icon(Icons.person_add), + title: Text(I18n.of(context).newPrivateChat), + onTap: () => _drawerTapAction(NewPrivateChatView()), + ), + Divider(height: 1), + ListTile( + leading: Icon(Icons.archive), + title: Text(I18n.of(context).archive), + onTap: () => _drawerTapAction( + Archive(), + ), + ), + ListTile( + leading: Icon(Icons.settings), + title: Text(I18n.of(context).settings), + onTap: () => _drawerTapAction( + SettingsView(), + ), + ), + Divider(height: 1), + ListTile( + leading: Icon(Icons.share), + title: Text(I18n.of(context).inviteContact), + onTap: () { + Navigator.of(context).pop(); + Share.share(I18n.of(context).inviteText( + Matrix.of(context).client.userID, + "https://matrix.to/#/${Matrix.of(context).client.userID}")); + }, + ), + ], ), ), - ListTile( - leading: Icon(Icons.settings), - title: Text(I18n.of(context).settings), - onTap: () => _drawerTapAction( - SettingsView(), - ), - ), - Divider(height: 1), - ListTile( - leading: Icon(Icons.share), - title: Text(I18n.of(context).inviteContact), - onTap: () { - Navigator.of(context).pop(); - Share.share(I18n.of(context).inviteText( - Matrix.of(context).client.userID, - "https://matrix.to/#/${Matrix.of(context).client.userID}")); - }, - ), - ], - ), - ), - ), + ), appBar: AppBar( + leading: selectMode != SelectMode.share + ? null + : IconButton( + icon: Icon(Icons.close), + onPressed: () => Matrix.of(context).shareContent = null, + ), elevation: Matrix.of(context).client.statusList.isEmpty ? null : 0, titleSpacing: 0, - title: Container( - padding: EdgeInsets.all(8), - height: 42, - margin: EdgeInsets.only(right: 8), - decoration: BoxDecoration( - color: Theme.of(context).secondaryHeaderColor, - borderRadius: BorderRadius.circular(90), - ), - child: TextField( - autocorrect: false, - controller: searchController, - decoration: InputDecoration( - suffixIcon: loadingPublicRooms - ? Container( - alignment: Alignment.centerRight, - child: Container( - width: 20, - height: 20, - child: CircularProgressIndicator(), - ), - ) - : Icon(Icons.search), - contentPadding: EdgeInsets.all(9), - border: InputBorder.none, - hintText: I18n.of(context).searchForAChat, - ), - ), - ), + title: selectMode == SelectMode.share + ? Text(I18n.of(context).share) + : Container( + padding: EdgeInsets.all(8), + height: 42, + margin: EdgeInsets.only(right: 8), + decoration: BoxDecoration( + color: Theme.of(context).secondaryHeaderColor, + borderRadius: BorderRadius.circular(90), + ), + child: TextField( + autocorrect: false, + controller: searchController, + decoration: InputDecoration( + suffixIcon: loadingPublicRooms + ? Container( + alignment: Alignment.centerRight, + child: Container( + width: 20, + height: 20, + child: CircularProgressIndicator(), + ), + ) + : Icon(Icons.search), + contentPadding: EdgeInsets.all(9), + border: InputBorder.none, + hintText: I18n.of(context).searchForAChat, + ), + ), + ), bottom: Matrix.of(context).client.statusList.isEmpty ? null : PreferredSize( @@ -327,8 +337,8 @@ class _ChatListState extends State { ), ), ), - floatingActionButton: AdaptivePageLayout.columnMode(context) && - selectMode == SelectMode.share + floatingActionButton: (AdaptivePageLayout.columnMode(context) || + selectMode == SelectMode.share) ? null : SpeedDial( child: Icon(Icons.add),