refactor: Implement own adaptive dialogs and remove package

This commit is contained in:
krille-chan 2024-12-10 18:47:58 +01:00
commit 8819c40ebd
No known key found for this signature in database
42 changed files with 597 additions and 439 deletions

View file

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:collection/collection.dart' show IterableExtension;
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/encryption/utils/key_verification.dart';
@ -8,6 +7,8 @@ import 'package:matrix/matrix.dart';
import 'package:fluffychat/pages/device_settings/device_settings_view.dart';
import 'package:fluffychat/pages/key_verification/key_verification_dialog.dart';
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
import 'package:fluffychat/widgets/future_loading_dialog.dart';
import '../../widgets/matrix.dart';
@ -54,9 +55,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
if (await showOkCancelAlertDialog(
context: context,
title: L10n.of(context).areYouSure,
okLabel: L10n.of(context).yes,
okLabel: L10n.of(context).remove,
cancelLabel: L10n.of(context).cancel,
message: L10n.of(context).removeDevicesDescription,
isDestructive: true,
) ==
OkCancelResult.cancel) return;
final matrix = Matrix.of(context);
@ -84,18 +86,14 @@ class DevicesSettingsController extends State<DevicesSettings> {
title: L10n.of(context).changeDeviceName,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
textFields: [
DialogTextField(
hintText: device.displayName,
),
],
hintText: device.displayName,
);
if (displayName == null) return;
final success = await showFutureLoadingDialog(
context: context,
future: () => Matrix.of(context)
.client
.updateDevice(device.deviceId, displayName: displayName.single),
.updateDevice(device.deviceId, displayName: displayName),
);
if (success.error == null) {
reload();
@ -109,7 +107,6 @@ class DevicesSettingsController extends State<DevicesSettings> {
message: L10n.of(context).verifyOtherDeviceDescription,
okLabel: L10n.of(context).ok,
cancelLabel: L10n.of(context).cancel,
fullyCapitalizedForMaterial: false,
);
if (consent != OkCancelResult.ok) return;
final req = await Matrix.of(context)