chore: Avoid unnecessary lambdas

This commit is contained in:
Christian Kußowski 2026-02-20 14:19:03 +01:00
commit a0a03941c2
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
13 changed files with 19 additions and 32 deletions

View file

@ -155,8 +155,7 @@ class ChatEventList extends StatelessWidget {
highlightMarker:
controller.scrollToEventIdMarker == event.eventId,
onSelect: controller.onSelectMessage,
scrollToEventId: (String eventId) =>
controller.scrollToEventId(eventId),
scrollToEventId: controller.scrollToEventId,
longPressSelect: controller.selectedEvents.isNotEmpty,
selected: controller.selectedEvents.any(
(e) => e.eventId == event.eventId,
@ -164,7 +163,7 @@ class ChatEventList extends StatelessWidget {
singleSelected:
controller.selectedEvents.singleOrNull?.eventId ==
event.eventId,
onEdit: () => controller.editSelectedEventAction(),
onEdit: controller.editSelectedEventAction,
timeline: timeline,
displayReadMarker:
i > 0 && controller.readMarkerEventId == event.eventId,

View file

@ -207,7 +207,7 @@ class MessageContent extends StatelessWidget {
.split(';')
.first
.split(',')
.map((s) => double.tryParse(s))
.map(double.tryParse)
.toList();
if (latlong.length == 2 &&
latlong.first != null &&

View file

@ -66,7 +66,7 @@ class MessageReactions extends StatelessWidget {
if (evt != null) {
showFutureLoadingDialog(
context: context,
future: () => evt.redactEvent(),
future: evt.redactEvent,
);
}
} else {

View file

@ -25,7 +25,7 @@ class PollWidget extends StatelessWidget {
});
void _endPoll(BuildContext context) =>
showFutureLoadingDialog(context: context, future: () => event.endPoll());
showFutureLoadingDialog(context: context, future: event.endPoll);
void _toggleVote(BuildContext context, String answerId, int maxSelection) {
final userId = event.room.client.userID!;

View file

@ -145,9 +145,7 @@ class RecordingViewModelState extends State<RecordingViewModel> {
}
void cancel() {
setState(() {
_reset();
});
setState(_reset);
}
void pause() {

View file

@ -181,9 +181,7 @@ class ChatAccessSettingsPageView extends StatelessWidget {
return const SizedBox.shrink();
}
localAddresses.remove(room.canonicalAlias);
localAddresses.removeWhere(
(alias) => altAliases.contains(alias),
);
localAddresses.removeWhere(altAliases.contains);
return Column(
mainAxisSize: .min,
children: localAddresses

View file

@ -35,7 +35,7 @@ class ChatListViewBody extends StatelessWidget {
key: ValueKey(activeSpace),
spaceId: activeSpace,
onBack: controller.clearActiveSpace,
onChatTab: (room) => controller.onChatTap(room),
onChatTab: controller.onChatTap,
activeChat: controller.activeChat,
);
}
@ -123,7 +123,7 @@ class ChatListViewBody extends StatelessWidget {
if (!controller.isSearchMode &&
AppSettings.showPresences.value)
GestureDetector(
onLongPress: () => controller.dismissStatusList(),
onLongPress: controller.dismissStatusList,
child: StatusMessageList(
onStatusEdit: controller.setStatus,
),

View file

@ -194,9 +194,7 @@ class MyCallingPage extends State<Calling> {
call.onCallStateChanged.stream.listen(_handleCallState);
call.onCallEventChanged.stream.listen((event) {
if (event == CallStateChange.kFeedsChanged) {
setState(() {
call.tryRemoveStopedStreams();
});
setState(call.tryRemoveStopedStreams);
} else if (event == CallStateChange.kLocalHoldUnhold ||
event == CallStateChange.kRemoteHoldUnhold) {
setState(() {});