From ca8edac132ddfaef7c2e128b5c9114eee2f7cef5 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Thu, 9 Apr 2020 10:00:18 +0200 Subject: [PATCH] Fix images --- lib/components/image_bubble.dart | 7 ++- lib/views/chat_list.dart | 76 ++++++++++++++++---------------- 2 files changed, 45 insertions(+), 38 deletions(-) diff --git a/lib/components/image_bubble.dart b/lib/components/image_bubble.dart index 3c22ada..c257e1d 100644 --- a/lib/components/image_bubble.dart +++ b/lib/components/image_bubble.dart @@ -13,7 +13,12 @@ class ImageBubble extends StatefulWidget { } class _ImageBubbleState extends State { - MatrixFile _file; + static Map _matrixFileMap = {}; + MatrixFile get _file => _matrixFileMap[widget.event.eventId]; + set _file(MatrixFile file) { + _matrixFileMap[widget.event.eventId] = file; + } + dynamic _error; Future _getFile() async { diff --git a/lib/views/chat_list.dart b/lib/views/chat_list.dart index bc55024..888cec2 100644 --- a/lib/views/chat_list.dart +++ b/lib/views/chat_list.dart @@ -211,7 +211,15 @@ class _ChatListState extends State { searchMode = false; }), ) - : null, + : selectMode == SelectMode.share + ? IconButton( + icon: Icon(Icons.close), + onPressed: () { + Matrix.of(context).shareContent = null; + setState(() => selectMode = SelectMode.normal); + }, + ) + : null, automaticallyImplyLeading: false, actions: searchMode ? [ @@ -242,14 +250,6 @@ class _ChatListState extends State { icon: Icon(Icons.search), onPressed: () => setState(() => searchMode = true), ), - if (selectMode == SelectMode.share) - IconButton( - icon: Icon(Icons.close), - onPressed: () { - Matrix.of(context).shareContent = null; - setState(() => selectMode = SelectMode.normal); - }, - ), if (selectMode == SelectMode.normal) PopupMenuButton( onSelected: (String choice) { @@ -288,34 +288,36 @@ class _ChatListState extends State { ), ], ), - floatingActionButton: SpeedDial( - child: Icon(Icons.add), - overlayColor: blackWhiteColor(context), - foregroundColor: Colors.white, - backgroundColor: Theme.of(context).primaryColor, - children: [ - SpeedDialChild( - child: Icon(Icons.people_outline), - foregroundColor: Colors.white, - backgroundColor: Colors.blue, - label: I18n.of(context).createNewGroup, - labelStyle: TextStyle(fontSize: 18.0, color: Colors.black), - onTap: () => Navigator.of(context).pushAndRemoveUntil( - AppRoute.defaultRoute(context, NewGroupView()), - (r) => r.isFirst), - ), - SpeedDialChild( - child: Icon(Icons.person_add), - foregroundColor: Colors.white, - backgroundColor: Colors.green, - label: I18n.of(context).newPrivateChat, - labelStyle: TextStyle(fontSize: 18.0, color: Colors.black), - onTap: () => Navigator.of(context).pushAndRemoveUntil( - AppRoute.defaultRoute(context, NewPrivateChatView()), - (r) => r.isFirst), - ), - ], - ), + floatingActionButton: selectMode == SelectMode.share + ? null + : SpeedDial( + child: Icon(Icons.add), + overlayColor: blackWhiteColor(context), + foregroundColor: Colors.white, + backgroundColor: Theme.of(context).primaryColor, + children: [ + SpeedDialChild( + child: Icon(Icons.people_outline), + foregroundColor: Colors.white, + backgroundColor: Colors.blue, + label: I18n.of(context).createNewGroup, + labelStyle: TextStyle(fontSize: 18.0, color: Colors.black), + onTap: () => Navigator.of(context).pushAndRemoveUntil( + AppRoute.defaultRoute(context, NewGroupView()), + (r) => r.isFirst), + ), + SpeedDialChild( + child: Icon(Icons.person_add), + foregroundColor: Colors.white, + backgroundColor: Colors.green, + label: I18n.of(context).newPrivateChat, + labelStyle: TextStyle(fontSize: 18.0, color: Colors.black), + onTap: () => Navigator.of(context).pushAndRemoveUntil( + AppRoute.defaultRoute(context, NewPrivateChatView()), + (r) => r.isFirst), + ), + ], + ), body: FutureBuilder( future: waitForFirstSync(context), builder: (BuildContext context, snapshot) {