chore: Follow up null safety fixes

This commit is contained in:
Krille Fear 2022-02-06 17:09:45 +01:00
parent 566b9155d1
commit 79a2db9e63
3 changed files with 23 additions and 18 deletions

View File

@ -76,15 +76,17 @@ class HtmlMessage extends StatelessWidget {
onImageTap: (String mxc) => showDialog( onImageTap: (String mxc) => showDialog(
context: Matrix.of(context).navigatorContext, context: Matrix.of(context).navigatorContext,
useRootNavigator: false, useRootNavigator: false,
builder: (_) => ImageViewer(Event.fromJson({ builder: (_) => ImageViewer(Event(
'type': EventTypes.Message, type: EventTypes.Message,
'content': <String, dynamic>{ content: <String, dynamic>{
'body': mxc, 'body': mxc,
'url': mxc, 'url': mxc,
'msgtype': MessageTypes.Image, 'msgtype': MessageTypes.Image,
}, },
'event_id': 'fake_event', senderId: room.client.userID!,
}, room))), originServerTs: DateTime.now(),
eventId: 'fake_event',
room: room))),
setCodeLanguage: (String key, String value) async { setCodeLanguage: (String key, String value) async {
await matrix.store.setItem('${SettingKeys.codeLanguage}.$key', value); await matrix.store.setItem('${SettingKeys.codeLanguage}.$key', value);
}, },

View File

@ -63,14 +63,17 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int imageIndex) { itemBuilder: (BuildContext context, int imageIndex) {
final image = pack.images[imageKeys[imageIndex]]!; final image = pack.images[imageKeys[imageIndex]]!;
final fakeEvent = Event.fromJson(<String, dynamic>{ final fakeEvent = Event(
'type': EventTypes.Sticker, type: EventTypes.Sticker,
'content': <String, dynamic>{ content: {
'url': image.url.toString(), 'url': image.url.toString(),
'info': image.info, 'info': image.info,
}, },
'event_id': 'fake_event', originServerTs: DateTime.now(),
}, widget.room); room: widget.room,
eventId: 'fake_event',
senderId: widget.room.client.userID!,
);
return InkWell( return InkWell(
key: ValueKey(image.url.toString()), key: ValueKey(image.url.toString()),
onTap: () { onTap: () {

View File

@ -33,10 +33,10 @@ class EmotesSettingsController extends State<EmotesSettings> {
final event = (room != null final event = (room != null
? room!.getState('im.ponies.room_emotes', stateKey ?? '') ? room!.getState('im.ponies.room_emotes', stateKey ?? '')
: client.accountData['im.ponies.user_emotes']) ?? : client.accountData['im.ponies.user_emotes']) ??
BasicEvent.fromJson(<String, dynamic>{ BasicEvent(
'type': 'm.dummy', type: 'm.dummy',
'content': <String, dynamic>{}, content: {},
}); );
// make sure we work on a *copy* of the event // make sure we work on a *copy* of the event
return BasicEvent.fromJson(event.toJson()).parsedImagePackContent; return BasicEvent.fromJson(event.toJson()).parsedImagePackContent;
} }