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> {
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;
Future<MatrixFile> _getFile() async {

View File

@ -211,7 +211,15 @@ class _ChatListState extends State<ChatList> {
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
? <Widget>[
@ -242,14 +250,6 @@ class _ChatListState extends State<ChatList> {
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<ChatList> {
),
],
),
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<bool>(
future: waitForFirstSync(context),
builder: (BuildContext context, snapshot) {