diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart index 95bb8d4976..33bacdbe53 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart @@ -3,6 +3,7 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/shared/appflowy_cache_manager.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/util/share_log_files.dart'; +import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart'; import 'package:appflowy/workspace/application/settings/appflowy_cloud_urls_bloc.dart'; import 'package:appflowy/workspace/application/settings/settings_dialog_bloc.dart'; import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart'; @@ -14,7 +15,6 @@ import 'package:appflowy/workspace/presentation/settings/pages/settings_plan_vie import 'package:appflowy/workspace/presentation/settings/pages/settings_shortcuts_view.dart'; import 'package:appflowy/workspace/presentation/settings/pages/settings_workspace_view.dart'; import 'package:appflowy/workspace/presentation/settings/shared/settings_category.dart'; -import 'package:appflowy/workspace/presentation/settings/shared/settings_category_spacer.dart'; import 'package:appflowy/workspace/presentation/settings/widgets/feature_flags/feature_flag_page.dart'; import 'package:appflowy/workspace/presentation/settings/widgets/members/workspace_member_page.dart'; import 'package:appflowy/workspace/presentation/settings/widgets/settings_menu.dart'; @@ -26,6 +26,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:toastification/toastification.dart'; import 'widgets/setting_cloud.dart'; @@ -167,22 +168,35 @@ class _SimpleSettingsDialogState extends State { @override Widget build(BuildContext context) { + context.watch(); + return FlowyDialog( width: MediaQuery.of(context).size.width * 0.7, constraints: const BoxConstraints(maxWidth: 784, minWidth: 564), - child: const Padding( - padding: EdgeInsets.all(24.0), + child: Padding( + padding: const EdgeInsets.all(24.0), child: Column( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + // header + FlowyText( + LocaleKeys.signIn_settings.tr(), + fontSize: 36.0, + fontWeight: FontWeight.w600, + ), + const VSpace(18.0), + // language - _LanguageSettings(), - SettingsCategorySpacer(), + const _LanguageSettings(), + const VSpace(22.0), + // self-host cloud - _SelfHostSettings(), - SettingsCategorySpacer(), + const _SelfHostSettings(), + const VSpace(22.0), + // support - _SupportSettings(), + const _SupportSettings(), ], ), ), @@ -232,17 +246,33 @@ class _SelfHostSettingsState extends State<_SelfHostSettings> { return SettingsCategory( title: LocaleKeys.settings_menu_cloudAppFlowySelfHost.tr(), children: [ - SizedBox( - height: 48, - child: FlowyTextField( - controller: textController, - autoFocus: false, - textStyle: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.w400, + Row( + children: [ + Expanded( + child: SizedBox( + height: 36, + child: FlowyTextField( + controller: textController, + autoFocus: false, + textStyle: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + ), + hintText: 'https://beta.appflowy.cloud', + onEditingComplete: _saveSelfHostUrl, + ), + ), ), - onEditingComplete: _saveSelfHostUrl, - ), + const HSpace(12.0), + Container( + height: 36, + constraints: const BoxConstraints(minWidth: 78), + child: OutlinedRoundedButton( + text: LocaleKeys.button_save.tr(), + onTap: _saveSelfHostUrl, + ), + ), + ], ), ], ); @@ -251,16 +281,33 @@ class _SelfHostSettingsState extends State<_SelfHostSettings> { void _saveSelfHostUrl() { final url = textController.text; if (url.isEmpty) { + showToastNotification( + context, + message: LocaleKeys.settings_menu_pleaseInputValidURL.tr(), + type: ToastificationType.error, + ); return; } validateUrl(url).fold( (url) async { + showToastNotification( + context, + message: LocaleKeys.settings_menu_changeUrl.tr(args: [url]), + ); + Navigator.of(context).pop(); await useSelfHostedAppFlowyCloudWithURL(url); await runAppFlowy(); }, - (err) => Log.error(err), + (err) { + showToastNotification( + context, + message: LocaleKeys.settings_menu_pleaseInputValidURL.tr(), + type: ToastificationType.error, + ); + Log.error(err); + }, ); } } @@ -280,11 +327,14 @@ class _SupportSettings extends StatelessWidget { LocaleKeys.workspace_errorActions_exportLogFiles.tr(), ), const Spacer(), - OutlinedRoundedButton( - text: LocaleKeys.settings_files_export.tr(), - onTap: () { - shareLogFiles(context); - }, + ConstrainedBox( + constraints: const BoxConstraints(minWidth: 78), + child: OutlinedRoundedButton( + text: LocaleKeys.settings_files_export.tr(), + onTap: () { + shareLogFiles(context); + }, + ), ), ], ), @@ -295,19 +345,22 @@ class _SupportSettings extends StatelessWidget { LocaleKeys.settings_files_clearCache.tr(), ), const Spacer(), - OutlinedRoundedButton( - text: LocaleKeys.button_clear.tr(), - onTap: () async { - await getIt().clearAllCache(); - if (context.mounted) { - showToastNotification( - context, - message: LocaleKeys - .settings_manageDataPage_cache_dialog_successHint - .tr(), - ); - } - }, + ConstrainedBox( + constraints: const BoxConstraints(minWidth: 78), + child: OutlinedRoundedButton( + text: LocaleKeys.button_clear.tr(), + onTap: () async { + await getIt().clearAllCache(); + if (context.mounted) { + showToastNotification( + context, + message: LocaleKeys + .settings_manageDataPage_cache_dialog_successHint + .tr(), + ); + } + }, + ), ), ], ), diff --git a/frontend/appflowy_flutter/macos/Podfile.lock b/frontend/appflowy_flutter/macos/Podfile.lock index f33b8850f0..300519a5dc 100644 --- a/frontend/appflowy_flutter/macos/Podfile.lock +++ b/frontend/appflowy_flutter/macos/Podfile.lock @@ -25,8 +25,6 @@ PODS: - FlutterMacOS - local_notifier (0.1.0): - FlutterMacOS - - open_file_mac (0.0.1): - - FlutterMacOS - package_info_plus (0.0.1): - FlutterMacOS - path_provider_foundation (0.0.1): @@ -68,7 +66,6 @@ DEPENDENCIES: - hotkey_manager (from `Flutter/ephemeral/.symlinks/plugins/hotkey_manager/macos`) - irondash_engine_context (from `Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos`) - local_notifier (from `Flutter/ephemeral/.symlinks/plugins/local_notifier/macos`) - - open_file_mac (from `Flutter/ephemeral/.symlinks/plugins/open_file_mac/macos`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`) @@ -111,8 +108,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos local_notifier: :path: Flutter/ephemeral/.symlinks/plugins/local_notifier/macos - open_file_mac: - :path: Flutter/ephemeral/.symlinks/plugins/open_file_mac/macos package_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos path_provider_foundation: @@ -148,7 +143,6 @@ SPEC CHECKSUMS: hotkey_manager: c32bf0bfe8f934b7bc17ab4ad5c4c142960b023c irondash_engine_context: da62996ee25616d2f01bbeb85dc115d813359478 local_notifier: e9506bc66fc70311e8bc7291fb70f743c081e4ff - open_file_mac: 0e554648e2a87ce59e9438e3e5ca3e552e90d89a package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 ReachabilitySwift: 7f151ff156cea1481a8411701195ac6a984f4979 diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/primary_rounded_button.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/primary_rounded_button.dart index af76b2cd6a..ca01703e23 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/primary_rounded_button.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/primary_rounded_button.dart @@ -91,6 +91,7 @@ class OutlinedRoundedButton extends StatelessWidget { text: FlowyText.regular( text, lineHeight: 1.0, + textAlign: TextAlign.center, ), onTap: onTap, ), diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.json index 3435848f17..32c095db9b 100644 --- a/frontend/resources/translations/en.json +++ b/frontend/resources/translations/en.json @@ -953,6 +953,8 @@ "selfHostStart": "If you don't have a server, please refer to the", "selfHostContent": "document", "selfHostEnd": "for guidance on how to self-host your own server", + "pleaseInputValidURL": "Please input a valid URL", + "changeUrl": "Change self-hosted url to {}", "cloudURLHint": "Input the base URL of your server", "cloudWSURL": "Websocket URL", "cloudWSURLHint": "Input the websocket address of your server",