refactor: Added and applied require_trailing_commas linter rule

This commit is contained in:
Malin Errenst 2023-03-02 10:57:52 +01:00
commit ec7acc5385
112 changed files with 3466 additions and 2855 deletions

View file

@ -38,7 +38,8 @@ class PublicRoomBottomSheet extends StatelessWidget {
if (result.error == null) {
if (client.getRoomById(result.result!) == null) {
await client.onSync.stream.firstWhere(
(sync) => sync.rooms?.join?.containsKey(result.result) ?? false);
(sync) => sync.rooms?.join?.containsKey(result.result) ?? false,
);
}
// don't open the room if the joined room is a space
if (!client.getRoomById(result.result!)!.isSpace) {
@ -93,66 +94,69 @@ class PublicRoomBottomSheet extends StatelessWidget {
],
),
body: FutureBuilder<PublicRoomsChunk>(
future: _search(context),
builder: (context, snapshot) {
final profile = snapshot.data;
return ListView(
padding: EdgeInsets.zero,
children: [
if (profile == null)
Container(
height: 156,
alignment: Alignment.center,
color: Theme.of(context).secondaryHeaderColor,
child: snapshot.hasError
? Text(snapshot.error!.toLocalizedString(context))
: const CircularProgressIndicator.adaptive(
strokeWidth: 2),
)
else
Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Avatar(
mxContent: profile.avatarUrl,
name: profile.name ?? roomAlias,
size: Avatar.defaultSize * 3,
fontSize: 36,
),
future: _search(context),
builder: (context, snapshot) {
final profile = snapshot.data;
return ListView(
padding: EdgeInsets.zero,
children: [
if (profile == null)
Container(
height: 156,
alignment: Alignment.center,
color: Theme.of(context).secondaryHeaderColor,
child: snapshot.hasError
? Text(snapshot.error!.toLocalizedString(context))
: const CircularProgressIndicator.adaptive(
strokeWidth: 2,
),
)
else
Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Avatar(
mxContent: profile.avatarUrl,
name: profile.name ?? roomAlias,
size: Avatar.defaultSize * 3,
fontSize: 36,
),
),
ListTile(
title: Text(profile?.name ??
),
ListTile(
title: Text(
profile?.name ??
roomAlias?.localpart ??
chunk!.roomId.localpart ??
''),
subtitle: Text(
'${L10n.of(context)!.participant}: ${profile?.numJoinedMembers ?? 0}',
),
trailing: const Icon(Icons.account_box_outlined),
'',
),
if (profile?.topic?.isNotEmpty ?? false)
ListTile(
title: Text(
L10n.of(context)!.groupDescription,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
),
),
subtitle: LinkText(
text: profile!.topic!,
linkStyle: const TextStyle(color: Colors.blueAccent),
textStyle: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme.bodyMedium!.color,
),
onLinkTap: (url) =>
UrlLauncher(context, url).launchUrl(),
subtitle: Text(
'${L10n.of(context)!.participant}: ${profile?.numJoinedMembers ?? 0}',
),
trailing: const Icon(Icons.account_box_outlined),
),
if (profile?.topic?.isNotEmpty ?? false)
ListTile(
title: Text(
L10n.of(context)!.groupDescription,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
),
),
],
);
}),
subtitle: LinkText(
text: profile!.topic!,
linkStyle: const TextStyle(color: Colors.blueAccent),
textStyle: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme.bodyMedium!.color,
),
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
),
),
],
);
},
),
),
);
}