refactor: Enable lint use_build_context_synchronously
This commit is contained in:
parent
a3fc1bff01
commit
3296c0d92d
50 changed files with 490 additions and 293 deletions
|
|
@ -25,6 +25,7 @@ class PublicRoomDialog extends StatelessWidget {
|
|||
const PublicRoomDialog({super.key, this.roomAlias, this.chunk, this.via});
|
||||
|
||||
Future<void> _joinRoom(BuildContext context) async {
|
||||
final l10n = L10n.of(context);
|
||||
final client = Matrix.of(context).client;
|
||||
final chunk = this.chunk;
|
||||
final knock = chunk?.joinRule == 'knock';
|
||||
|
|
@ -48,12 +49,13 @@ class PublicRoomDialog extends StatelessWidget {
|
|||
);
|
||||
final roomId = result.result;
|
||||
if (roomId == null) return;
|
||||
if (!context.mounted) return;
|
||||
if (knock && client.getRoomById(roomId) == null) {
|
||||
Navigator.of(context).pop<bool>(true);
|
||||
await showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).youHaveKnocked,
|
||||
message: L10n.of(context).pleaseWaitUntilInvited,
|
||||
title: l10n.youHaveKnocked,
|
||||
message: l10n.pleaseWaitUntilInvited,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
@ -73,6 +75,7 @@ class PublicRoomDialog extends StatelessWidget {
|
|||
bool _testRoom(PublishedRoomsChunk r) => r.canonicalAlias == roomAlias;
|
||||
|
||||
Future<PublishedRoomsChunk> _search(BuildContext context) async {
|
||||
final l10n = L10n.of(context);
|
||||
final chunk = this.chunk;
|
||||
if (chunk != null) return chunk;
|
||||
final query = await Matrix.of(context).client.queryPublicRooms(
|
||||
|
|
@ -80,7 +83,7 @@ class PublicRoomDialog extends StatelessWidget {
|
|||
filter: PublicRoomQueryFilter(genericSearchTerm: roomAlias),
|
||||
);
|
||||
if (!query.chunk.any(_testRoom)) {
|
||||
throw (L10n.of(context).noRoomsFound);
|
||||
throw (l10n.noRoomsFound);
|
||||
}
|
||||
return query.chunk.firstWhere(_testRoom);
|
||||
}
|
||||
|
|
@ -248,6 +251,7 @@ class PublicRoomDialog extends StatelessWidget {
|
|||
hintText: L10n.of(context).reason,
|
||||
);
|
||||
if (reason == null || reason.isEmpty) return;
|
||||
if (!context.mounted) return;
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context).client.reportRoom(
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ class UserDialog extends StatelessWidget {
|
|||
hintText: L10n.of(context).reason,
|
||||
);
|
||||
if (reason == null || reason.isEmpty) return;
|
||||
if (!context.mounted) return;
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue