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(
context: Matrix.of(context).navigatorContext,
useRootNavigator: false,
builder: (_) => ImageViewer(Event.fromJson({
'type': EventTypes.Message,
'content': <String, dynamic>{
'body': mxc,
'url': mxc,
'msgtype': MessageTypes.Image,
},
'event_id': 'fake_event',
}, room))),
builder: (_) => ImageViewer(Event(
type: EventTypes.Message,
content: <String, dynamic>{
'body': mxc,
'url': mxc,
'msgtype': MessageTypes.Image,
},
senderId: room.client.userID!,
originServerTs: DateTime.now(),
eventId: 'fake_event',
room: room))),
setCodeLanguage: (String key, String value) async {
await matrix.store.setItem('${SettingKeys.codeLanguage}.$key', value);
},

View File

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

View File

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