refactor: Make reaction key not nullable
This commit is contained in:
parent
b280f8d8d9
commit
e9d04b7217
1 changed files with 8 additions and 8 deletions
|
|
@ -68,7 +68,7 @@ class MessageReactions extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.room.sendReaction(event.eventId, r.key!);
|
event.room.sendReaction(event.eventId, r.key);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLongPress: () async => await _AdaptableReactorsDialog(
|
onLongPress: () async => await _AdaptableReactorsDialog(
|
||||||
|
|
@ -92,7 +92,7 @@ class MessageReactions extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _Reaction extends StatelessWidget {
|
class _Reaction extends StatelessWidget {
|
||||||
final String? reactionKey;
|
final String reactionKey;
|
||||||
final int count;
|
final int count;
|
||||||
final bool? reacted;
|
final bool? reacted;
|
||||||
final void Function()? onTap;
|
final void Function()? onTap;
|
||||||
|
|
@ -114,12 +114,12 @@ class _Reaction extends StatelessWidget {
|
||||||
final color = Theme.of(context).colorScheme.background;
|
final color = Theme.of(context).colorScheme.background;
|
||||||
final fontSize = DefaultTextStyle.of(context).style.fontSize;
|
final fontSize = DefaultTextStyle.of(context).style.fontSize;
|
||||||
Widget content;
|
Widget content;
|
||||||
if (reactionKey!.startsWith('mxc://')) {
|
if (reactionKey.startsWith('mxc://')) {
|
||||||
content = Row(
|
content = Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
MxcImage(
|
MxcImage(
|
||||||
uri: Uri.parse(reactionKey!),
|
uri: Uri.parse(reactionKey),
|
||||||
width: 9999,
|
width: 9999,
|
||||||
height: fontSize,
|
height: fontSize,
|
||||||
),
|
),
|
||||||
|
|
@ -136,7 +136,7 @@ class _Reaction extends StatelessWidget {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
var renderKey = Characters(reactionKey!);
|
var renderKey = Characters(reactionKey);
|
||||||
if (renderKey.length > 10) {
|
if (renderKey.length > 10) {
|
||||||
renderKey = renderKey.getRange(0, 9) + Characters('…');
|
renderKey = renderKey.getRange(0, 9) + Characters('…');
|
||||||
}
|
}
|
||||||
|
|
@ -171,13 +171,13 @@ class _Reaction extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ReactionEntry {
|
class _ReactionEntry {
|
||||||
String? key;
|
String key;
|
||||||
int count;
|
int count;
|
||||||
bool reacted;
|
bool reacted;
|
||||||
List<User>? reactors;
|
List<User>? reactors;
|
||||||
|
|
||||||
_ReactionEntry({
|
_ReactionEntry({
|
||||||
this.key,
|
required this.key,
|
||||||
required this.count,
|
required this.count,
|
||||||
required this.reacted,
|
required this.reacted,
|
||||||
this.reactors,
|
this.reactors,
|
||||||
|
|
@ -222,7 +222,7 @@ class _AdaptableReactorsDialog extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final title = Center(child: Text(reactionEntry!.key!));
|
final title = Center(child: Text(reactionEntry!.key));
|
||||||
|
|
||||||
return AlertDialog.adaptive(
|
return AlertDialog.adaptive(
|
||||||
title: title,
|
title: title,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue