Minor fixes

This commit is contained in:
Christian Pauly 2020-04-26 19:08:55 +02:00
parent c23c8ac957
commit 1cdbfc4f0b
2 changed files with 90 additions and 82 deletions

View file

@ -4,9 +4,7 @@ import 'package:flutter/material.dart';
extension PresenceExtension on Presence { extension PresenceExtension on Presence {
bool get isStatus => bool get isStatus =>
(statusMsg?.isNotEmpty ?? false) || (statusMsg?.isNotEmpty ?? false) || this.displayname != null;
this.displayname != null ||
this.avatarUrl != null;
String getLocalizedStatusMessage(BuildContext context) { String getLocalizedStatusMessage(BuildContext context) {
if (!isStatus) return null; if (!isStatus) return null;

View file

@ -229,88 +229,98 @@ class _ChatListState extends State<ChatList> {
setState(() => selectMode = SelectMode.normal); setState(() => selectMode = SelectMode.normal);
} }
return Scaffold( return Scaffold(
drawer: Drawer( drawer: selectMode == SelectMode.share
child: SafeArea( ? null
child: ListView( : Drawer(
padding: EdgeInsets.zero, child: SafeArea(
children: <Widget>[ child: ListView(
ListTile( padding: EdgeInsets.zero,
leading: Icon(Icons.edit), children: <Widget>[
title: Text(I18n.of(context).setStatus), ListTile(
onTap: () => _setStatus(context), leading: Icon(Icons.edit),
), title: Text(I18n.of(context).setStatus),
Divider(height: 1), onTap: () => _setStatus(context),
ListTile( ),
leading: Icon(Icons.people_outline), Divider(height: 1),
title: Text(I18n.of(context).createNewGroup), ListTile(
onTap: () => _drawerTapAction(NewGroupView()), leading: Icon(Icons.people_outline),
), title: Text(I18n.of(context).createNewGroup),
ListTile( onTap: () => _drawerTapAction(NewGroupView()),
leading: Icon(Icons.person_add), ),
title: Text(I18n.of(context).newPrivateChat), ListTile(
onTap: () => _drawerTapAction(NewPrivateChatView()), leading: Icon(Icons.person_add),
), title: Text(I18n.of(context).newPrivateChat),
Divider(height: 1), onTap: () => _drawerTapAction(NewPrivateChatView()),
ListTile( ),
leading: Icon(Icons.archive), Divider(height: 1),
title: Text(I18n.of(context).archive), ListTile(
onTap: () => _drawerTapAction( leading: Icon(Icons.archive),
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( 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, elevation: Matrix.of(context).client.statusList.isEmpty ? null : 0,
titleSpacing: 0, titleSpacing: 0,
title: Container( title: selectMode == SelectMode.share
padding: EdgeInsets.all(8), ? Text(I18n.of(context).share)
height: 42, : Container(
margin: EdgeInsets.only(right: 8), padding: EdgeInsets.all(8),
decoration: BoxDecoration( height: 42,
color: Theme.of(context).secondaryHeaderColor, margin: EdgeInsets.only(right: 8),
borderRadius: BorderRadius.circular(90), decoration: BoxDecoration(
), color: Theme.of(context).secondaryHeaderColor,
child: TextField( borderRadius: BorderRadius.circular(90),
autocorrect: false, ),
controller: searchController, child: TextField(
decoration: InputDecoration( autocorrect: false,
suffixIcon: loadingPublicRooms controller: searchController,
? Container( decoration: InputDecoration(
alignment: Alignment.centerRight, suffixIcon: loadingPublicRooms
child: Container( ? Container(
width: 20, alignment: Alignment.centerRight,
height: 20, child: Container(
child: CircularProgressIndicator(), width: 20,
), height: 20,
) child: CircularProgressIndicator(),
: Icon(Icons.search), ),
contentPadding: EdgeInsets.all(9), )
border: InputBorder.none, : Icon(Icons.search),
hintText: I18n.of(context).searchForAChat, contentPadding: EdgeInsets.all(9),
), border: InputBorder.none,
), hintText: I18n.of(context).searchForAChat,
), ),
),
),
bottom: Matrix.of(context).client.statusList.isEmpty bottom: Matrix.of(context).client.statusList.isEmpty
? null ? null
: PreferredSize( : PreferredSize(
@ -327,8 +337,8 @@ class _ChatListState extends State<ChatList> {
), ),
), ),
), ),
floatingActionButton: AdaptivePageLayout.columnMode(context) && floatingActionButton: (AdaptivePageLayout.columnMode(context) ||
selectMode == SelectMode.share selectMode == SelectMode.share)
? null ? null
: SpeedDial( : SpeedDial(
child: Icon(Icons.add), child: Icon(Icons.add),