Fix images

This commit is contained in:
Christian Pauly 2020-04-09 10:00:18 +02:00
parent bf36bf6001
commit ca8edac132
2 changed files with 45 additions and 38 deletions

View File

@ -13,7 +13,12 @@ class ImageBubble extends StatefulWidget {
} }
class _ImageBubbleState extends State<ImageBubble> { class _ImageBubbleState extends State<ImageBubble> {
MatrixFile _file; static Map<String, MatrixFile> _matrixFileMap = {};
MatrixFile get _file => _matrixFileMap[widget.event.eventId];
set _file(MatrixFile file) {
_matrixFileMap[widget.event.eventId] = file;
}
dynamic _error; dynamic _error;
Future<MatrixFile> _getFile() async { Future<MatrixFile> _getFile() async {

View File

@ -211,7 +211,15 @@ class _ChatListState extends State<ChatList> {
searchMode = false; searchMode = false;
}), }),
) )
: null, : selectMode == SelectMode.share
? IconButton(
icon: Icon(Icons.close),
onPressed: () {
Matrix.of(context).shareContent = null;
setState(() => selectMode = SelectMode.normal);
},
)
: null,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
actions: searchMode actions: searchMode
? <Widget>[ ? <Widget>[
@ -242,14 +250,6 @@ class _ChatListState extends State<ChatList> {
icon: Icon(Icons.search), icon: Icon(Icons.search),
onPressed: () => setState(() => searchMode = true), 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) if (selectMode == SelectMode.normal)
PopupMenuButton( PopupMenuButton(
onSelected: (String choice) { onSelected: (String choice) {
@ -288,34 +288,36 @@ class _ChatListState extends State<ChatList> {
), ),
], ],
), ),
floatingActionButton: SpeedDial( floatingActionButton: selectMode == SelectMode.share
child: Icon(Icons.add), ? null
overlayColor: blackWhiteColor(context), : SpeedDial(
foregroundColor: Colors.white, child: Icon(Icons.add),
backgroundColor: Theme.of(context).primaryColor, overlayColor: blackWhiteColor(context),
children: [ foregroundColor: Colors.white,
SpeedDialChild( backgroundColor: Theme.of(context).primaryColor,
child: Icon(Icons.people_outline), children: [
foregroundColor: Colors.white, SpeedDialChild(
backgroundColor: Colors.blue, child: Icon(Icons.people_outline),
label: I18n.of(context).createNewGroup, foregroundColor: Colors.white,
labelStyle: TextStyle(fontSize: 18.0, color: Colors.black), backgroundColor: Colors.blue,
onTap: () => Navigator.of(context).pushAndRemoveUntil( label: I18n.of(context).createNewGroup,
AppRoute.defaultRoute(context, NewGroupView()), labelStyle: TextStyle(fontSize: 18.0, color: Colors.black),
(r) => r.isFirst), onTap: () => Navigator.of(context).pushAndRemoveUntil(
), AppRoute.defaultRoute(context, NewGroupView()),
SpeedDialChild( (r) => r.isFirst),
child: Icon(Icons.person_add), ),
foregroundColor: Colors.white, SpeedDialChild(
backgroundColor: Colors.green, child: Icon(Icons.person_add),
label: I18n.of(context).newPrivateChat, foregroundColor: Colors.white,
labelStyle: TextStyle(fontSize: 18.0, color: Colors.black), backgroundColor: Colors.green,
onTap: () => Navigator.of(context).pushAndRemoveUntil( label: I18n.of(context).newPrivateChat,
AppRoute.defaultRoute(context, NewPrivateChatView()), labelStyle: TextStyle(fontSize: 18.0, color: Colors.black),
(r) => r.isFirst), onTap: () => Navigator.of(context).pushAndRemoveUntil(
), AppRoute.defaultRoute(context, NewPrivateChatView()),
], (r) => r.isFirst),
), ),
],
),
body: FutureBuilder<bool>( body: FutureBuilder<bool>(
future: waitForFirstSync(context), future: waitForFirstSync(context),
builder: (BuildContext context, snapshot) { builder: (BuildContext context, snapshot) {