dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
+23 -13
View File
@@ -28,18 +28,17 @@ class _ChatInfoState extends State<ChatInfo> {
setState(() {
participants = data;
});
}
},
);
super.initState();
}
@override
Widget build(BuildContext context) {
var isGroup = widget.room.type != GetRoomResponseObjectConversationType.oneToOne;
var isGroup =
widget.room.type != GetRoomResponseObjectConversationType.oneToOne;
return Scaffold(
appBar: AppBar(
title: Text(widget.room.displayName),
),
appBar: AppBar(title: Text(widget.room.displayName)),
body: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
@@ -52,23 +51,34 @@ class _ChatInfoState extends State<ChatInfo> {
size: 80,
),
onTap: () {
if(isGroup) return;
TalkNavigator.pushSplitView(context, LargeProfilePictureView(widget.room.name));
if (isGroup) return;
TalkNavigator.pushSplitView(
context,
LargeProfilePictureView(widget.room.name),
);
},
),
const SizedBox(height: 30),
Text(widget.room.displayName, textAlign: TextAlign.center, style: const TextStyle(fontSize: 30)),
if(!isGroup) Text(widget.room.name),
Text(
widget.room.displayName,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 30),
),
if (!isGroup) Text(widget.room.name),
const SizedBox(height: 10),
if(isGroup) Text(widget.room.description, textAlign: TextAlign.center),
if (isGroup)
Text(widget.room.description, textAlign: TextAlign.center),
const SizedBox(height: 30),
if(participants == null) const LoadingSpinner(),
if(participants != null) ...[
if (participants == null) const LoadingSpinner(),
if (participants != null) ...[
ListTile(
leading: const Icon(Icons.supervised_user_circle),
title: Text('${participants!.data.length} Mitglieder'),
trailing: const Icon(Icons.arrow_right),
onTap: () => TalkNavigator.pushSplitView(context, ParticipantsListView(participants!)),
onTap: () => TalkNavigator.pushSplitView(
context,
ParticipantsListView(participants!),
),
),
],
],
@@ -13,7 +13,11 @@ import '../../../../widget/user_avatar.dart';
class MessageReactions extends StatefulWidget {
final String token;
final int messageId;
const MessageReactions({super.key, required this.token, required this.messageId});
const MessageReactions({
super.key,
required this.token,
required this.messageId,
});
@override
State<MessageReactions> createState() => _MessageReactionsState();
@@ -25,53 +29,67 @@ class _MessageReactionsState extends State<MessageReactions> {
@override
void initState() {
super.initState();
data = GetReactions(chatToken: widget.token, messageId: widget.messageId).run();
data = GetReactions(
chatToken: widget.token,
messageId: widget.messageId,
).run();
}
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Reaktionen'),
),
body: FutureBuilder(
future: data,
builder: (context, snapshot) {
if(snapshot.connectionState == ConnectionState.waiting) return const LoadingSpinner();
if(snapshot.data!.data.isEmpty) return const PlaceholderView(icon: Icons.search_off_outlined, text: 'Keine Reaktionen gefunden!');
return ListView(
children: [
...snapshot.data!.data.entries.map<Widget>((entry) => ExpansionTile(
textColor: Theme.of(context).colorScheme.onSurface,
collapsedTextColor: Theme.of(context).colorScheme.onSurface,
iconColor: Theme.of(context).colorScheme.onSurface,
collapsedIconColor: Theme.of(context).colorScheme.onSurface,
appBar: AppBar(title: const Text('Reaktionen')),
body: FutureBuilder(
future: data,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const LoadingSpinner();
}
if (snapshot.data!.data.isEmpty) {
return const PlaceholderView(
icon: Icons.search_off_outlined,
text: 'Keine Reaktionen gefunden!',
);
}
return ListView(
children: [
...snapshot.data!.data.entries.map<Widget>(
(entry) => ExpansionTile(
textColor: Theme.of(context).colorScheme.onSurface,
collapsedTextColor: Theme.of(context).colorScheme.onSurface,
iconColor: Theme.of(context).colorScheme.onSurface,
collapsedIconColor: Theme.of(context).colorScheme.onSurface,
subtitle: const Text('Tippe für mehr'),
leading: CenteredLeading(Text(entry.key)),
title: Text('${entry.value.length} mal reagiert'),
children: entry.value.map((e) {
var isSelf = AccountData().getUsername() == e.actorId;
return ListTile(
leading: UserAvatar(id: e.actorId, isGroup: false),
title: Text(e.actorDisplayName),
subtitle: isSelf
subtitle: const Text('Tippe für mehr'),
leading: CenteredLeading(Text(entry.key)),
title: Text('${entry.value.length} mal reagiert'),
children: entry.value.map((e) {
var isSelf = AccountData().getUsername() == e.actorId;
return ListTile(
leading: UserAvatar(id: e.actorId, isGroup: false),
title: Text(e.actorDisplayName),
subtitle: isSelf
? const Text('Du')
: e.actorType == GetReactionsResponseObjectActorType.guests ? const Text('Gast') : null,
trailing: isSelf
: e.actorType ==
GetReactionsResponseObjectActorType.guests
? const Text('Gast')
: null,
trailing: isSelf
? null
: Visibility(
visible: kReleaseMode,
child: IconButton(
onPressed: () => UnimplementedDialog.show(context),
icon: const Icon(Icons.textsms_outlined),
visible: kReleaseMode,
child: IconButton(
onPressed: () =>
UnimplementedDialog.show(context),
icon: const Icon(Icons.textsms_outlined),
),
),
),
);
}).toList(),
))
],
);
},
),
);
);
}).toList(),
),
),
],
);
},
),
);
}
@@ -10,38 +10,46 @@ class ParticipantsListView extends StatelessWidget {
@override
Widget build(BuildContext context) {
String lastname(participant) => participant.displayName.toString().split(' ').last;
final participants = participantsResponse.data
.sorted((a, b) {
final typeComparison = a.participantType.index.compareTo(b.participantType.index);
if (typeComparison != 0) return typeComparison;
return lastname(a).compareTo(lastname(b));
});
var groupedParticipants = participants.groupListsBy((participant) => participant.participantType);
String lastname(participant) =>
participant.displayName.toString().split(' ').last;
final participants = participantsResponse.data.sorted((a, b) {
final typeComparison = a.participantType.index.compareTo(
b.participantType.index,
);
if (typeComparison != 0) return typeComparison;
return lastname(a).compareTo(lastname(b));
});
var groupedParticipants = participants.groupListsBy(
(participant) => participant.participantType,
);
return Scaffold(
appBar: AppBar(
title: const Text('Mitglieder'),
),
appBar: AppBar(title: const Text('Mitglieder')),
body: ListView(
children: [
...groupedParticipants.entries.map((entry) => Column(
children: [
ListTile(
title: Text(entry.key.prettyName),
titleTextStyle: Theme.of(context).textTheme.titleMedium
),
...entry.value.map((participant) => ListTile(
leading: UserAvatar(id: participant.actorId),
title: Text(participant.displayName),
subtitle: participant.statusMessage != null ? Text(participant.statusMessage!) : null,
)),
Divider(),
],
))
...groupedParticipants.entries.map(
(entry) => Column(
children: [
ListTile(
title: Text(entry.key.prettyName),
titleTextStyle: Theme.of(context).textTheme.titleMedium,
),
...entry.value.map(
(participant) => ListTile(
leading: UserAvatar(id: participant.actorId),
title: Text(participant.displayName),
subtitle: participant.statusMessage != null
? Text(participant.statusMessage!)
: null,
),
),
Divider(),
],
),
),
],
)
),
);
}
}