simplified code across the app and consolidated duplicated helpers

This commit is contained in:
2026-09-27 17:29:54 +02:00
parent 3e856d0b1c
commit ee1240f71a
155 changed files with 1772 additions and 2546 deletions
@@ -67,7 +67,12 @@ class ShareChatPicker extends StatelessWidget {
@override
Widget build(BuildContext context) {
final talkSettings = context.watch<SettingsCubit>().val().talkSettings;
final (favoritesToTop, unreadToTop) = context.select(
(SettingsCubit c) => (
c.state.talkSettings.sortFavoritesToTop,
c.state.talkSettings.sortUnreadToTop,
),
);
return Scaffold(
appBar: AppBar(
title: const Text('Talk-Chat auswählen'),
@@ -100,8 +105,8 @@ class ShareChatPicker extends StatelessWidget {
if (rooms == null) return const SizedBox.shrink();
final sorted = rooms
.sortBy(
favoritesToTop: talkSettings.sortFavoritesToTop,
unreadToTop: talkSettings.sortUnreadToTop,
favoritesToTop: favoritesToTop,
unreadToTop: unreadToTop,
)
// Hide chats the user can't write to (announcement channels,
// archived rooms, …) — uploading there would only fail at the
@@ -195,8 +200,8 @@ Future<void> _runShareFlow(
try {
await action();
} catch (e) {
if (context.mounted) Navigator.of(context).pop();
if (context.mounted) {
Navigator.of(context).pop();
InfoDialog.show(
context,
errorToUserMessage(e),