refactor: Implement own adaptive dialogs and remove package
This commit is contained in:
parent
dea29161c8
commit
8819c40ebd
42 changed files with 597 additions and 439 deletions
|
|
@ -123,11 +123,6 @@ abstract class FluffyThemes {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
dialogTheme: DialogTheme(
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
snackBarTheme: const SnackBarThemeData(
|
snackBarTheme: const SnackBarThemeData(
|
||||||
behavior: SnackBarBehavior.floating,
|
behavior: SnackBarBehavior.floating,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/archive/archive_view.dart';
|
import 'package:fluffychat/pages/archive/archive_view.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:matrix/encryption.dart';
|
import 'package:matrix/encryption.dart';
|
||||||
|
|
@ -11,6 +10,7 @@ import 'package:fluffychat/utils/error_reporter.dart';
|
||||||
import 'package:fluffychat/utils/fluffy_share.dart';
|
import 'package:fluffychat/utils/fluffy_share.dart';
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import '../../utils/adaptive_bottom_sheet.dart';
|
import '../../utils/adaptive_bottom_sheet.dart';
|
||||||
import '../key_verification/key_verification_dialog.dart';
|
import '../key_verification/key_verification_dialog.dart';
|
||||||
|
|
@ -366,7 +366,6 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
||||||
.verifyOtherDeviceDescription,
|
.verifyOtherDeviceDescription,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
fullyCapitalizedForMaterial: false,
|
|
||||||
);
|
);
|
||||||
if (consent != OkCancelResult.ok) return;
|
if (consent != OkCancelResult.ok) return;
|
||||||
final req = await showFutureLoadingDialog(
|
final req = await showFutureLoadingDialog(
|
||||||
|
|
@ -404,7 +403,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
||||||
message: L10n.of(context).wipeChatBackup,
|
message: L10n.of(context).wipeChatBackup,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
)) {
|
)) {
|
||||||
setState(() => _createBootstrap(true));
|
setState(() => _createBootstrap(true));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:desktop_drop/desktop_drop.dart';
|
import 'package:desktop_drop/desktop_drop.dart';
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
|
@ -33,6 +32,9 @@ import 'package:fluffychat/utils/matrix_sdk_extensions/filtered_timeline_extensi
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/utils/show_scaffold_dialog.dart';
|
import 'package:fluffychat/utils/show_scaffold_dialog.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.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 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/share_scaffold_dialog.dart';
|
import 'package:fluffychat/widgets/share_scaffold_dialog.dart';
|
||||||
|
|
@ -691,23 +693,22 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
|
|
||||||
void reportEventAction() async {
|
void reportEventAction() async {
|
||||||
final event = selectedEvents.single;
|
final event = selectedEvents.single;
|
||||||
final score = await showConfirmationDialog<int>(
|
final score = await showModalActionPopup<int>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).reportMessage,
|
title: L10n.of(context).reportMessage,
|
||||||
message: L10n.of(context).howOffensiveIsThisContent,
|
message: L10n.of(context).howOffensiveIsThisContent,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
okLabel: L10n.of(context).ok,
|
|
||||||
actions: [
|
actions: [
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: -100,
|
value: -100,
|
||||||
label: L10n.of(context).extremeOffensive,
|
label: L10n.of(context).extremeOffensive,
|
||||||
),
|
),
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: -50,
|
value: -50,
|
||||||
label: L10n.of(context).offensive,
|
label: L10n.of(context).offensive,
|
||||||
),
|
),
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: 0,
|
value: 0,
|
||||||
label: L10n.of(context).inoffensive,
|
label: L10n.of(context).inoffensive,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -718,15 +719,15 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
title: L10n.of(context).whyDoYouWantToReportThis,
|
title: L10n.of(context).whyDoYouWantToReportThis,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [DialogTextField(hintText: L10n.of(context).reason)],
|
hintText: L10n.of(context).reason,
|
||||||
);
|
);
|
||||||
if (reason == null || reason.single.isEmpty) return;
|
if (reason == null || reason.isEmpty) return;
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Matrix.of(context).client.reportContent(
|
future: () => Matrix.of(context).client.reportContent(
|
||||||
event.roomId!,
|
event.roomId!,
|
||||||
event.eventId,
|
event.eventId,
|
||||||
reason: reason.single,
|
reason: reason,
|
||||||
score: score,
|
score: score,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
@ -765,18 +766,14 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).redactMessage,
|
title: L10n.of(context).redactMessage,
|
||||||
message: L10n.of(context).redactMessageDescription,
|
message: L10n.of(context).redactMessageDescription,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
textFields: [
|
hintText: L10n.of(context).optionalRedactReason,
|
||||||
DialogTextField(
|
|
||||||
hintText: L10n.of(context).optionalRedactReason,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
okLabel: L10n.of(context).remove,
|
okLabel: L10n.of(context).remove,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
)
|
)
|
||||||
: <String>[];
|
: null;
|
||||||
if (reasonInput == null) return;
|
if (reasonInput == null) return;
|
||||||
final reason = reasonInput.single.isEmpty ? null : reasonInput.single;
|
final reason = reasonInput.isEmpty ? null : reasonInput;
|
||||||
for (final event in selectedEvents) {
|
for (final event in selectedEvents) {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -1243,21 +1240,21 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
final callType = await showModalActionSheet<CallType>(
|
final callType = await showModalActionPopup<CallType>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).warning,
|
title: L10n.of(context).warning,
|
||||||
message: L10n.of(context).videoCallsBetaWarning,
|
message: L10n.of(context).videoCallsBetaWarning,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
actions: [
|
actions: [
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
label: L10n.of(context).voiceCall,
|
label: L10n.of(context).voiceCall,
|
||||||
icon: Icons.phone_outlined,
|
icon: const Icon(Icons.phone_outlined),
|
||||||
key: CallType.kVoice,
|
value: CallType.kVoice,
|
||||||
),
|
),
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
label: L10n.of(context).videoCall,
|
label: L10n.of(context).videoCall,
|
||||||
icon: Icons.video_call_outlined,
|
icon: const Icon(Icons.video_call_outlined),
|
||||||
key: CallType.kVideo,
|
value: CallType.kVideo,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/chat/chat.dart';
|
import 'package:fluffychat/pages/chat/chat.dart';
|
||||||
import 'package:fluffychat/pages/chat/chat_app_bar_list_tile.dart';
|
import 'package:fluffychat/pages/chat/chat_app_bar_list_tile.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
|
|
||||||
class PinnedEvents extends StatelessWidget {
|
class PinnedEvents extends StatelessWidget {
|
||||||
|
|
@ -30,13 +30,15 @@ class PinnedEvents extends StatelessWidget {
|
||||||
|
|
||||||
final eventId = events.length == 1
|
final eventId = events.length == 1
|
||||||
? events.single?.eventId
|
? events.single?.eventId
|
||||||
: await showConfirmationDialog<String>(
|
: await showModalActionPopup<String>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).pinMessage,
|
title: L10n.of(context).pin,
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
actions: events
|
actions: events
|
||||||
.map(
|
.map(
|
||||||
(event) => AlertDialogAction(
|
(event) => AdaptiveModalAction(
|
||||||
key: event?.eventId ?? '',
|
value: event?.eventId ?? '',
|
||||||
|
icon: const Icon(Icons.push_pin_outlined),
|
||||||
label: event?.calcLocalizedBodyFallback(
|
label: event?.calcLocalizedBodyFallback(
|
||||||
MatrixLocals(L10n.of(context)),
|
MatrixLocals(L10n.of(context)),
|
||||||
withSenderNamePrefix: true,
|
withSenderNamePrefix: true,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/utils/size_string.dart';
|
import 'package:fluffychat/utils/size_string.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialog_action.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
import '../../utils/resize_video.dart';
|
import '../../utils/resize_video.dart';
|
||||||
|
|
||||||
class SendFileDialog extends StatefulWidget {
|
class SendFileDialog extends StatefulWidget {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/chat/events/map_bubble.dart';
|
import 'package:fluffychat/pages/chat/events/map_bubble.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialog_action.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
|
|
||||||
class SendLocationDialog extends StatefulWidget {
|
class SendLocationDialog extends StatefulWidget {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
import 'package:flutter/material.dart' hide Visibility;
|
import 'package:flutter/material.dart' hide Visibility;
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/chat_access_settings/chat_access_settings_page.dart';
|
import 'package:fluffychat/pages/chat_access_settings/chat_access_settings_page.dart';
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.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 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
||||||
|
|
@ -149,14 +151,15 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
);
|
);
|
||||||
final capabilities = capabilitiesResult.result;
|
final capabilities = capabilitiesResult.result;
|
||||||
if (capabilities == null) return;
|
if (capabilities == null) return;
|
||||||
final newVersion = await showConfirmationDialog<String>(
|
final newVersion = await showModalActionPopup<String>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).replaceRoomWithNewerVersion,
|
title: L10n.of(context).replaceRoomWithNewerVersion,
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
actions: capabilities.mRoomVersions!.available.entries
|
actions: capabilities.mRoomVersions!.available.entries
|
||||||
.where((r) => r.key != roomVersion)
|
.where((r) => r.key != roomVersion)
|
||||||
.map(
|
.map(
|
||||||
(version) => AlertDialogAction(
|
(version) => AdaptiveModalAction(
|
||||||
key: version.key,
|
value: version.key,
|
||||||
label:
|
label:
|
||||||
'${version.key} (${version.value.toString().split('.').last})',
|
'${version.key} (${version.value.toString().split('.').last})',
|
||||||
),
|
),
|
||||||
|
|
@ -172,7 +175,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
title: L10n.of(context).areYouSure,
|
title: L10n.of(context).areYouSure,
|
||||||
message: L10n.of(context).roomUpgradeDescription,
|
message: L10n.of(context).roomUpgradeDescription,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
)) {
|
)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -191,15 +194,11 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).editRoomAliases,
|
title: L10n.of(context).editRoomAliases,
|
||||||
textFields: [
|
prefixText: '#',
|
||||||
DialogTextField(
|
suffixText: domain,
|
||||||
prefixText: '#',
|
hintText: L10n.of(context).alias,
|
||||||
suffixText: domain,
|
|
||||||
hintText: L10n.of(context).alias,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
final aliasLocalpart = input?.singleOrNull?.trim();
|
final aliasLocalpart = input?.trim();
|
||||||
if (aliasLocalpart == null || aliasLocalpart.isEmpty) return;
|
if (aliasLocalpart == null || aliasLocalpart.isEmpty) return;
|
||||||
final alias = '#$aliasLocalpart:$domain';
|
final alias = '#$aliasLocalpart:$domain';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
@ -12,6 +11,8 @@ import 'package:fluffychat/pages/settings/settings.dart';
|
||||||
import 'package:fluffychat/utils/file_selector.dart';
|
import 'package:fluffychat/utils/file_selector.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
||||||
|
|
@ -46,20 +47,16 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
title: L10n.of(context).changeTheNameOfTheGroup,
|
title: L10n.of(context).changeTheNameOfTheGroup,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [
|
initialText: room.getLocalizedDisplayname(
|
||||||
DialogTextField(
|
MatrixLocals(
|
||||||
initialText: room.getLocalizedDisplayname(
|
L10n.of(context),
|
||||||
MatrixLocals(
|
|
||||||
L10n.of(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
if (input == null) return;
|
if (input == null) return;
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => room.setName(input.single),
|
future: () => room.setName(input),
|
||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
|
@ -75,19 +72,15 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
title: L10n.of(context).setChatDescription,
|
title: L10n.of(context).setChatDescription,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [
|
hintText: L10n.of(context).noChatDescriptionYet,
|
||||||
DialogTextField(
|
initialText: room.topic,
|
||||||
hintText: L10n.of(context).noChatDescriptionYet,
|
minLines: 4,
|
||||||
initialText: room.topic,
|
maxLines: 8,
|
||||||
minLines: 4,
|
|
||||||
maxLines: 8,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (input == null) return;
|
if (input == null) return;
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => room.setDescription(input.single),
|
future: () => room.setDescription(input),
|
||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
|
@ -116,30 +109,31 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!);
|
final room = Matrix.of(context).client.getRoomById(roomId!);
|
||||||
final actions = [
|
final actions = [
|
||||||
if (PlatformInfos.isMobile)
|
if (PlatformInfos.isMobile)
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: AvatarAction.camera,
|
value: AvatarAction.camera,
|
||||||
label: L10n.of(context).openCamera,
|
label: L10n.of(context).openCamera,
|
||||||
isDefaultAction: true,
|
isDefaultAction: true,
|
||||||
icon: Icons.camera_alt_outlined,
|
icon: const Icon(Icons.camera_alt_outlined),
|
||||||
),
|
),
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: AvatarAction.file,
|
value: AvatarAction.file,
|
||||||
label: L10n.of(context).openGallery,
|
label: L10n.of(context).openGallery,
|
||||||
icon: Icons.photo_outlined,
|
icon: const Icon(Icons.photo_outlined),
|
||||||
),
|
),
|
||||||
if (room?.avatar != null)
|
if (room?.avatar != null)
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: AvatarAction.remove,
|
value: AvatarAction.remove,
|
||||||
label: L10n.of(context).delete,
|
label: L10n.of(context).delete,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
icon: Icons.delete_outlined,
|
icon: const Icon(Icons.delete_outlined),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
final action = actions.length == 1
|
final action = actions.length == 1
|
||||||
? actions.single.key
|
? actions.single.value
|
||||||
: await showModalActionSheet<AvatarAction>(
|
: await showModalActionPopup<AvatarAction>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).editRoomAvatar,
|
title: L10n.of(context).editRoomAvatar,
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
);
|
);
|
||||||
if (action == null) return;
|
if (action == null) return;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:matrix/encryption.dart';
|
import 'package:matrix/encryption.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings_view.dart';
|
import 'package:fluffychat/pages/chat_encryption_settings/chat_encryption_settings_view.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../key_verification/key_verification_dialog.dart';
|
import '../key_verification/key_verification_dialog.dart';
|
||||||
|
|
@ -76,7 +76,6 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
|
||||||
message: L10n.of(context).verifyOtherUserDescription,
|
message: L10n.of(context).verifyOtherUserDescription,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
fullyCapitalizedForMaterial: false,
|
|
||||||
);
|
);
|
||||||
if (consent != OkCancelResult.ok) return;
|
if (consent != OkCancelResult.ok) return;
|
||||||
final req = await room.client.userDeviceKeys[room.directChatMatrixID]!
|
final req = await room.client.userDeviceKeys[room.directChatMatrixID]!
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:cross_file/cross_file.dart';
|
import 'package:cross_file/cross_file.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:flutter_shortcuts/flutter_shortcuts.dart';
|
import 'package:flutter_shortcuts/flutter_shortcuts.dart';
|
||||||
|
|
@ -21,6 +20,9 @@ import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/utils/show_scaffold_dialog.dart';
|
import 'package:fluffychat/utils/show_scaffold_dialog.dart';
|
||||||
import 'package:fluffychat/utils/show_update_snackbar.dart';
|
import 'package:fluffychat/utils/show_update_snackbar.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.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/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/share_scaffold_dialog.dart';
|
import 'package:fluffychat/widgets/share_scaffold_dialog.dart';
|
||||||
|
|
@ -188,23 +190,19 @@ class ChatListController extends State<ChatList>
|
||||||
context: context,
|
context: context,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [
|
prefixText: 'https://',
|
||||||
DialogTextField(
|
hintText: Matrix.of(context).client.homeserver?.host,
|
||||||
prefixText: 'https://',
|
initialText: searchServer,
|
||||||
hintText: Matrix.of(context).client.homeserver?.host,
|
keyboardType: TextInputType.url,
|
||||||
initialText: searchServer,
|
autocorrect: false,
|
||||||
keyboardType: TextInputType.url,
|
validator: (server) => server.contains('.') == true
|
||||||
autocorrect: false,
|
? null
|
||||||
validator: (server) => server?.contains('.') == true
|
: L10n.of(context).invalidServerName,
|
||||||
? null
|
|
||||||
: L10n.of(context).invalidServerName,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (newServer == null) return;
|
if (newServer == null) return;
|
||||||
Matrix.of(context).store.setString(_serverStoreNamespace, newServer.single);
|
Matrix.of(context).store.setString(_serverStoreNamespace, newServer);
|
||||||
setState(() {
|
setState(() {
|
||||||
searchServer = newServer.single;
|
searchServer = newServer;
|
||||||
});
|
});
|
||||||
_coolDown?.cancel();
|
_coolDown?.cancel();
|
||||||
_coolDown = Timer(const Duration(milliseconds: 500), _search);
|
_coolDown = Timer(const Duration(milliseconds: 500), _search);
|
||||||
|
|
@ -668,7 +666,7 @@ class ChatListController extends State<ChatList>
|
||||||
message: L10n.of(context).archiveRoomDescription,
|
message: L10n.of(context).archiveRoomDescription,
|
||||||
okLabel: L10n.of(context).leave,
|
okLabel: L10n.of(context).leave,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
);
|
);
|
||||||
if (confirmed == OkCancelResult.cancel) return;
|
if (confirmed == OkCancelResult.cancel) return;
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
|
@ -677,13 +675,13 @@ class ChatListController extends State<ChatList>
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case ChatContextAction.addToSpace:
|
case ChatContextAction.addToSpace:
|
||||||
final space = await showConfirmationDialog(
|
final space = await showModalActionPopup(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).space,
|
title: L10n.of(context).space,
|
||||||
actions: spacesWithPowerLevels
|
actions: spacesWithPowerLevels
|
||||||
.map(
|
.map(
|
||||||
(space) => AlertDialogAction(
|
(space) => AdaptiveModalAction(
|
||||||
key: space,
|
value: space,
|
||||||
label: space
|
label: space
|
||||||
.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
|
.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
|
||||||
),
|
),
|
||||||
|
|
@ -724,15 +722,11 @@ class ChatListController extends State<ChatList>
|
||||||
message: L10n.of(context).leaveEmptyToClearStatus,
|
message: L10n.of(context).leaveEmptyToClearStatus,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [
|
hintText: L10n.of(context).statusExampleMessage,
|
||||||
DialogTextField(
|
maxLines: 6,
|
||||||
hintText: L10n.of(context).statusExampleMessage,
|
minLines: 1,
|
||||||
maxLines: 6,
|
maxLength: 255,
|
||||||
minLines: 1,
|
initialText: currentPresence.statusMsg,
|
||||||
maxLength: 255,
|
|
||||||
initialText: currentPresence.statusMsg,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (input == null) return;
|
if (input == null) return;
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
|
@ -741,7 +735,7 @@ class ChatListController extends State<ChatList>
|
||||||
future: () => client.setPresence(
|
future: () => client.setPresence(
|
||||||
client.userID!,
|
client.userID!,
|
||||||
PresenceType.online,
|
PresenceType.online,
|
||||||
statusMsg: input.single,
|
statusMsg: input,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -834,17 +828,18 @@ class ChatListController extends State<ChatList>
|
||||||
final client = Matrix.of(context)
|
final client = Matrix.of(context)
|
||||||
.widget
|
.widget
|
||||||
.clients[Matrix.of(context).getClientIndexByMatrixId(userId!)];
|
.clients[Matrix.of(context).getClientIndexByMatrixId(userId!)];
|
||||||
final action = await showConfirmationDialog<EditBundleAction>(
|
final action = await showModalActionPopup<EditBundleAction>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).editBundlesForAccount,
|
title: L10n.of(context).editBundlesForAccount,
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
actions: [
|
actions: [
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: EditBundleAction.addToBundle,
|
value: EditBundleAction.addToBundle,
|
||||||
label: L10n.of(context).addToBundle,
|
label: L10n.of(context).addToBundle,
|
||||||
),
|
),
|
||||||
if (activeBundle != client.userID)
|
if (activeBundle != client.userID)
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: EditBundleAction.removeFromBundle,
|
value: EditBundleAction.removeFromBundle,
|
||||||
label: L10n.of(context).removeFromBundle,
|
label: L10n.of(context).removeFromBundle,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -855,12 +850,12 @@ class ChatListController extends State<ChatList>
|
||||||
final bundle = await showTextInputDialog(
|
final bundle = await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: l10n.bundleName,
|
title: l10n.bundleName,
|
||||||
textFields: [DialogTextField(hintText: l10n.bundleName)],
|
hintText: l10n.bundleName,
|
||||||
);
|
);
|
||||||
if (bundle == null || bundle.isEmpty || bundle.single.isEmpty) return;
|
if (bundle == null || bundle.isEmpty || bundle.isEmpty) return;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => client.setAccountBundle(bundle.single),
|
future: () => client.setAccountBundle(bundle),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EditBundleAction.removeFromBundle:
|
case EditBundleAction.removeFromBundle:
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
import 'package:fluffychat/utils/room_status_extension.dart';
|
import 'package:fluffychat/utils/room_status_extension.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/hover_builder.dart';
|
import 'package:fluffychat/widgets/hover_builder.dart';
|
||||||
import '../../config/themes.dart';
|
import '../../config/themes.dart';
|
||||||
|
|
@ -51,7 +51,7 @@ class ChatListItem extends StatelessWidget {
|
||||||
okLabel: L10n.of(context).leave,
|
okLabel: L10n.of(context).leave,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
message: L10n.of(context).archiveRoomDescription,
|
message: L10n.of(context).archiveRoomDescription,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
);
|
);
|
||||||
if (confirmed != OkCancelResult.ok) return false;
|
if (confirmed != OkCancelResult.ok) return false;
|
||||||
final leaveResult = await showFutureLoadingDialog(
|
final leaveResult = await showFutureLoadingDialog(
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../utils/fluffy_share.dart';
|
import '../../utils/fluffy_share.dart';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
@ -13,6 +12,9 @@ import 'package:fluffychat/pages/chat_list/search_title.dart';
|
||||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/utils/stream_extension.dart';
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.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/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
@ -136,7 +138,7 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
message: L10n.of(context).archiveRoomDescription,
|
message: L10n.of(context).archiveRoomDescription,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
);
|
);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
if (confirmed != OkCancelResult.ok) return;
|
if (confirmed != OkCancelResult.ok) return;
|
||||||
|
|
@ -152,16 +154,16 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addChatOrSubspace() async {
|
void _addChatOrSubspace() async {
|
||||||
final roomType = await showConfirmationDialog(
|
final roomType = await showModalActionPopup(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).addChatOrSubSpace,
|
title: L10n.of(context).addChatOrSubSpace,
|
||||||
actions: [
|
actions: [
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: AddRoomType.subspace,
|
value: AddRoomType.subspace,
|
||||||
label: L10n.of(context).createNewSpace,
|
label: L10n.of(context).createNewSpace,
|
||||||
),
|
),
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: AddRoomType.chat,
|
value: AddRoomType.chat,
|
||||||
label: L10n.of(context).createGroup,
|
label: L10n.of(context).createGroup,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -173,28 +175,18 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
title: roomType == AddRoomType.subspace
|
title: roomType == AddRoomType.subspace
|
||||||
? L10n.of(context).createNewSpace
|
? L10n.of(context).createNewSpace
|
||||||
: L10n.of(context).createGroup,
|
: L10n.of(context).createGroup,
|
||||||
textFields: [
|
hintText: roomType == AddRoomType.subspace
|
||||||
DialogTextField(
|
? L10n.of(context).spaceName
|
||||||
hintText: roomType == AddRoomType.subspace
|
: L10n.of(context).groupName,
|
||||||
? L10n.of(context).spaceName
|
minLines: 1,
|
||||||
: L10n.of(context).groupName,
|
maxLines: 1,
|
||||||
minLines: 1,
|
maxLength: 64,
|
||||||
maxLines: 1,
|
validator: (text) {
|
||||||
maxLength: 64,
|
if (text.isEmpty) {
|
||||||
validator: (text) {
|
return L10n.of(context).pleaseChoose;
|
||||||
if (text == null || text.isEmpty) {
|
}
|
||||||
return L10n.of(context).pleaseChoose;
|
return null;
|
||||||
}
|
},
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
DialogTextField(
|
|
||||||
hintText: L10n.of(context).chatDescription,
|
|
||||||
minLines: 4,
|
|
||||||
maxLines: 8,
|
|
||||||
maxLength: 255,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
okLabel: L10n.of(context).create,
|
okLabel: L10n.of(context).create,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
);
|
);
|
||||||
|
|
@ -209,29 +201,20 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
|
|
||||||
if (roomType == AddRoomType.subspace) {
|
if (roomType == AddRoomType.subspace) {
|
||||||
roomId = await client.createSpace(
|
roomId = await client.createSpace(
|
||||||
name: names.first,
|
name: names,
|
||||||
topic: names.last.isEmpty ? null : names.last,
|
|
||||||
visibility: activeSpace.joinRules == JoinRules.public
|
visibility: activeSpace.joinRules == JoinRules.public
|
||||||
? sdk.Visibility.public
|
? sdk.Visibility.public
|
||||||
: sdk.Visibility.private,
|
: sdk.Visibility.private,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
roomId = await client.createGroupChat(
|
roomId = await client.createGroupChat(
|
||||||
groupName: names.first,
|
groupName: names,
|
||||||
preset: activeSpace.joinRules == JoinRules.public
|
preset: activeSpace.joinRules == JoinRules.public
|
||||||
? CreateRoomPreset.publicChat
|
? CreateRoomPreset.publicChat
|
||||||
: CreateRoomPreset.privateChat,
|
: CreateRoomPreset.privateChat,
|
||||||
visibility: activeSpace.joinRules == JoinRules.public
|
visibility: activeSpace.joinRules == JoinRules.public
|
||||||
? sdk.Visibility.public
|
? sdk.Visibility.public
|
||||||
: sdk.Visibility.private,
|
: sdk.Visibility.private,
|
||||||
initialState: names.length > 1 && names.last.isNotEmpty
|
|
||||||
? [
|
|
||||||
StateEvent(
|
|
||||||
type: EventTypes.RoomTopic,
|
|
||||||
content: {'topic': names.last},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
: null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await activeSpace.setSpaceChild(roomId);
|
await activeSpace.setSpaceChild(roomId);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart' show IterableExtension;
|
import 'package:collection/collection.dart' show IterableExtension;
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/encryption/utils/key_verification.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/device_settings/device_settings_view.dart';
|
||||||
import 'package:fluffychat/pages/key_verification/key_verification_dialog.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 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
|
|
||||||
|
|
@ -54,9 +55,10 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).areYouSure,
|
title: L10n.of(context).areYouSure,
|
||||||
okLabel: L10n.of(context).yes,
|
okLabel: L10n.of(context).remove,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
message: L10n.of(context).removeDevicesDescription,
|
message: L10n.of(context).removeDevicesDescription,
|
||||||
|
isDestructive: true,
|
||||||
) ==
|
) ==
|
||||||
OkCancelResult.cancel) return;
|
OkCancelResult.cancel) return;
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
|
|
@ -84,18 +86,14 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
title: L10n.of(context).changeDeviceName,
|
title: L10n.of(context).changeDeviceName,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [
|
hintText: device.displayName,
|
||||||
DialogTextField(
|
|
||||||
hintText: device.displayName,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (displayName == null) return;
|
if (displayName == null) return;
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Matrix.of(context)
|
future: () => Matrix.of(context)
|
||||||
.client
|
.client
|
||||||
.updateDevice(device.deviceId, displayName: displayName.single),
|
.updateDevice(device.deviceId, displayName: displayName),
|
||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
reload();
|
reload();
|
||||||
|
|
@ -109,7 +107,6 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
message: L10n.of(context).verifyOtherDeviceDescription,
|
message: L10n.of(context).verifyOtherDeviceDescription,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
fullyCapitalizedForMaterial: false,
|
|
||||||
);
|
);
|
||||||
if (consent != OkCancelResult.ok) return;
|
if (consent != OkCancelResult.ok) return;
|
||||||
final req = await Matrix.of(context)
|
final req = await Matrix.of(context)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||||
import '../../utils/date_time_extension.dart';
|
import '../../utils/date_time_extension.dart';
|
||||||
import '../../utils/matrix_sdk_extensions/device_extension.dart';
|
import '../../utils/matrix_sdk_extensions/device_extension.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
|
|
@ -49,37 +49,43 @@ class UserDeviceListItem extends StatelessWidget {
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final action = await showModalActionSheet<UserDeviceListItemAction>(
|
final action = await showModalActionPopup<UserDeviceListItemAction>(
|
||||||
context: context,
|
context: context,
|
||||||
title: '${userDevice.displayName} (${userDevice.deviceId})',
|
title: '${userDevice.displayName} (${userDevice.deviceId})',
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
actions: [
|
actions: [
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: UserDeviceListItemAction.rename,
|
value: UserDeviceListItemAction.rename,
|
||||||
|
icon: const Icon(Icons.edit_outlined),
|
||||||
label: L10n.of(context).changeDeviceName,
|
label: L10n.of(context).changeDeviceName,
|
||||||
),
|
),
|
||||||
if (!isOwnDevice && keys != null) ...{
|
if (!isOwnDevice && keys != null) ...{
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: UserDeviceListItemAction.verify,
|
value: UserDeviceListItemAction.verify,
|
||||||
|
icon: const Icon(Icons.verified_outlined),
|
||||||
label: L10n.of(context).verifyStart,
|
label: L10n.of(context).verifyStart,
|
||||||
),
|
),
|
||||||
if (!keys.blocked)
|
if (!keys.blocked)
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: UserDeviceListItemAction.block,
|
value: UserDeviceListItemAction.block,
|
||||||
|
icon: const Icon(Icons.block_outlined),
|
||||||
label: L10n.of(context).blockDevice,
|
label: L10n.of(context).blockDevice,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
),
|
),
|
||||||
if (keys.blocked)
|
if (keys.blocked)
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: UserDeviceListItemAction.unblock,
|
value: UserDeviceListItemAction.unblock,
|
||||||
|
icon: const Icon(Icons.block),
|
||||||
label: L10n.of(context).unblockDevice,
|
label: L10n.of(context).unblockDevice,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
if (!isOwnDevice)
|
if (!isOwnDevice)
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: UserDeviceListItemAction.remove,
|
value: UserDeviceListItemAction.remove,
|
||||||
|
icon: const Icon(Icons.delete_outlined),
|
||||||
label: L10n.of(context).delete,
|
label: L10n.of(context).delete,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import 'dart:async';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart';
|
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart';
|
||||||
|
|
@ -17,6 +16,7 @@ import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/pages/homeserver_picker/homeserver_picker_view.dart';
|
import 'package:fluffychat/pages/homeserver_picker/homeserver_picker_view.dart';
|
||||||
import 'package:fluffychat/utils/file_selector.dart';
|
import 'package:fluffychat/utils/file_selector.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../utils/localized_exception_extension.dart';
|
import '../../utils/localized_exception_extension.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialog_action.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
|
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../config/themes.dart';
|
import '../../config/themes.dart';
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ import 'dart:ui';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/encryption.dart';
|
import 'package:matrix/encryption.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/widgets/adaptive_dialog_action.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context).incorrectPassphraseOrKey,
|
title: L10n.of(context).incorrectPassphraseOrKey,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,12 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.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 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../utils/platform_infos.dart';
|
import '../../utils/platform_infos.dart';
|
||||||
|
|
@ -128,7 +129,7 @@ class LoginController extends State<Login> {
|
||||||
final dialogResult = await showOkCancelAlertDialog(
|
final dialogResult = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
message: L10n.of(context).noMatrixServer(newDomain, oldHomeserver!),
|
title: L10n.of(context).noMatrixServer(newDomain, oldHomeserver!),
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
);
|
);
|
||||||
|
|
@ -162,15 +163,10 @@ class LoginController extends State<Login> {
|
||||||
message: L10n.of(context).enterAnEmailAddress,
|
message: L10n.of(context).enterAnEmailAddress,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
fullyCapitalizedForMaterial: false,
|
initialText:
|
||||||
textFields: [
|
usernameController.text.isEmail ? usernameController.text : '',
|
||||||
DialogTextField(
|
hintText: L10n.of(context).enterAnEmailAddress,
|
||||||
initialText:
|
keyboardType: TextInputType.emailAddress,
|
||||||
usernameController.text.isEmail ? usernameController.text : '',
|
|
||||||
hintText: L10n.of(context).enterAnEmailAddress,
|
|
||||||
keyboardType: TextInputType.emailAddress,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (input == null) return;
|
if (input == null) return;
|
||||||
final clientSecret = DateTime.now().millisecondsSinceEpoch.toString();
|
final clientSecret = DateTime.now().millisecondsSinceEpoch.toString();
|
||||||
|
|
@ -179,7 +175,7 @@ class LoginController extends State<Login> {
|
||||||
future: () =>
|
future: () =>
|
||||||
Matrix.of(context).getLoginClient().requestTokenToResetPasswordEmail(
|
Matrix.of(context).getLoginClient().requestTokenToResetPasswordEmail(
|
||||||
clientSecret,
|
clientSecret,
|
||||||
input.single,
|
input,
|
||||||
sendAttempt++,
|
sendAttempt++,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
@ -191,15 +187,10 @@ class LoginController extends State<Login> {
|
||||||
message: L10n.of(context).chooseAStrongPassword,
|
message: L10n.of(context).chooseAStrongPassword,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
fullyCapitalizedForMaterial: false,
|
hintText: '******',
|
||||||
textFields: [
|
obscureText: true,
|
||||||
const DialogTextField(
|
minLines: 1,
|
||||||
hintText: '******',
|
maxLines: 1,
|
||||||
obscureText: true,
|
|
||||||
minLines: 1,
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (password == null) return;
|
if (password == null) return;
|
||||||
final ok = await showOkAlertDialog(
|
final ok = await showOkAlertDialog(
|
||||||
|
|
@ -208,11 +199,10 @@ class LoginController extends State<Login> {
|
||||||
title: L10n.of(context).weSentYouAnEmail,
|
title: L10n.of(context).weSentYouAnEmail,
|
||||||
message: L10n.of(context).pleaseClickOnLink,
|
message: L10n.of(context).pleaseClickOnLink,
|
||||||
okLabel: L10n.of(context).iHaveClickedOnLink,
|
okLabel: L10n.of(context).iHaveClickedOnLink,
|
||||||
fullyCapitalizedForMaterial: false,
|
|
||||||
);
|
);
|
||||||
if (ok != OkCancelResult.ok) return;
|
if (ok != OkCancelResult.ok) return;
|
||||||
final data = <String, dynamic>{
|
final data = <String, dynamic>{
|
||||||
'new_password': password.single,
|
'new_password': password,
|
||||||
'logout_devices': false,
|
'logout_devices': false,
|
||||||
"auth": AuthenticationThreePidCreds(
|
"auth": AuthenticationThreePidCreds(
|
||||||
type: AuthenticationTypes.emailIdentity,
|
type: AuthenticationTypes.emailIdentity,
|
||||||
|
|
@ -234,8 +224,8 @@ class LoginController extends State<Login> {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context).passwordHasBeenChanged)),
|
SnackBar(content: Text(L10n.of(context).passwordHasBeenChanged)),
|
||||||
);
|
);
|
||||||
usernameController.text = input.single;
|
usernameController.text = input;
|
||||||
passwordController.text = password.single;
|
passwordController.text = password;
|
||||||
login();
|
login();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
|
@ -10,6 +9,9 @@ import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/utils/file_selector.dart';
|
import 'package:fluffychat/utils/file_selector.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.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 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
import '../bootstrap/bootstrap_dialog.dart';
|
import '../bootstrap/bootstrap_dialog.dart';
|
||||||
|
|
@ -39,19 +41,14 @@ class SettingsController extends State<Settings> {
|
||||||
title: L10n.of(context).editDisplayname,
|
title: L10n.of(context).editDisplayname,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [
|
initialText:
|
||||||
DialogTextField(
|
profile?.displayName ?? Matrix.of(context).client.userID!.localpart,
|
||||||
initialText: profile?.displayName ??
|
|
||||||
Matrix.of(context).client.userID!.localpart,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (input == null) return;
|
if (input == null) return;
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () =>
|
future: () => matrix.client.setDisplayName(matrix.client.userID!, input),
|
||||||
matrix.client.setDisplayName(matrix.client.userID!, input.single),
|
|
||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
updateProfile();
|
updateProfile();
|
||||||
|
|
@ -65,7 +62,7 @@ class SettingsController extends State<Settings> {
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).areYouSureYouWantToLogout,
|
title: L10n.of(context).areYouSureYouWantToLogout,
|
||||||
message: L10n.of(context).noBackupWarning,
|
message: L10n.of(context).noBackupWarning,
|
||||||
isDestructiveAction: noBackup,
|
isDestructive: noBackup,
|
||||||
okLabel: L10n.of(context).logout,
|
okLabel: L10n.of(context).logout,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
) ==
|
) ==
|
||||||
|
|
@ -83,30 +80,31 @@ class SettingsController extends State<Settings> {
|
||||||
final profile = await profileFuture;
|
final profile = await profileFuture;
|
||||||
final actions = [
|
final actions = [
|
||||||
if (PlatformInfos.isMobile)
|
if (PlatformInfos.isMobile)
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: AvatarAction.camera,
|
value: AvatarAction.camera,
|
||||||
label: L10n.of(context).openCamera,
|
label: L10n.of(context).openCamera,
|
||||||
isDefaultAction: true,
|
isDefaultAction: true,
|
||||||
icon: Icons.camera_alt_outlined,
|
icon: const Icon(Icons.camera_alt_outlined),
|
||||||
),
|
),
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: AvatarAction.file,
|
value: AvatarAction.file,
|
||||||
label: L10n.of(context).openGallery,
|
label: L10n.of(context).openGallery,
|
||||||
icon: Icons.photo_outlined,
|
icon: const Icon(Icons.photo_outlined),
|
||||||
),
|
),
|
||||||
if (profile?.avatarUrl != null)
|
if (profile?.avatarUrl != null)
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
key: AvatarAction.remove,
|
value: AvatarAction.remove,
|
||||||
label: L10n.of(context).removeYourAvatar,
|
label: L10n.of(context).removeYourAvatar,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
icon: Icons.delete_outlined,
|
icon: const Icon(Icons.delete_outlined),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
final action = actions.length == 1
|
final action = actions.length == 1
|
||||||
? actions.single.key
|
? actions.single.value
|
||||||
: await showModalActionSheet<AvatarAction>(
|
: await showModalActionPopup<AvatarAction>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).changeYourAvatar,
|
title: L10n.of(context).changeYourAvatar,
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
);
|
);
|
||||||
if (action == null) return;
|
if (action == null) return;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.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 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'settings_3pid_view.dart';
|
import 'settings_3pid_view.dart';
|
||||||
|
|
@ -25,12 +26,8 @@ class Settings3PidController extends State<Settings3Pid> {
|
||||||
title: L10n.of(context).enterAnEmailAddress,
|
title: L10n.of(context).enterAnEmailAddress,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [
|
hintText: L10n.of(context).enterAnEmailAddress,
|
||||||
DialogTextField(
|
keyboardType: TextInputType.emailAddress,
|
||||||
hintText: L10n.of(context).enterAnEmailAddress,
|
|
||||||
keyboardType: TextInputType.emailAddress,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (input == null) return;
|
if (input == null) return;
|
||||||
final clientSecret = DateTime.now().millisecondsSinceEpoch.toString();
|
final clientSecret = DateTime.now().millisecondsSinceEpoch.toString();
|
||||||
|
|
@ -38,7 +35,7 @@ class Settings3PidController extends State<Settings3Pid> {
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Matrix.of(context).client.requestTokenToRegisterEmail(
|
future: () => Matrix.of(context).client.requestTokenToRegisterEmail(
|
||||||
clientSecret,
|
clientSecret,
|
||||||
input.single,
|
input,
|
||||||
Settings3Pid.sendAttempt++,
|
Settings3Pid.sendAttempt++,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:archive/archive.dart';
|
import 'package:archive/archive.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
@ -11,6 +10,7 @@ import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/settings_emotes/settings_emotes.dart';
|
import 'package:fluffychat/pages/settings_emotes/settings_emotes.dart';
|
||||||
import 'package:fluffychat/utils/client_manager.dart';
|
import 'package:fluffychat/utils/client_manager.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
||||||
class ImportEmoteArchiveDialog extends StatefulWidget {
|
class ImportEmoteArchiveDialog extends StatefulWidget {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import 'dart:async';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
@ -13,6 +12,7 @@ import 'package:matrix/matrix.dart';
|
||||||
import 'package:fluffychat/utils/client_manager.dart';
|
import 'package:fluffychat/utils/client_manager.dart';
|
||||||
import 'package:fluffychat/utils/file_selector.dart';
|
import 'package:fluffychat/utils/file_selector.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
import 'import_archive_dialog.dart';
|
import 'import_archive_dialog.dart';
|
||||||
|
|
@ -139,7 +139,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context).emoteExists,
|
title: L10n.of(context).emoteExists,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
@ -149,7 +149,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context).emoteInvalid,
|
title: L10n.of(context).emoteInvalid,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
@ -185,7 +185,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context).emoteWarnNeedToPick,
|
title: L10n.of(context).emoteWarnNeedToPick,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
@ -195,7 +195,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context).emoteExists,
|
title: L10n.of(context).emoteExists,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
@ -204,7 +204,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
message: L10n.of(context).emoteInvalid,
|
title: L10n.of(context).emoteInvalid,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart' show IterableExtension;
|
import 'package:collection/collection.dart' show IterableExtension;
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
import 'settings_notifications_view.dart';
|
import 'settings_notifications_view.dart';
|
||||||
|
|
@ -138,15 +138,16 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPusherTap(Pusher pusher) async {
|
void onPusherTap(Pusher pusher) async {
|
||||||
final delete = await showModalActionSheet<bool>(
|
final delete = await showModalActionPopup<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
title: pusher.deviceDisplayName,
|
title: pusher.deviceDisplayName,
|
||||||
message: '${pusher.appDisplayName} (${pusher.appId})',
|
message: '${pusher.appDisplayName} (${pusher.appId})',
|
||||||
|
cancelLabel: L10n.of(context).cancel,
|
||||||
actions: [
|
actions: [
|
||||||
SheetAction(
|
AdaptiveModalAction(
|
||||||
label: L10n.of(context).delete,
|
label: L10n.of(context).delete,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
key: true,
|
value: true,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.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/app_lock.dart';
|
import 'package:fluffychat/widgets/app_lock.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
@ -28,25 +29,20 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
title: L10n.of(context).pleaseChooseAPasscode,
|
title: L10n.of(context).pleaseChooseAPasscode,
|
||||||
message: L10n.of(context).pleaseEnter4Digits,
|
message: L10n.of(context).pleaseEnter4Digits,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [
|
validator: (text) {
|
||||||
DialogTextField(
|
if (text.isEmpty || (text.length == 4 && int.tryParse(text)! >= 0)) {
|
||||||
validator: (text) {
|
return null;
|
||||||
if (text!.isEmpty ||
|
}
|
||||||
(text.length == 4 && int.tryParse(text)! >= 0)) {
|
return L10n.of(context).pleaseEnter4Digits;
|
||||||
return null;
|
},
|
||||||
}
|
keyboardType: TextInputType.number,
|
||||||
return L10n.of(context).pleaseEnter4Digits;
|
obscureText: true,
|
||||||
},
|
maxLines: 1,
|
||||||
keyboardType: TextInputType.number,
|
minLines: 1,
|
||||||
obscureText: true,
|
maxLength: 4,
|
||||||
maxLines: 1,
|
|
||||||
minLines: 1,
|
|
||||||
maxLength: 4,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (newLock != null) {
|
if (newLock != null) {
|
||||||
await AppLock.of(context).changePincode(newLock.single);
|
await AppLock.of(context).changePincode(newLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,7 +54,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
message: L10n.of(context).deactivateAccountWarning,
|
message: L10n.of(context).deactivateAccountWarning,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
) ==
|
) ==
|
||||||
OkCancelResult.cancel) {
|
OkCancelResult.cancel) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -68,18 +64,14 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).confirmMatrixId,
|
title: L10n.of(context).confirmMatrixId,
|
||||||
textFields: [
|
validator: (text) => text == supposedMxid
|
||||||
DialogTextField(
|
? null
|
||||||
validator: (text) => text == supposedMxid
|
: L10n.of(context).supposedMxid(supposedMxid),
|
||||||
? null
|
isDestructive: true,
|
||||||
: L10n.of(context).supposedMxid(supposedMxid),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
isDestructiveAction: true,
|
|
||||||
okLabel: L10n.of(context).delete,
|
okLabel: L10n.of(context).delete,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
);
|
);
|
||||||
if (mxids == null || mxids.length != 1 || mxids.single != supposedMxid) {
|
if (mxids == null || mxids.length != 1 || mxids != supposedMxid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
|
|
@ -88,22 +80,18 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
title: L10n.of(context).pleaseEnterYourPassword,
|
title: L10n.of(context).pleaseEnterYourPassword,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
textFields: [
|
obscureText: true,
|
||||||
const DialogTextField(
|
hintText: '******',
|
||||||
obscureText: true,
|
minLines: 1,
|
||||||
hintText: '******',
|
maxLines: 1,
|
||||||
minLines: 1,
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (input == null) return;
|
if (input == null) return;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Matrix.of(context).client.deactivateAccount(
|
future: () => Matrix.of(context).client.deactivateAccount(
|
||||||
auth: AuthenticationPassword(
|
auth: AuthenticationPassword(
|
||||||
password: input.single,
|
password: input,
|
||||||
identifier: AuthenticationUserIdentifier(
|
identifier: AuthenticationUserIdentifier(
|
||||||
user: Matrix.of(context).client.userID!,
|
user: Matrix.of(context).client.userID!,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.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 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/permission_slider_dialog.dart';
|
import 'package:fluffychat/widgets/permission_slider_dialog.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
|
|
@ -96,23 +98,22 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
case UserBottomSheetAction.report:
|
case UserBottomSheetAction.report:
|
||||||
if (user == null) throw ('User must not be null for this action!');
|
if (user == null) throw ('User must not be null for this action!');
|
||||||
|
|
||||||
final score = await showConfirmationDialog<int>(
|
final score = await showModalActionPopup<int>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).reportUser,
|
title: L10n.of(context).reportUser,
|
||||||
message: L10n.of(context).howOffensiveIsThisContent,
|
message: L10n.of(context).howOffensiveIsThisContent,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
okLabel: L10n.of(context).ok,
|
|
||||||
actions: [
|
actions: [
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: -100,
|
value: -100,
|
||||||
label: L10n.of(context).extremeOffensive,
|
label: L10n.of(context).extremeOffensive,
|
||||||
),
|
),
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: -50,
|
value: -50,
|
||||||
label: L10n.of(context).offensive,
|
label: L10n.of(context).offensive,
|
||||||
),
|
),
|
||||||
AlertDialogAction(
|
AdaptiveModalAction(
|
||||||
key: 0,
|
value: 0,
|
||||||
label: L10n.of(context).inoffensive,
|
label: L10n.of(context).inoffensive,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -124,16 +125,16 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
title: L10n.of(context).whyDoYouWantToReportThis,
|
title: L10n.of(context).whyDoYouWantToReportThis,
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
textFields: [DialogTextField(hintText: L10n.of(context).reason)],
|
hintText: L10n.of(context).reason,
|
||||||
);
|
);
|
||||||
if (reason == null || reason.single.isEmpty) return;
|
if (reason == null || reason.isEmpty) return;
|
||||||
|
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Matrix.of(widget.outerContext).client.reportContent(
|
future: () => Matrix.of(widget.outerContext).client.reportContent(
|
||||||
user.room.id,
|
user.room.id,
|
||||||
user.id,
|
user.id,
|
||||||
reason: reason.single,
|
reason: reason,
|
||||||
score: score,
|
score: score,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import 'package:matrix/matrix.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialog_action.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
|
|
||||||
class ErrorReporter {
|
class ErrorReporter {
|
||||||
final BuildContext context;
|
final BuildContext context;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||||
|
|
||||||
Widget markdownContextBuilder(
|
Widget markdownContextBuilder(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
EditableTextState editableTextState,
|
EditableTextState editableTextState,
|
||||||
|
|
@ -26,27 +27,21 @@ Widget markdownContextBuilder(
|
||||||
title: l10n.addLink,
|
title: l10n.addLink,
|
||||||
okLabel: l10n.ok,
|
okLabel: l10n.ok,
|
||||||
cancelLabel: l10n.cancel,
|
cancelLabel: l10n.cancel,
|
||||||
textFields: [
|
validator: (text) {
|
||||||
DialogTextField(
|
if (text.isEmpty) {
|
||||||
validator: (text) {
|
return l10n.pleaseFillOut;
|
||||||
if (text == null || text.isEmpty) {
|
}
|
||||||
return l10n.pleaseFillOut;
|
try {
|
||||||
}
|
text.startsWith('http') ? Uri.parse(text) : Uri.https(text);
|
||||||
try {
|
} catch (_) {
|
||||||
text.startsWith('http')
|
return l10n.invalidUrl;
|
||||||
? Uri.parse(text)
|
}
|
||||||
: Uri.https(text);
|
return null;
|
||||||
} catch (_) {
|
},
|
||||||
return l10n.invalidUrl;
|
hintText: 'www...',
|
||||||
}
|
keyboardType: TextInputType.url,
|
||||||
return null;
|
|
||||||
},
|
|
||||||
hintText: 'www...',
|
|
||||||
keyboardType: TextInputType.url,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
final urlString = input?.singleOrNull;
|
final urlString = input;
|
||||||
if (urlString == null) return;
|
if (urlString == null) return;
|
||||||
final url = urlString.startsWith('http')
|
final url = urlString.startsWith('http')
|
||||||
? Uri.parse(urlString)
|
? Uri.parse(urlString)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.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/fluffy_chat_app.dart';
|
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
||||||
|
|
@ -30,16 +31,11 @@ extension UiaRequestManager on MatrixState {
|
||||||
title: l10n.pleaseEnterYourPassword,
|
title: l10n.pleaseEnterYourPassword,
|
||||||
okLabel: l10n.ok,
|
okLabel: l10n.ok,
|
||||||
cancelLabel: l10n.cancel,
|
cancelLabel: l10n.cancel,
|
||||||
textFields: [
|
minLines: 1,
|
||||||
const DialogTextField(
|
maxLines: 1,
|
||||||
minLines: 1,
|
obscureText: true,
|
||||||
maxLines: 1,
|
hintText: '******',
|
||||||
obscureText: true,
|
));
|
||||||
hintText: '******',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
))
|
|
||||||
?.single;
|
|
||||||
if (input == null || input.isEmpty) {
|
if (input == null || input.isEmpty) {
|
||||||
return uiaRequest.cancel();
|
return uiaRequest.cancel();
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +87,7 @@ extension UiaRequestManager on MatrixState {
|
||||||
if (OkCancelResult.ok ==
|
if (OkCancelResult.ok ==
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
message: l10n.pleaseFollowInstructionsOnWeb,
|
title: l10n.pleaseFollowInstructionsOnWeb,
|
||||||
context: navigatorContext,
|
context: navigatorContext,
|
||||||
okLabel: l10n.next,
|
okLabel: l10n.next,
|
||||||
cancelLabel: l10n.cancel,
|
cancelLabel: l10n.cancel,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart' show IterableExtension;
|
import 'package:collection/collection.dart' show IterableExtension;
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
@ -11,6 +10,7 @@ import 'package:url_launcher/url_launcher_string.dart';
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/pages/user_bottom_sheet/user_bottom_sheet.dart';
|
import 'package:fluffychat/pages/user_bottom_sheet/user_bottom_sheet.dart';
|
||||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
||||||
|
|
|
||||||
116
lib/widgets/adaptive_dialogs/show_modal_action_popup.dart
Normal file
116
lib/widgets/adaptive_dialogs/show_modal_action_popup.dart
Normal file
|
|
@ -0,0 +1,116 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
Future<T?> showModalActionPopup<T>({
|
||||||
|
required BuildContext context,
|
||||||
|
required List<AdaptiveModalAction<T>> actions,
|
||||||
|
String? title,
|
||||||
|
String? message,
|
||||||
|
String? cancelLabel,
|
||||||
|
bool useRootNavigator = true,
|
||||||
|
}) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
|
switch (theme.platform) {
|
||||||
|
case TargetPlatform.android:
|
||||||
|
case TargetPlatform.fuchsia:
|
||||||
|
case TargetPlatform.windows:
|
||||||
|
case TargetPlatform.linux:
|
||||||
|
return showModalBottomSheet(
|
||||||
|
isScrollControlled: true,
|
||||||
|
useRootNavigator: useRootNavigator,
|
||||||
|
context: context,
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: 512,
|
||||||
|
maxHeight: MediaQuery.of(context).size.height - 32,
|
||||||
|
),
|
||||||
|
builder: (context) => ListView(
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: [
|
||||||
|
if (title != null || message != null) ...[
|
||||||
|
ListTile(
|
||||||
|
title: title == null
|
||||||
|
? null
|
||||||
|
: Text(
|
||||||
|
title,
|
||||||
|
style: theme.textTheme.labelSmall,
|
||||||
|
),
|
||||||
|
subtitle: message == null ? null : Text(message),
|
||||||
|
),
|
||||||
|
const Divider(height: 1),
|
||||||
|
],
|
||||||
|
...actions.map(
|
||||||
|
(action) => ListTile(
|
||||||
|
leading: action.icon,
|
||||||
|
title: Text(
|
||||||
|
action.label,
|
||||||
|
maxLines: 1,
|
||||||
|
style: action.isDestructive
|
||||||
|
? TextStyle(
|
||||||
|
color: theme.colorScheme.error,
|
||||||
|
fontWeight:
|
||||||
|
action.isDefaultAction ? FontWeight.bold : null,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
onTap: () => Navigator.of(context).pop<T>(action.value),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (cancelLabel != null) ...[
|
||||||
|
const Divider(height: 1),
|
||||||
|
ListTile(
|
||||||
|
title: Text(cancelLabel),
|
||||||
|
onTap: () => Navigator.of(context).pop(null),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case TargetPlatform.iOS:
|
||||||
|
case TargetPlatform.macOS:
|
||||||
|
return showCupertinoModalPopup<T>(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: useRootNavigator,
|
||||||
|
builder: (context) => ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 512),
|
||||||
|
child: CupertinoActionSheet(
|
||||||
|
title: title == null ? null : Text(title),
|
||||||
|
message: message == null ? null : Text(message),
|
||||||
|
cancelButton: cancelLabel == null
|
||||||
|
? null
|
||||||
|
: CupertinoActionSheetAction(
|
||||||
|
onPressed: () => Navigator.of(context).pop(null),
|
||||||
|
child: Text(cancelLabel),
|
||||||
|
),
|
||||||
|
actions: actions
|
||||||
|
.map(
|
||||||
|
(action) => CupertinoActionSheetAction(
|
||||||
|
isDestructiveAction: action.isDestructive,
|
||||||
|
isDefaultAction: action.isDefaultAction,
|
||||||
|
onPressed: () => Navigator.of(context).pop<T>(action.value),
|
||||||
|
child: Text(action.label, maxLines: 1),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AdaptiveModalAction<T> {
|
||||||
|
final String label;
|
||||||
|
final T value;
|
||||||
|
Icon? icon;
|
||||||
|
final bool isDefaultAction;
|
||||||
|
final bool isDestructive;
|
||||||
|
|
||||||
|
AdaptiveModalAction({
|
||||||
|
required this.label,
|
||||||
|
required this.value,
|
||||||
|
this.icon,
|
||||||
|
this.isDefaultAction = false,
|
||||||
|
this.isDestructive = false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
|
|
||||||
|
enum OkCancelResult { ok, cancel }
|
||||||
|
|
||||||
|
Future<OkCancelResult?> showOkCancelAlertDialog({
|
||||||
|
required BuildContext context,
|
||||||
|
required String title,
|
||||||
|
String? message,
|
||||||
|
String? okLabel,
|
||||||
|
String? cancelLabel,
|
||||||
|
bool isDestructive = false,
|
||||||
|
bool useRootNavigator = true,
|
||||||
|
}) =>
|
||||||
|
showAdaptiveDialog<OkCancelResult>(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: useRootNavigator,
|
||||||
|
builder: (context) => AlertDialog.adaptive(
|
||||||
|
title: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
|
child: Text(title),
|
||||||
|
),
|
||||||
|
content: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
|
child: message == null ? null : Text(message),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
AdaptiveDialogAction(
|
||||||
|
onPressed: () => Navigator.of(context)
|
||||||
|
.pop<OkCancelResult>(OkCancelResult.cancel),
|
||||||
|
child: Text(cancelLabel ?? L10n.of(context).cancel),
|
||||||
|
),
|
||||||
|
AdaptiveDialogAction(
|
||||||
|
onPressed: () =>
|
||||||
|
Navigator.of(context).pop<OkCancelResult>(OkCancelResult.ok),
|
||||||
|
child: Text(
|
||||||
|
okLabel ?? L10n.of(context).ok,
|
||||||
|
style: isDestructive
|
||||||
|
? TextStyle(color: Theme.of(context).colorScheme.error)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
Future<OkCancelResult?> showOkAlertDialog({
|
||||||
|
required BuildContext context,
|
||||||
|
required String title,
|
||||||
|
String? message,
|
||||||
|
String? okLabel,
|
||||||
|
bool useRootNavigator = true,
|
||||||
|
}) =>
|
||||||
|
showAdaptiveDialog<OkCancelResult>(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: useRootNavigator,
|
||||||
|
builder: (context) => AlertDialog.adaptive(
|
||||||
|
title: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
|
child: Text(title),
|
||||||
|
),
|
||||||
|
content: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
|
child: message == null ? null : Text(message),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
AdaptiveDialogAction(
|
||||||
|
onPressed: () =>
|
||||||
|
Navigator.of(context).pop<OkCancelResult>(OkCancelResult.ok),
|
||||||
|
child: Text(okLabel ?? L10n.of(context).close),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
101
lib/widgets/adaptive_dialogs/show_text_input_dialog.dart
Normal file
101
lib/widgets/adaptive_dialogs/show_text_input_dialog.dart
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
|
|
||||||
|
Future<String?> showTextInputDialog({
|
||||||
|
required BuildContext context,
|
||||||
|
required String title,
|
||||||
|
String? message,
|
||||||
|
String? okLabel,
|
||||||
|
String? cancelLabel,
|
||||||
|
bool useRootNavigator = true,
|
||||||
|
String? hintText,
|
||||||
|
String? labelText,
|
||||||
|
String? initialText,
|
||||||
|
String? prefixText,
|
||||||
|
String? suffixText,
|
||||||
|
bool obscureText = false,
|
||||||
|
bool isDestructive = false,
|
||||||
|
int? minLines,
|
||||||
|
int? maxLines,
|
||||||
|
String? Function(String input)? validator,
|
||||||
|
TextInputType? keyboardType,
|
||||||
|
int? maxLength,
|
||||||
|
bool autocorrect = true,
|
||||||
|
}) =>
|
||||||
|
showAdaptiveDialog<String>(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: useRootNavigator,
|
||||||
|
builder: (context) {
|
||||||
|
final controller = TextEditingController(text: initialText);
|
||||||
|
final error = ValueNotifier<String?>(null);
|
||||||
|
return ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 512),
|
||||||
|
child: AlertDialog.adaptive(
|
||||||
|
title: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
|
child: Text(title),
|
||||||
|
),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (message != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16.0),
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
|
child: Text(message),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ValueListenableBuilder<String?>(
|
||||||
|
valueListenable: error,
|
||||||
|
builder: (context, error, _) {
|
||||||
|
return TextField(
|
||||||
|
controller: controller,
|
||||||
|
obscureText: obscureText,
|
||||||
|
minLines: minLines,
|
||||||
|
maxLines: maxLines,
|
||||||
|
maxLength: maxLength,
|
||||||
|
keyboardType: keyboardType,
|
||||||
|
autocorrect: autocorrect,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
errorText: error,
|
||||||
|
hintText: hintText,
|
||||||
|
labelText: labelText,
|
||||||
|
prefixText: prefixText,
|
||||||
|
suffixText: suffixText,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
AdaptiveDialogAction(
|
||||||
|
onPressed: () => Navigator.of(context).pop(null),
|
||||||
|
child: Text(cancelLabel ?? L10n.of(context).cancel),
|
||||||
|
),
|
||||||
|
AdaptiveDialogAction(
|
||||||
|
onPressed: () {
|
||||||
|
final input = controller.text;
|
||||||
|
final errorText = validator?.call(input);
|
||||||
|
if (errorText != null) {
|
||||||
|
error.value = errorText;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop<String>(input);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
okLabel ?? L10n.of(context).ok,
|
||||||
|
style: isDestructive
|
||||||
|
? TextStyle(color: Theme.of(context).colorScheme.error)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
@ -2,11 +2,11 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'matrix.dart';
|
import 'matrix.dart';
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
||||||
okLabel: L10n.of(context).ok,
|
okLabel: L10n.of(context).ok,
|
||||||
cancelLabel: L10n.of(context).cancel,
|
cancelLabel: L10n.of(context).cancel,
|
||||||
message: L10n.of(context).archiveRoomDescription,
|
message: L10n.of(context).archiveRoomDescription,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
);
|
);
|
||||||
if (confirmed == OkCancelResult.ok) {
|
if (confirmed == OkCancelResult.ok) {
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import 'package:async/async.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialog_action.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
|
|
||||||
/// Displays a loading dialog which reacts to the given [future]. The dialog
|
/// Displays a loading dialog which reacts to the given [future]. The dialog
|
||||||
/// will be dismissed and the value will be returned when the future completes.
|
/// will be dismissed and the value will be returned when the future completes.
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import 'dart:convert';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:desktop_notifications/desktop_notifications.dart';
|
import 'package:desktop_notifications/desktop_notifications.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
@ -24,6 +23,7 @@ import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dar
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/utils/uia_request_manager.dart';
|
import 'package:fluffychat/utils/uia_request_manager.dart';
|
||||||
import 'package:fluffychat/utils/voip_plugin.dart';
|
import 'package:fluffychat/utils/voip_plugin.dart';
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
|
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import '../config/app_config.dart';
|
import '../config/app_config.dart';
|
||||||
|
|
@ -344,13 +344,11 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
this,
|
this,
|
||||||
onFcmError: (errorMsg, {Uri? link}) async {
|
onFcmError: (errorMsg, {Uri? link}) async {
|
||||||
final result = await showOkCancelAlertDialog(
|
final result = await showOkCancelAlertDialog(
|
||||||
barrierDismissible: true,
|
|
||||||
context: FluffyChatApp
|
context: FluffyChatApp
|
||||||
.router.routerDelegate.navigatorKey.currentContext ??
|
.router.routerDelegate.navigatorKey.currentContext ??
|
||||||
context,
|
context,
|
||||||
title: L10n.of(context).pushNotificationsNotAvailable,
|
title: L10n.of(context).pushNotificationsNotAvailable,
|
||||||
message: errorMsg,
|
message: errorMsg,
|
||||||
fullyCapitalizedForMaterial: false,
|
|
||||||
okLabel:
|
okLabel:
|
||||||
link == null ? L10n.of(context).ok : L10n.of(context).learnMore,
|
link == null ? L10n.of(context).ok : L10n.of(context).learnMore,
|
||||||
cancelLabel: L10n.of(context).doNotShowAgain,
|
cancelLabel: L10n.of(context).doNotShowAgain,
|
||||||
|
|
@ -470,7 +468,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
Future<void> dehydrateAction(BuildContext context) async {
|
Future<void> dehydrateAction(BuildContext context) async {
|
||||||
final response = await showOkCancelAlertDialog(
|
final response = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
isDestructiveAction: true,
|
isDestructive: true,
|
||||||
title: L10n.of(context).dehydrate,
|
title: L10n.of(context).dehydrate,
|
||||||
message: L10n.of(context).dehydrateWarning,
|
message: L10n.of(context).dehydrateWarning,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||||
|
|
||||||
Future<int?> showPermissionChooser(
|
Future<int?> showPermissionChooser(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
int currentLevel = 0,
|
int currentLevel = 0,
|
||||||
|
|
@ -11,24 +12,20 @@ Future<int?> showPermissionChooser(
|
||||||
final customLevel = await showTextInputDialog(
|
final customLevel = await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).setPermissionsLevel,
|
title: L10n.of(context).setPermissionsLevel,
|
||||||
textFields: [
|
initialText: currentLevel.toString(),
|
||||||
DialogTextField(
|
keyboardType: TextInputType.number,
|
||||||
initialText: currentLevel.toString(),
|
autocorrect: false,
|
||||||
keyboardType: TextInputType.number,
|
validator: (text) {
|
||||||
autocorrect: false,
|
if (text.isEmpty) {
|
||||||
validator: (text) {
|
return L10n.of(context).pleaseEnterANumber;
|
||||||
if (text == null) {
|
}
|
||||||
return L10n.of(context).pleaseEnterANumber;
|
final level = int.tryParse(text);
|
||||||
}
|
if (level == null) {
|
||||||
final level = int.tryParse(text);
|
return L10n.of(context).pleaseEnterANumber;
|
||||||
if (level == null) {
|
}
|
||||||
return L10n.of(context).pleaseEnterANumber;
|
return null;
|
||||||
}
|
},
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
if (customLevel == null) return null;
|
if (customLevel == null) return null;
|
||||||
return int.tryParse(customLevel.first);
|
return int.tryParse(customLevel);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import appkit_ui_element_colors
|
|
||||||
import audio_session
|
import audio_session
|
||||||
import desktop_drop
|
import desktop_drop
|
||||||
import device_info_plus
|
import device_info_plus
|
||||||
|
|
@ -19,8 +18,6 @@ import flutter_web_auth_2
|
||||||
import flutter_webrtc
|
import flutter_webrtc
|
||||||
import geolocator_apple
|
import geolocator_apple
|
||||||
import just_audio
|
import just_audio
|
||||||
import macos_ui
|
|
||||||
import macos_window_utils
|
|
||||||
import package_info_plus
|
import package_info_plus
|
||||||
import pasteboard
|
import pasteboard
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
|
|
@ -36,7 +33,6 @@ import wakelock_plus
|
||||||
import window_to_front
|
import window_to_front
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
AppkitUiElementColorsPlugin.register(with: registry.registrar(forPlugin: "AppkitUiElementColorsPlugin"))
|
|
||||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||||
DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))
|
DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))
|
||||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||||
|
|
@ -50,8 +46,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
|
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
|
||||||
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
||||||
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
||||||
MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin"))
|
|
||||||
MacOSWindowUtilsPlugin.register(with: registry.registrar(forPlugin: "MacOSWindowUtilsPlugin"))
|
|
||||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||||
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
|
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
|
|
||||||
56
pubspec.lock
56
pubspec.lock
|
|
@ -14,14 +14,6 @@ packages:
|
||||||
description: dart
|
description: dart
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.3.2"
|
version: "0.3.2"
|
||||||
adaptive_dialog:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: adaptive_dialog
|
|
||||||
sha256: b02055729c225c369f90fdbc9564452e183cb919f83a971f512199084474530f
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.2.1+2"
|
|
||||||
analyzer:
|
analyzer:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -46,14 +38,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.3"
|
||||||
appkit_ui_element_colors:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: appkit_ui_element_colors
|
|
||||||
sha256: c3e50f900aae314d339de489535736238627071457c4a4a2dbbb1545b4f04f22
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.0"
|
|
||||||
archive:
|
archive:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -342,14 +326,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.4"
|
version: "0.2.4"
|
||||||
equatable:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: equatable
|
|
||||||
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.5"
|
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -861,14 +837,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "14.3.0"
|
version: "14.3.0"
|
||||||
gradient_borders:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: gradient_borders
|
|
||||||
sha256: b1cd969552c83f458ff755aa68e13a0327d09f06c3f42f471b423b01427f21f8
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.1"
|
|
||||||
handy_window:
|
handy_window:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -1026,14 +994,6 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
intersperse:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: intersperse
|
|
||||||
sha256: "2f8a905c96f6cbba978644a3d5b31b8d86ddc44917662df7d27a61f3df66a576"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.0"
|
|
||||||
intl:
|
intl:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -1178,22 +1138,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.0"
|
||||||
macos_ui:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: macos_ui
|
|
||||||
sha256: "80f6539aba5a3a1182d5225a6c27969a780bcb1d2d8135b4ffb708570cf0c854"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.9"
|
|
||||||
macos_window_utils:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: macos_window_utils
|
|
||||||
sha256: "230be594d26f6dee92c5a1544f4242d25138a5bfb9f185b27f14de3949ef0be8"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.5.0"
|
|
||||||
macros:
|
macros:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
adaptive_dialog: ^2.1.0
|
|
||||||
animations: ^2.0.11
|
animations: ^2.0.11
|
||||||
archive: ^3.4.10
|
archive: ^3.4.10
|
||||||
async: ^2.11.0
|
async: ^2.11.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue