simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -16,6 +16,7 @@ import '../../../../widget/large_profile_picture_view.dart';
|
||||
import '../../../../widget/user_avatar.dart';
|
||||
import '../talk_navigator.dart';
|
||||
import '../widgets/notification_level_sheet.dart';
|
||||
import '../widgets/room_actions.dart';
|
||||
import 'participants_list_view.dart';
|
||||
import 'shared_items_view.dart';
|
||||
|
||||
@@ -82,19 +83,8 @@ class _ChatInfoState extends State<ChatInfo> {
|
||||
}
|
||||
|
||||
Future<void> _confirmLeave() async {
|
||||
final closed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (_) => ConfirmDialog(
|
||||
title: 'Talk-Chat verlassen',
|
||||
content: 'Du benötigst ggf. eine Einladung um erneut beizutreten.',
|
||||
confirmButton: 'Verlassen',
|
||||
onConfirmAsync: () async {
|
||||
await LeaveRoom(widget.room.token).run();
|
||||
if (mounted) _refreshList();
|
||||
},
|
||||
),
|
||||
);
|
||||
if (closed == true && mounted) Navigator.of(context).pop();
|
||||
final left = await confirmLeaveRoom(context, widget.room.token);
|
||||
if (left && mounted) Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
// Spreed's POST /room/{token}/avatar requires moderator rights and rejects
|
||||
@@ -245,18 +235,10 @@ class _ChatInfoState extends State<ChatInfo> {
|
||||
SharedItemsView(widget.room, overview: _sharesOverview),
|
||||
),
|
||||
),
|
||||
if (_isFavorite)
|
||||
AsyncListTile(
|
||||
leading: const Icon(Icons.stars_outlined),
|
||||
title: const Text('Von Favoriten entfernen'),
|
||||
onPressed: _toggleFavorite,
|
||||
)
|
||||
else
|
||||
AsyncListTile(
|
||||
leading: const Icon(Icons.star_outline),
|
||||
title: const Text('Zu Favoriten hinzufügen'),
|
||||
onPressed: _toggleFavorite,
|
||||
),
|
||||
FavoriteToggleTile(
|
||||
isFavorite: _isFavorite,
|
||||
onPressed: _toggleFavorite,
|
||||
),
|
||||
NotificationLevelTile(
|
||||
level: _notificationLevel,
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
|
||||
@@ -22,8 +22,8 @@ class ParticipantsListView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String lastname(participant) =>
|
||||
participant.displayName.toString().split(' ').last;
|
||||
String lastname(GetParticipantsResponseObject participant) =>
|
||||
participant.displayName.split(' ').last;
|
||||
|
||||
final participants = participantsResponse.data.sorted((a, b) {
|
||||
final typeComparison = a.participantType.index.compareTo(
|
||||
|
||||
@@ -23,19 +23,18 @@ const int _sharedItemsPageSize = 20;
|
||||
/// handled separately (split into Bilder/Videos). `location`/`deckcard` are rich
|
||||
/// objects without a downloadable file, so they have no place in this view.
|
||||
const List<_SharedCategory> _sharedCategories = [
|
||||
_SharedCategory('file', 'Dokumente', _SharedItemsLayout.list),
|
||||
_SharedCategory('voice', 'Sprachnachrichten', _SharedItemsLayout.list),
|
||||
_SharedCategory('audio', 'Audio', _SharedItemsLayout.list),
|
||||
_SharedCategory('recording', 'Aufnahmen', _SharedItemsLayout.list),
|
||||
_SharedCategory('other', 'Sonstiges', _SharedItemsLayout.list),
|
||||
_SharedCategory('file', 'Dokumente'),
|
||||
_SharedCategory('voice', 'Sprachnachrichten'),
|
||||
_SharedCategory('audio', 'Audio'),
|
||||
_SharedCategory('recording', 'Aufnahmen'),
|
||||
_SharedCategory('other', 'Sonstiges'),
|
||||
];
|
||||
|
||||
class _SharedCategory {
|
||||
final String objectType;
|
||||
final String label;
|
||||
final _SharedItemsLayout layout;
|
||||
|
||||
const _SharedCategory(this.objectType, this.label, this.layout);
|
||||
const _SharedCategory(this.objectType, this.label);
|
||||
}
|
||||
|
||||
bool _isVideoItem(GetChatResponseObject item) {
|
||||
@@ -203,7 +202,7 @@ class _SharedItemsViewState extends State<SharedItemsView>
|
||||
_SharedItemsTab(
|
||||
token: widget.room.token,
|
||||
objectType: category.objectType,
|
||||
layout: category.layout,
|
||||
layout: _SharedItemsLayout.list,
|
||||
emptyLabel: 'Keine Einträge',
|
||||
initialPage: _seedFromOverview(raw),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user