From 69771122b1d71d5b42a320abecd2a00f55f2c979 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sun, 22 Nov 2020 19:49:30 +0100 Subject: [PATCH] chore: Minor design changes in chatlist item --- lib/components/dialogs/simple_dialogs.dart | 5 +- lib/components/list_items/chat_list_item.dart | 74 +++++++++---------- 2 files changed, 37 insertions(+), 42 deletions(-) diff --git a/lib/components/dialogs/simple_dialogs.dart b/lib/components/dialogs/simple_dialogs.dart index b1481cd9..05e3a9d4 100644 --- a/lib/components/dialogs/simple_dialogs.dart +++ b/lib/components/dialogs/simple_dialogs.dart @@ -10,13 +10,10 @@ class SimpleDialogs { Future tryRequestWithLoadingDialog(Future request, {Function(MatrixException) onAdditionalAuth}) async { - var completed = false; final futureResult = tryRequestWithErrorToast( request, onAdditionalAuth: onAdditionalAuth, - ).whenComplete(() => completed = true); - await Future.delayed(Duration(seconds: 1)); - if (completed) return futureResult; + ); return showDialog( context: context, barrierDismissible: false, diff --git a/lib/components/list_items/chat_list_item.dart b/lib/components/list_items/chat_list_item.dart index e27bd2ec..16cfd36c 100644 --- a/lib/components/list_items/chat_list_item.dart +++ b/lib/components/list_items/chat_list_item.dart @@ -163,25 +163,14 @@ class ChatListItem extends StatelessWidget { softWrap: false, ), ), - room.isFavourite - ? Padding( - padding: const EdgeInsets.only(left: 4.0), - child: Icon( - Icons.favorite_rounded, - size: 16, - color: Theme.of(context).primaryColor, - ), - ) - : Container(), - isMuted - ? Padding( - padding: const EdgeInsets.only(left: 4.0), - child: Icon( - Icons.notifications_off_outlined, - size: 16, - ), - ) - : Container(), + if (isMuted) + Padding( + padding: const EdgeInsets.only(left: 4.0), + child: Icon( + Icons.notifications_off_outlined, + size: 16, + ), + ), Padding( padding: const EdgeInsets.only(left: 4.0), child: Text( @@ -250,26 +239,35 @@ class ChatListItem extends StatelessWidget { ), ), SizedBox(width: 8), - room.notificationCount > 0 - ? Container( - padding: EdgeInsets.symmetric(horizontal: 7), - height: 20, - decoration: BoxDecoration( - color: room.highlightCount > 0 - ? Colors.red - : Theme.of(context).primaryColor, - borderRadius: BorderRadius.circular(20), + if (room.isFavourite) + Padding( + padding: EdgeInsets.only( + right: room.notificationCount > 0 ? 4.0 : 0.0), + child: Icon( + Icons.favorite_rounded, + size: 20, + color: Theme.of(context).primaryColor, + ), + ), + if (room.notificationCount > 0) + Container( + padding: EdgeInsets.symmetric(horizontal: 7), + height: 20, + decoration: BoxDecoration( + color: room.highlightCount > 0 + ? Colors.red + : Theme.of(context).primaryColor, + borderRadius: BorderRadius.circular(20), + ), + child: Center( + child: Text( + room.notificationCount.toString(), + style: TextStyle( + color: Colors.white, ), - child: Center( - child: Text( - room.notificationCount.toString(), - style: TextStyle( - color: Colors.white, - ), - ), - ), - ) - : Text(' '), + ), + ), + ), ], ), onTap: () => clickAction(context),