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
|
|
@ -160,6 +160,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
|||
}
|
||||
|
||||
Future<void> updateRoomAction() async {
|
||||
final l10n = L10n.of(context);
|
||||
final roomVersion = room
|
||||
.getState(EventTypes.RoomCreate)!
|
||||
.content
|
||||
|
|
@ -170,10 +171,11 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
|||
);
|
||||
final capabilities = capabilitiesResult.result;
|
||||
if (capabilities == null) return;
|
||||
if (!mounted) return;
|
||||
final newVersion = await showModalActionPopup<String>(
|
||||
context: context,
|
||||
title: L10n.of(context).replaceRoomWithNewerVersion,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
title: l10n.replaceRoomWithNewerVersion,
|
||||
cancelLabel: l10n.cancel,
|
||||
actions: capabilities.mRoomVersions!.available.entries
|
||||
.where((r) => r.key != roomVersion)
|
||||
.map(
|
||||
|
|
@ -185,18 +187,20 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
|||
)
|
||||
.toList(),
|
||||
);
|
||||
if (newVersion == null ||
|
||||
OkCancelResult.cancel ==
|
||||
await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).cancel,
|
||||
title: L10n.of(context).areYouSure,
|
||||
message: L10n.of(context).roomUpgradeDescription,
|
||||
isDestructive: true,
|
||||
)) {
|
||||
if (newVersion == null) return;
|
||||
if (!mounted) return;
|
||||
final confirmUpgrade = await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
okLabel: l10n.yes,
|
||||
cancelLabel: l10n.cancel,
|
||||
title: l10n.areYouSure,
|
||||
message: l10n.roomUpgradeDescription,
|
||||
isDestructive: true,
|
||||
);
|
||||
if (confirmUpgrade == OkCancelResult.cancel) {
|
||||
return;
|
||||
}
|
||||
if (!mounted) return;
|
||||
final result = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
futureWithProgress: (onProgress) async {
|
||||
|
|
@ -243,6 +247,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
|||
}
|
||||
|
||||
Future<void> addAlias() async {
|
||||
final l10n = L10n.of(context);
|
||||
final domain = room.client.userID?.domain;
|
||||
if (domain == null) {
|
||||
throw Exception('userID or domain is null! This should never happen.');
|
||||
|
|
@ -250,11 +255,12 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
|||
|
||||
final input = await showTextInputDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).editRoomAliases,
|
||||
title: l10n.editRoomAliases,
|
||||
prefixText: '#',
|
||||
suffixText: domain,
|
||||
hintText: L10n.of(context).alias,
|
||||
hintText: l10n.alias,
|
||||
);
|
||||
if (!mounted) return;
|
||||
final aliasLocalpart = input?.trim();
|
||||
if (aliasLocalpart == null || aliasLocalpart.isEmpty) return;
|
||||
final alias = '#$aliasLocalpart:$domain';
|
||||
|
|
@ -264,17 +270,19 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
|||
future: () => room.client.setRoomAlias(alias, room.id),
|
||||
);
|
||||
if (result.error != null) return;
|
||||
if (!mounted) return;
|
||||
setState(() {});
|
||||
|
||||
if (!room.canChangeStateEvent(EventTypes.RoomCanonicalAlias)) return;
|
||||
|
||||
final canonicalAliasConsent = await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).setAsCanonicalAlias,
|
||||
title: l10n.setAsCanonicalAlias,
|
||||
message: alias,
|
||||
okLabel: L10n.of(context).yes,
|
||||
cancelLabel: L10n.of(context).no,
|
||||
okLabel: l10n.yes,
|
||||
cancelLabel: l10n.no,
|
||||
);
|
||||
if (!mounted) return;
|
||||
|
||||
final altAliases =
|
||||
room
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue