diff --git a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_settings_test.dart b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_settings_test.dart index f5540b3bdccf2..07c0bbe057718 100644 --- a/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_settings_test.dart +++ b/frontend/appflowy_flutter/integration_test/desktop/cloud/workspace/workspace_settings_test.dart @@ -257,6 +257,10 @@ More actions for published page: widget is PublishedViewItem && widget.publishInfoView.view.name == pageName, ); + if (pageItem.evaluate().isEmpty) { + return; + } + expect(pageItem, findsOneWidget); final copyLinkItem = find.text(LocaleKeys.shareAction_copyLink.tr()); diff --git a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/mention_page_menu.dart b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/mention_page_menu.dart index 69fecad613dc7..ae2dbe5f26b1e 100644 --- a/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/mention_page_menu.dart +++ b/frontend/appflowy_flutter/lib/ai/widgets/prompt_input/mention_page_menu.dart @@ -49,7 +49,9 @@ class _PromptInputMentionPageMenuState void initState() { super.initState(); Future.delayed(Duration.zero, () { - context.read().refreshViews(); + if (mounted) { + context.read().refreshViews(); + } }); } diff --git a/frontend/appflowy_flutter/lib/env/cloud_env.dart b/frontend/appflowy_flutter/lib/env/cloud_env.dart index 8f4d195eb7b14..fd71598b24dc9 100644 --- a/frontend/appflowy_flutter/lib/env/cloud_env.dart +++ b/frontend/appflowy_flutter/lib/env/cloud_env.dart @@ -180,7 +180,7 @@ Future useLocalServer() async { await _setAuthenticatorType(AuthenticatorType.local); } -/// Use getIt() to get the shared environment. +// Use getIt() to get the shared environment. class AppFlowyCloudSharedEnv { AppFlowyCloudSharedEnv({ required AuthenticatorType authenticatorType, diff --git a/frontend/appflowy_flutter/lib/flutter/af_dropdown_menu.dart b/frontend/appflowy_flutter/lib/flutter/af_dropdown_menu.dart index 1cc846339b1c4..56a61e120b433 100644 --- a/frontend/appflowy_flutter/lib/flutter/af_dropdown_menu.dart +++ b/frontend/appflowy_flutter/lib/flutter/af_dropdown_menu.dart @@ -502,11 +502,11 @@ class _AFDropdownMenuState extends State> { // Simulate the focused state because the text field should always be focused // during traversal. If the menu item has a custom foreground color, the "focused" - // color will also change to foregroundColor.withOpacity(0.12). + // color will also change to foregroundColor.withValues(alpha: 0.12). effectiveStyle = entry.enabled && i == focusedIndex ? effectiveStyle.copyWith( backgroundColor: WidgetStatePropertyAll( - focusedBackgroundColor.withOpacity(0.12), + focusedBackgroundColor.withValues(alpha: 0.12), ), ) : effectiveStyle; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/base/view_page/app_bar_buttons.dart b/frontend/appflowy_flutter/lib/mobile/presentation/base/view_page/app_bar_buttons.dart index a228ac0229fef..7c79d20b787b7 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/base/view_page/app_bar_buttons.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/base/view_page/app_bar_buttons.dart @@ -42,7 +42,7 @@ class MobileViewPageImmersiveAppBar extends StatelessWidget valueListenable: appBarOpacity, builder: (_, opacity, __) => FlowyAppBar( backgroundColor: - AppBarTheme.of(context).backgroundColor?.withOpacity(opacity), + AppBarTheme.of(context).backgroundColor?.withValues(alpha: opacity), showDivider: false, title: Opacity(opacity: opacity >= 0.99 ? 1.0 : 0, child: title), leadingWidth: 44, @@ -220,7 +220,7 @@ class _ImmersiveAppBarButton extends StatelessWidget { child = DecoratedBox( decoration: BoxDecoration( borderRadius: BorderRadius.circular(dimension / 2.0), - color: Colors.black.withOpacity(0.2), + color: Colors.black.withValues(alpha: 0.2), ), child: child, ); diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart index 999813d63eaa4..a0fa5dc6aa9f7 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart @@ -74,7 +74,7 @@ Future showMobileBottomSheet( backgroundColor ??= Theme.of(context).brightness == Brightness.light ? const Color(0xFFF7F8FB) : const Color(0xFF23262B); - barrierColor ??= Colors.black.withOpacity(0.3); + barrierColor ??= Colors.black.withValues(alpha: 0.3); return showModalBottomSheet( context: context, diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_transition_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_transition_bottom_sheet.dart index 0ff2a6634ab3f..b29817251aeba 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_transition_bottom_sheet.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_transition_bottom_sheet.dart @@ -329,7 +329,7 @@ class CupertinoSheetBottomRouteTransition extends StatelessWidget { (Theme.of(context).brightness == Brightness.dark ? Colors.grey : Colors.black) - .withOpacity(secondaryAnimation.value * 0.1), + .withValues(alpha: secondaryAnimation.value * 0.1), BlendMode.srcOver, ), child: child, diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart index 2885f37bbd48e..2cfd8071742b7 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart @@ -1,5 +1,3 @@ -import 'package:flutter/material.dart'; - import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/database/board/board.dart'; @@ -19,6 +17,7 @@ import 'package:appflowy_board/appflowy_board.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; @@ -276,14 +275,20 @@ class _BoardContentState extends State<_BoardContent> { border: themeMode == ThemeMode.light ? Border.fromBorderSide( BorderSide( - color: Theme.of(context).colorScheme.outline.withOpacity(0.5), + color: Theme.of(context) + .colorScheme + .outline + .withValues(alpha: 0.5), ), ) : null, boxShadow: themeMode == ThemeMode.light ? [ BoxShadow( - color: Theme.of(context).colorScheme.outline.withOpacity(0.5), + color: Theme.of(context) + .colorScheme + .outline + .withValues(alpha: 0.5), blurRadius: 4, offset: const Offset(0, 2), ), diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart index a51e3561f8464..75b52de414b4a 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart @@ -1,5 +1,3 @@ -import 'package:flutter/material.dart'; - import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/base/app_bar/app_bar.dart'; import 'package:appflowy/mobile/presentation/database/field/mobile_full_field_editor.dart'; @@ -8,6 +6,7 @@ import 'package:appflowy/plugins/database/domain/field_backend_service.dart'; import 'package:appflowy/plugins/database/domain/field_service.dart'; import 'package:appflowy/plugins/database/widgets/setting/field_visibility_extension.dart'; import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; class MobileEditPropertyScreen extends StatefulWidget { @@ -49,7 +48,7 @@ class _MobileEditPropertyScreenState extends State { final fieldId = widget.field.id; return PopScope( - onPopInvoked: (didPop) { + onPopInvokedWithResult: (didPop, _) { if (!didPop) { context.pop(_fieldOptionValues); } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_trash_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_trash_page.dart index 73a5381d42c2c..73da7594a7b92 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_trash_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_trash_page.dart @@ -212,7 +212,7 @@ class _DeletedFilesListView extends StatelessWidget { ?.copyWith(color: theme.colorScheme.onSurface), ), horizontalTitleGap: 0, - tileColor: theme.colorScheme.onSurface.withOpacity(0.1), + tileColor: theme.colorScheme.onSurface.withValues(alpha: 0.1), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart index cad05acad4112..966b1ac61a412 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart @@ -134,7 +134,8 @@ class _RecentCover extends StatelessWidget { Widget build(BuildContext context) { final placeholder = Container( // random color, update it once we have a better placeholder - color: Theme.of(context).colorScheme.onSurfaceVariant.withOpacity(0.2), + color: + Theme.of(context).colorScheme.onSurfaceVariant.withValues(alpha: 0.2), ); final value = this.value; if (value == null) { diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/shared/mobile_page_card.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/shared/mobile_page_card.dart index e589ce7cd2c32..74bf02b64bfd3 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/shared/mobile_page_card.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/shared/mobile_page_card.dart @@ -216,7 +216,7 @@ class MobileViewPage extends StatelessWidget { Widget _buildLastViewed(BuildContext context) { final textColor = Theme.of(context).isLightMode ? const Color(0x7F171717) - : Colors.white.withOpacity(0.45); + : Colors.white.withValues(alpha: 0.45); if (timestamp == null) { return const SizedBox.shrink(); } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/tab/ai_bubble_button.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/tab/ai_bubble_button.dart index b3f10bbbd20d1..cc4176e0ef196 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/tab/ai_bubble_button.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/tab/ai_bubble_button.dart @@ -42,7 +42,7 @@ class FloatingAIEntry extends StatelessWidget { blurRadius: 20, spreadRadius: 1, offset: const Offset(0, 4), - color: Colors.black.withOpacity(0.05), + color: Colors.black.withValues(alpha: 0.05), ), ], ); @@ -51,8 +51,8 @@ class FloatingAIEntry extends StatelessWidget { BoxDecoration _buildWrapperDecoration(BuildContext context) { final outlineColor = Theme.of(context).colorScheme.outline; final borderColor = Theme.of(context).isLightMode - ? outlineColor.withOpacity(0.7) - : outlineColor.withOpacity(0.3); + ? outlineColor.withValues(alpha: 0.7) + : outlineColor.withValues(alpha: 0.3); return BoxDecoration( borderRadius: BorderRadius.circular(30), color: Theme.of(context).colorScheme.surface, diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/tab/mobile_space_tab.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/tab/mobile_space_tab.dart index 9d78e39645a37..681d72638fefa 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/tab/mobile_space_tab.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/tab/mobile_space_tab.dart @@ -165,8 +165,6 @@ class _MobileSpaceTabState extends State ); case MobileSpaceTabType.favorites: return MobileFavoriteSpace(userProfile: widget.userProfile); - default: - throw Exception('Unknown tab type: $tab'); } }).toList(); } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/workspaces/workspace_menu_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/workspaces/workspace_menu_bottom_sheet.dart index 9a5bd8c511a50..ef7f4492a5bc0 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/workspaces/workspace_menu_bottom_sheet.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/workspaces/workspace_menu_bottom_sheet.dart @@ -139,7 +139,7 @@ class _CreateWorkspaceButton extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), border: Border.all( - color: const Color(0x01717171).withOpacity(0.12), + color: const Color(0x01717171).withValues(alpha: 0.12), width: 0.8, ), ), diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/workspaces/workspace_more_options.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/workspaces/workspace_more_options.dart index 5f6066930fe68..bb6f6207f6519 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/workspaces/workspace_more_options.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/workspaces/workspace_more_options.dart @@ -101,8 +101,6 @@ class WorkspaceMenuMoreOptions extends StatelessWidget { WorkspaceMenuMoreOption.leave, ), ); - default: - return const Placeholder(); } } } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/mobile_bottom_navigation_bar.dart b/frontend/appflowy_flutter/lib/mobile/presentation/mobile_bottom_navigation_bar.dart index 4d8bc16103be1..170ef46ac23ec 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/mobile_bottom_navigation_bar.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/mobile_bottom_navigation_bar.dart @@ -365,14 +365,14 @@ class _NotificationNavigationBar extends StatelessWidget { extension on BuildContext { Color get backgroundColor { return Theme.of(this).isLightMode - ? Colors.white.withOpacity(0.95) - : const Color(0xFF23262B).withOpacity(0.95); + ? Colors.white.withValues(alpha: 0.95) + : const Color(0xFF23262B).withValues(alpha: 0.95); } Color get borderColor { return Theme.of(this).isLightMode ? const Color(0x141F2329) - : const Color(0xFF23262B).withOpacity(0.5); + : const Color(0xFF23262B).withValues(alpha: 0.5); } Border? get border { diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/notifications/widgets/color.dart b/frontend/appflowy_flutter/lib/mobile/presentation/notifications/widgets/color.dart index 8a59336378028..e11e91ada5860 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/notifications/widgets/color.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/notifications/widgets/color.dart @@ -6,6 +6,6 @@ extension NotificationItemColors on BuildContext { if (Theme.of(this).isLightMode) { return const Color(0xFF171717); } - return const Color(0xFFffffff).withOpacity(0.8); + return const Color(0xFFffffff).withValues(alpha: 0.8); } } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/appearance/rtl_setting.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/appearance/rtl_setting.dart index 8e1aceefaebfe..5b8035f0043d3 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/appearance/rtl_setting.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/appearance/rtl_setting.dart @@ -83,7 +83,6 @@ class RTLSetting extends StatelessWidget { case AppFlowyTextDirection.rtl: return LocaleKeys.settings_appearance_textDirection_rtl.tr(); case AppFlowyTextDirection.ltr: - default: return LocaleKeys.settings_appearance_textDirection_ltr.tr(); } } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_option_tile.dart b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_option_tile.dart index 4f76003e23b98..835b3b052fb90 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_option_tile.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_option_tile.dart @@ -299,7 +299,7 @@ class _Toggle extends StatelessWidget { fit: BoxFit.fill, child: CupertinoSwitch( value: value, - activeColor: Theme.of(context).colorScheme.primary, + activeTrackColor: Theme.of(context).colorScheme.primary, onChanged: onChanged, ), ), diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/show_flowy_mobile_confirm_dialog.dart b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/show_flowy_mobile_confirm_dialog.dart index 9df9d2e6fde91..96c18f5d91603 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/show_flowy_mobile_confirm_dialog.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/show_flowy_mobile_confirm_dialog.dart @@ -99,7 +99,7 @@ Future showFlowyCupertinoConfirmDialog({ }) { return showDialog( context: context ?? AppGlobals.context, - barrierColor: Colors.black.withOpacity(0.25), + barrierColor: Colors.black.withValues(alpha: 0.25), builder: (context) => CupertinoAlertDialog( title: FlowyText.medium( title, diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_editor_style.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_editor_style.dart index a979e80746e5c..b79e3c52c391b 100644 --- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_editor_style.dart +++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_editor_style.dart @@ -75,7 +75,8 @@ class ChatEditorStyleCustomizer extends EditorStyleCustomizer { fontSize: fontSize, fontWeight: FontWeight.normal, color: Colors.red, - backgroundColor: theme.colorScheme.inverseSurface.withOpacity(0.8), + backgroundColor: + theme.colorScheme.inverseSurface.withValues(alpha: 0.8), ), ), ), @@ -144,7 +145,7 @@ class ChatEditorStyleCustomizer extends EditorStyleCustomizer { return TextStyle( fontFamily: defaultFontFamily, height: 1.5, - color: AFThemeExtension.of(context).onBackground.withOpacity(0.6), + color: AFThemeExtension.of(context).onBackground.withValues(alpha: 0.6), ); } } diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_welcome_page.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_welcome_page.dart index 6c3dd4bd4dbb5..d7a90bd18afa8 100644 --- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_welcome_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_welcome_page.dart @@ -125,14 +125,14 @@ class WelcomeSampleQuestion extends StatelessWidget { spreadRadius: -2, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), BoxShadow( offset: const Offset(0, 2), blurRadius: 4, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), BoxShadow( offset: const Offset(0, 2), @@ -140,7 +140,7 @@ class WelcomeSampleQuestion extends StatelessWidget { spreadRadius: 2, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), ], ), diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart index 8fd3d615cadbc..ec1ef98393c63 100644 --- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart +++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_message_action_bar.dart @@ -88,14 +88,14 @@ class _AIMessageActionBarState extends State { spreadRadius: -2, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), BoxShadow( offset: const Offset(0, 2), blurRadius: 4, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), BoxShadow( offset: const Offset(0, 2), @@ -103,7 +103,7 @@ class _AIMessageActionBarState extends State { spreadRadius: 2, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), ], ), @@ -324,14 +324,14 @@ class _ChangeFormatPopoverContentState spreadRadius: -2, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), BoxShadow( offset: const Offset(0, 2), blurRadius: 4, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), BoxShadow( offset: const Offset(0, 2), @@ -339,7 +339,7 @@ class _ChangeFormatPopoverContentState spreadRadius: 2, color: isLightMode ? const Color(0x051F2329) - : Theme.of(context).shadowColor.withOpacity(0.02), + : Theme.of(context).shadowColor.withValues(alpha: 0.02), ), ], ), diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/scroll_to_bottom.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/scroll_to_bottom.dart index 0cfa2efe7bdab..d66a6665b378f 100644 --- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/scroll_to_bottom.dart +++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/scroll_to_bottom.dart @@ -41,21 +41,21 @@ class CustomScrollToBottom extends StatelessWidget { spreadRadius: 8, color: isLightMode ? const Color(0x0F1F2329) - : Theme.of(context).shadowColor.withOpacity(0.06), + : Theme.of(context).shadowColor.withValues(alpha: 0.06), ), BoxShadow( offset: const Offset(0, 4), blurRadius: 8, color: isLightMode ? const Color(0x141F2329) - : Theme.of(context).shadowColor.withOpacity(0.08), + : Theme.of(context).shadowColor.withValues(alpha: 0.08), ), BoxShadow( offset: const Offset(0, 2), blurRadius: 4, color: isLightMode ? const Color(0x1F1F2329) - : Theme.of(context).shadowColor.withOpacity(0.12), + : Theme.of(context).shadowColor.withValues(alpha: 0.12), ), ], ), diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart index b373e33b2f7d5..494455c3618db 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart @@ -1,9 +1,5 @@ import 'dart:io'; -import 'package:appflowy/util/field_type_extension.dart'; -import 'package:flutter/material.dart' hide Card; -import 'package:flutter/services.dart'; - import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/database/board/mobile_board_page.dart'; @@ -19,6 +15,7 @@ import 'package:appflowy/plugins/database/widgets/cell/card_cell_style_maps/desk import 'package:appflowy/plugins/database/widgets/row/row_detail.dart'; import 'package:appflowy/shared/conditional_listenable_builder.dart'; import 'package:appflowy/shared/flowy_error_page.dart'; +import 'package:appflowy/util/field_type_extension.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_board/appflowy_board.dart'; @@ -26,13 +23,14 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart'; +import 'package:flutter/material.dart' hide Card; +import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:universal_platform/universal_platform.dart'; import '../../widgets/card/card.dart'; import '../../widgets/cell/card_cell_builder.dart'; import '../application/board_bloc.dart'; - import 'toolbar/board_setting_bar.dart'; import 'widgets/board_focus_scope.dart'; import 'widgets/board_hidden_groups.dart'; @@ -714,19 +712,19 @@ class _BoardCardState extends State<_BoardCard> { .isFocused(GroupedRowId(rowId: rowId, groupId: groupId)) ? Theme.of(context).colorScheme.primary : Theme.of(context).brightness == Brightness.light - ? const Color(0xFF1F2329).withOpacity(0.12) + ? const Color(0xFF1F2329).withValues(alpha: 0.12) : const Color(0xFF59647A), ), ), boxShadow: [ BoxShadow( blurRadius: 4, - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), ), BoxShadow( blurRadius: 4, spreadRadius: -2, - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), ), ], ); diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_day.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_day.dart index de5648291e751..1d2838210df19 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_day.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_day.dart @@ -256,16 +256,16 @@ class NewEventButton extends StatelessWidget { boxShadow: [ BoxShadow( spreadRadius: -2, - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), blurRadius: 2, ), BoxShadow( - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), blurRadius: 4, ), BoxShadow( spreadRadius: 2, - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), blurRadius: 8, ), ], diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart index d4abb79a32ad0..eef6a34958702 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart @@ -1,24 +1,22 @@ -import 'package:appflowy/plugins/database/application/row/row_controller.dart'; -import 'package:appflowy/plugins/database/widgets/row/row_detail.dart'; -import 'package:flutter/material.dart'; - import 'package:appflowy/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.dart'; import 'package:appflowy/plugins/database/application/database_controller.dart'; import 'package:appflowy/plugins/database/application/row/row_cache.dart'; +import 'package:appflowy/plugins/database/application/row/row_controller.dart'; import 'package:appflowy/plugins/database/widgets/card/card.dart'; import 'package:appflowy/plugins/database/widgets/cell/card_cell_builder.dart'; import 'package:appflowy/plugins/database/widgets/cell/card_cell_style_maps/calendar_card_cell_style.dart'; +import 'package:appflowy/plugins/database/widgets/row/row_detail.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:flowy_infra/size.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; import 'package:universal_platform/universal_platform.dart'; import '../application/calendar_bloc.dart'; - import 'calendar_event_editor.dart'; class EventCard extends StatefulWidget { @@ -128,16 +126,16 @@ class _EventCardState extends State { boxShadow: [ BoxShadow( spreadRadius: -2, - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), blurRadius: 2, ), BoxShadow( - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), blurRadius: 4, ), BoxShadow( spreadRadius: 2, - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), blurRadius: 8, ), ], diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart index 19330221c6426..00fef716f85a0 100755 --- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart @@ -1,14 +1,12 @@ import 'dart:async'; -import 'package:appflowy/plugins/database/grid/presentation/widgets/toolbar/grid_setting_bar.dart'; -import 'package:appflowy/plugins/database/tab_bar/desktop/setting_menu.dart'; -import 'package:flutter/material.dart'; - import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/database/application/row/row_service.dart'; import 'package:appflowy/plugins/database/application/tab_bar_bloc.dart'; import 'package:appflowy/plugins/database/domain/sort_service.dart'; import 'package:appflowy/plugins/database/grid/presentation/widgets/calculations/calculations_row.dart'; +import 'package:appflowy/plugins/database/grid/presentation/widgets/toolbar/grid_setting_bar.dart'; +import 'package:appflowy/plugins/database/tab_bar/desktop/setting_menu.dart'; import 'package:appflowy/plugins/database/widgets/cell/editable_cell_builder.dart'; import 'package:appflowy/shared/flowy_error_page.dart'; import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart'; @@ -21,6 +19,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/scrolling/styled_scrollview.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:linked_scroll_controller/linked_scroll_controller.dart'; import 'package:provider/provider.dart'; @@ -30,7 +29,6 @@ import '../../application/row/row_controller.dart'; import '../../tab_bar/tab_bar_view.dart'; import '../../widgets/row/row_detail.dart'; import '../application/grid_bloc.dart'; - import 'grid_scroll.dart'; import 'layout/layout.dart'; import 'layout/sizes.dart'; @@ -474,7 +472,7 @@ class _GridRowsState extends State<_GridRows> { proxyDecorator: (child, _, __) => Provider.value( value: context.read(), child: Material( - color: Colors.white.withOpacity(.1), + color: Colors.white.withValues(alpha: .1), child: Opacity(opacity: .5, child: child), ), ), diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/footer/grid_footer.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/footer/grid_footer.dart index 1b973554cdd76..43a0301a10455 100755 --- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/footer/grid_footer.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/footer/grid_footer.dart @@ -1,5 +1,3 @@ -import 'package:flutter/material.dart'; - import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/database/grid/application/grid_bloc.dart'; @@ -9,6 +7,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/style_widget/button.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class GridAddRowButton extends StatelessWidget { @@ -17,8 +16,8 @@ class GridAddRowButton extends StatelessWidget { @override Widget build(BuildContext context) { final color = Theme.of(context).brightness == Brightness.light - ? const Color(0xFF171717).withOpacity(0.4) - : const Color(0xFFFFFFFF).withOpacity(0.4); + ? const Color(0xFF171717).withValues(alpha: 0.4) + : const Color(0xFFFFFFFF).withValues(alpha: 0.4); return FlowyButton( radius: BorderRadius.zero, decoration: BoxDecoration( @@ -66,8 +65,8 @@ class GridRowLoadMoreButton extends StatelessWidget { final padding = context.read().horizontalPadding; final color = Theme.of(context).brightness == Brightness.light - ? const Color(0xFF171717).withOpacity(0.4) - : const Color(0xFFFFFFFF).withOpacity(0.4); + ? const Color(0xFF171717).withValues(alpha: 0.4) + : const Color(0xFFFFFFFF).withValues(alpha: 0.4); return Container( padding: GridSize.footerContentInsets.copyWith(left: 0) + diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart index f0597c15e4fbf..23c2fe1f91d2c 100755 --- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart @@ -1,17 +1,16 @@ -import 'package:appflowy/shared/icon_emoji_picker/icon_picker.dart'; -import 'package:appflowy/util/theme_extension.dart'; -import 'package:flutter/material.dart'; - import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/plugins/database/application/field/field_cell_bloc.dart'; import 'package:appflowy/plugins/database/application/field/field_controller.dart'; import 'package:appflowy/plugins/database/application/field/field_info.dart'; import 'package:appflowy/plugins/database/widgets/field/field_editor.dart'; +import 'package:appflowy/shared/icon_emoji_picker/icon_picker.dart'; import 'package:appflowy/util/field_type_extension.dart'; +import 'package:appflowy/util/theme_extension.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../../layout/sizes.dart'; @@ -261,7 +260,7 @@ class FieldIcon extends StatelessWidget { return svgContent == null ? FlowySvg( fieldInfo.fieldType.svgData, - color: color.withOpacity(0.6), + color: color.withValues(alpha: 0.6), size: Size.square(dimension), ) : SizedBox.square( @@ -269,7 +268,7 @@ class FieldIcon extends StatelessWidget { child: Center( child: FlowySvg.string( svgContent, - color: color.withOpacity(0.45), + color: color.withValues(alpha: 0.45), size: Size.square(dimension - 2), ), ), diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart index 70786858456a2..e74f947b46fdd 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart @@ -1,6 +1,5 @@ -import 'package:flutter/material.dart'; - import 'package:flowy_infra_ui/style_widget/hover.dart'; +import 'package:flutter/material.dart'; enum AccessoryType { edit, @@ -45,7 +44,7 @@ class CardAccessoryContainer extends StatelessWidget { width: 1, thickness: 1, color: Theme.of(context).brightness == Brightness.light - ? const Color(0xFF1F2329).withOpacity(0.12) + ? const Color(0xFF1F2329).withValues(alpha: 0.12) : const Color(0xff59647a), ), ); @@ -77,19 +76,19 @@ class CardAccessoryContainer extends StatelessWidget { border: Border.fromBorderSide( BorderSide( color: Theme.of(context).brightness == Brightness.light - ? const Color(0xFF1F2329).withOpacity(0.12) + ? const Color(0xFF1F2329).withValues(alpha: 0.12) : const Color(0xff59647a), ), ), boxShadow: [ BoxShadow( blurRadius: 4, - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), ), BoxShadow( blurRadius: 4, spreadRadius: -2, - color: const Color(0xFF1F2329).withOpacity(0.02), + color: const Color(0xFF1F2329).withValues(alpha: 0.02), ), ], ); diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_media_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_media_cell.dart index 34d8a18ad84ce..6e648eb187330 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_media_cell.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_media_cell.dart @@ -202,7 +202,7 @@ class _FilePreviewFeedback extends StatelessWidget { decoration: BoxDecoration( boxShadow: [ BoxShadow( - color: const Color(0xFF1F2329).withOpacity(.2), + color: const Color(0xFF1F2329).withValues(alpha: .2), blurRadius: 6, offset: const Offset(0, 3), ), @@ -431,7 +431,8 @@ class _FilePreviewRenderState extends State<_FilePreviewRender> { Positioned.fill( child: DecoratedBox( position: DecorationPosition.foreground, - decoration: BoxDecoration(color: Colors.black.withOpacity(0.5)), + decoration: + BoxDecoration(color: Colors.black.withValues(alpha: 0.5)), child: child, ), ), @@ -543,7 +544,7 @@ class _FilePreviewRenderState extends State<_FilePreviewRender> { setState(() => isSelected = true); controller.show(); }, - fillColor: Colors.black.withOpacity(0.4), + fillColor: Colors.black.withValues(alpha: 0.4), width: 18, radius: BorderRadius.circular(4), icon: const FlowySvg( diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_banner.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_banner.dart index 243eb5f027797..5b77e93f8e60c 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_banner.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_banner.dart @@ -1,6 +1,3 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/application/page_style/document_page_style_bloc.dart'; @@ -31,6 +28,8 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/widget/rounded_button.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; import 'package:string_validator/string_validator.dart'; @@ -278,8 +277,10 @@ class _RowCoverState extends State { onPressed: () => popoverController.show(), hoverColor: Theme.of(context).colorScheme.surface, textColor: Theme.of(context).colorScheme.tertiary, - fillColor: - Theme.of(context).colorScheme.surface.withOpacity(0.5), + fillColor: Theme.of(context) + .colorScheme + .surface + .withValues(alpha: 0.5), title: LocaleKeys.document_plugins_cover_changeCover.tr(), ), ), diff --git a/frontend/appflowy_flutter/lib/plugins/database_document/database_document_plugin.dart b/frontend/appflowy_flutter/lib/plugins/database_document/database_document_plugin.dart index 07c2a4b5dc1ec..fd238271b782d 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_document/database_document_plugin.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_document/database_document_plugin.dart @@ -1,4 +1,4 @@ -library document_plugin; +library; import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/document_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/application/document_bloc.dart index e3d79a586869e..f3c810b112189 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/document_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/document_bloc.dart @@ -394,7 +394,7 @@ class DocumentBloc extends Bloc { final basicColor = ColorGenerator(id.toString()).toColor(); final metadata = DocumentAwarenessMetadata( cursorColor: basicColor.toHexString(), - selectionColor: basicColor.withOpacity(0.6).toHexString(), + selectionColor: basicColor.withValues(alpha: 0.6).toHexString(), userName: user.name, userAvatar: user.iconUrl, ); @@ -417,7 +417,7 @@ class DocumentBloc extends Bloc { final basicColor = ColorGenerator(id.toString()).toColor(); final metadata = DocumentAwarenessMetadata( cursorColor: basicColor.toHexString(), - selectionColor: basicColor.withOpacity(0.6).toHexString(), + selectionColor: basicColor.withValues(alpha: 0.6).toHexString(), userName: user.name, userAvatar: user.iconUrl, ); diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart b/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart index f9a80864f1497..574ae34af82e0 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart @@ -18,7 +18,6 @@ import 'package:appflowy_editor/appflowy_editor.dart' BulletedListBlockKeys, blockComponentDelta; import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart'; -import 'package:collection/collection.dart'; import 'package:nanoid/nanoid.dart'; class ExternalValues extends NodeExternalValues { @@ -105,7 +104,7 @@ extension DocumentDataPBFromTo on DocumentDataPB { final children = []; if (childrenIds != null && childrenIds.isNotEmpty) { - children.addAll(childrenIds.map((e) => buildNode(e)).whereNotNull()); + children.addAll(childrenIds.map((e) => buildNode(e)).nonNulls); } final node = block?.toNode( diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/editor_transaction_adapter.dart b/frontend/appflowy_flutter/lib/plugins/document/application/editor_transaction_adapter.dart index bbe671a8223d2..b789de3881b4c 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/editor_transaction_adapter.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/editor_transaction_adapter.dart @@ -113,7 +113,7 @@ class TransactionAdapter { ) { return transaction.operations .map((op) => op.toBlockAction(editorState, documentId)) - .whereNotNull() + .nonNulls .expand((element) => element) .toList(growable: false); // avoid lazy evaluation } diff --git a/frontend/appflowy_flutter/lib/plugins/document/document.dart b/frontend/appflowy_flutter/lib/plugins/document/document.dart index dcfc1906a373e..e172becb82aff 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/document.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/document.dart @@ -1,4 +1,4 @@ -library document_plugin; +library; import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart index d83bd055cef69..15a9a9fe6a7b0 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart @@ -356,7 +356,7 @@ class _AppFlowyEditorPageState extends State ), ), dropTargetStyle: AppFlowyDropTargetStyle( - color: Theme.of(context).colorScheme.primary.withOpacity(0.8), + color: Theme.of(context).colorScheme.primary.withValues(alpha: 0.8), margin: const EdgeInsets.only(left: 44), ), ), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/mobile_block_action_buttons.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/mobile_block_action_buttons.dart index 539dd313b149f..a04190f8af4a5 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/mobile_block_action_buttons.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/mobile_block_action_buttons.dart @@ -110,7 +110,6 @@ class MobileBlockActionButtons extends StatelessWidget { ), ); break; - default: } if (transaction.operations.isNotEmpty) { diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart index 09bdc06057882..cceac56c0d0a2 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart @@ -106,7 +106,7 @@ class _AlignmentButtonsState extends State<_AlignmentButtons> { child: FlowyButton( useIntrinsicWidth: true, text: widget.child, - hoverColor: Colors.grey.withOpacity(0.3), + hoverColor: Colors.grey.withValues(alpha: 0.3), onTap: () => controller.show(), ), ); @@ -167,7 +167,7 @@ class _AlignButton extends StatelessWidget { Widget build(BuildContext context) { return FlowyButton( useIntrinsicWidth: true, - hoverColor: Colors.grey.withOpacity(0.3), + hoverColor: Colors.grey.withValues(alpha: 0.3), onTap: onTap, text: FlowyTooltip( message: tooltips, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_upload_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_upload_menu.dart index 75f02f5079c4c..4ef680d1b989c 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_upload_menu.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_upload_menu.dart @@ -141,7 +141,8 @@ class _FileUploadLocalState extends State<_FileUploadLocal> { height: 32, child: FlowyButton( backgroundColor: Theme.of(context).colorScheme.primary, - hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.9), + hoverColor: + Theme.of(context).colorScheme.primary.withValues(alpha: 0.9), showDefaultBoxDecorationOnMobile: true, margin: const EdgeInsets.all(5), text: FlowyText( @@ -295,7 +296,7 @@ class _FileUploadNetworkState extends State<_FileUploadNetwork> { child: FlowyButton( backgroundColor: Theme.of(context).colorScheme.primary, hoverColor: - Theme.of(context).colorScheme.primary.withOpacity(0.9), + Theme.of(context).colorScheme.primary.withValues(alpha: 0.9), showDefaultBoxDecorationOnMobile: true, margin: const EdgeInsets.all(5), text: FlowyText( diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/mobile_file_upload_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/mobile_file_upload_menu.dart index f716c107df636..f4c7a76c0e99e 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/mobile_file_upload_menu.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/mobile_file_upload_menu.dart @@ -138,7 +138,7 @@ class _FileUploadLocalState extends State<_FileUploadLocal> { radius: Corners.s8Border, backgroundColor: Theme.of(context).colorScheme.primary, hoverColor: - Theme.of(context).colorScheme.primary.withOpacity(0.9), + Theme.of(context).colorScheme.primary.withValues(alpha: 0.9), margin: const EdgeInsets.all(5), text: FlowyText( LocaleKeys.document_plugins_file_uploadMobileGallery.tr(), @@ -155,7 +155,7 @@ class _FileUploadLocalState extends State<_FileUploadLocal> { radius: Corners.s8Border, backgroundColor: Theme.of(context).colorScheme.primary, hoverColor: - Theme.of(context).colorScheme.primary.withOpacity(0.9), + Theme.of(context).colorScheme.primary.withValues(alpha: 0.9), margin: const EdgeInsets.all(5), text: FlowyText( LocaleKeys.document_plugins_file_uploadMobile.tr(), @@ -241,7 +241,7 @@ class _FileUploadNetworkState extends State<_FileUploadNetwork> { child: FlowyButton( backgroundColor: Theme.of(context).colorScheme.primary, hoverColor: - Theme.of(context).colorScheme.primary.withOpacity(0.9), + Theme.of(context).colorScheme.primary.withValues(alpha: 0.9), radius: Corners.s8Border, margin: const EdgeInsets.all(5), text: FlowyText( diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/font/customize_font_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/font/customize_font_toolbar_item.dart index ef943a7ef7b92..d29732868165c 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/font/customize_font_toolbar_item.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/font/customize_font_toolbar_item.dart @@ -60,7 +60,7 @@ final customizeFontToolbarItem = ToolbarItem( child: FlowyButton( key: kFontFamilyToolbarItemKey, useIntrinsicWidth: true, - hoverColor: Colors.grey.withOpacity(0.3), + hoverColor: Colors.grey.withValues(alpha: 0.3), onTap: () => popoverController.show(), text: const FlowySvg( FlowySvgs.font_family_s, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_cover_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_cover_widget.dart index 3a827b7ce0946..5c061c2342d41 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_cover_widget.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_cover_widget.dart @@ -628,7 +628,7 @@ class DocumentCoverState extends State { fillColor: Theme.of(context) .colorScheme .onSurfaceVariant - .withOpacity(0.5), + .withValues(alpha: 0.5), height: 32, title: LocaleKeys.document_plugins_cover_changeCover.tr(), ), @@ -714,8 +714,10 @@ class DocumentCoverState extends State { onPressed: () => popoverController.show(), hoverColor: Theme.of(context).colorScheme.surface, textColor: Theme.of(context).colorScheme.tertiary, - fillColor: - Theme.of(context).colorScheme.surface.withOpacity(0.5), + fillColor: Theme.of(context) + .colorScheme + .surface + .withValues(alpha: 0.5), title: LocaleKeys.document_plugins_cover_changeCover.tr(), ), ), @@ -809,8 +811,8 @@ class DeleteCoverButton extends StatelessWidget { @override Widget build(BuildContext context) { final fillColor = UniversalPlatform.isDesktopOrWeb - ? Theme.of(context).colorScheme.surface.withOpacity(0.5) - : Theme.of(context).colorScheme.onSurfaceVariant.withOpacity(0.5); + ? Theme.of(context).colorScheme.surface.withValues(alpha: 0.5) + : Theme.of(context).colorScheme.onSurfaceVariant.withValues(alpha: 0.5); final svgColor = UniversalPlatform.isDesktopOrWeb ? Theme.of(context).colorScheme.tertiary : Theme.of(context).colorScheme.onPrimary; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/emoji_icon_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/emoji_icon_widget.dart index f6bf031c9d940..36645e1afb5ca 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/emoji_icon_widget.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/emoji_icon_widget.dart @@ -35,7 +35,10 @@ class _EmojiIconWidgetState extends State { child: Container( decoration: BoxDecoration( color: !hover - ? Theme.of(context).colorScheme.inverseSurface.withOpacity(0.5) + ? Theme.of(context) + .colorScheme + .inverseSurface + .withValues(alpha: 0.5) : Colors.transparent, borderRadius: BorderRadius.circular(8), ), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/heading/heading_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/heading/heading_toolbar_item.dart index c5e1758435c61..3d0c199ea24ba 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/heading/heading_toolbar_item.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/heading/heading_toolbar_item.dart @@ -140,7 +140,7 @@ class HeadingPopup extends StatelessWidget { }, child: FlowyButton( useIntrinsicWidth: true, - hoverColor: Colors.grey.withOpacity(0.3), + hoverColor: Colors.grey.withValues(alpha: 0.3), text: child, ), ); @@ -209,7 +209,7 @@ class HeadingButton extends StatelessWidget { Widget build(BuildContext context) { return FlowyButton( useIntrinsicWidth: true, - hoverColor: Colors.grey.withOpacity(0.3), + hoverColor: Colors.grey.withValues(alpha: 0.3), onTap: onTap, text: FlowyTooltip( message: tooltip, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart index 21caa81297ada..cbc2de8e507f0 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/image_menu.dart @@ -59,7 +59,7 @@ class _ImageMenuState extends State { BoxShadow( blurRadius: 5, spreadRadius: 1, - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ], borderRadius: BorderRadius.circular(4.0), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart index 1105480bf3ee1..3f5a78565ecc8 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart @@ -1,8 +1,5 @@ import 'dart:io'; -import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart'; -import 'package:flutter/material.dart'; - import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/document/application/document_bloc.dart'; @@ -12,6 +9,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/image/mult import 'package:appflowy/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_block_component.dart'; import 'package:appflowy/shared/appflowy_network_image.dart'; import 'package:appflowy/shared/patterns/file_type_patterns.dart'; +import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart'; import 'package:appflowy/workspace/presentation/widgets/image_viewer/image_provider.dart'; import 'package:appflowy/workspace/presentation/widgets/image_viewer/interactive_image_viewer.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; @@ -24,6 +22,7 @@ import 'package:flowy_infra_ui/style_widget/hover.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; import 'package:flowy_infra_ui/widget/flowy_tooltip.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; +import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../image_render.dart'; @@ -136,7 +135,8 @@ class _ImageBrowserLayoutState extends State { ), DecoratedBox( decoration: BoxDecoration( - color: Colors.white.withOpacity(0.5), + color: + Colors.white.withValues(alpha: 0.5), ), child: Center( child: FlowyText( @@ -225,8 +225,9 @@ class _ImageBrowserLayoutState extends State { ? const SizedBox.shrink() : SizedBox.expand( child: DecoratedBox( - decoration: - BoxDecoration(color: Colors.white.withOpacity(0.5)), + decoration: BoxDecoration( + color: Colors.white.withValues(alpha: 0.5), + ), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -386,8 +387,8 @@ class _ThumbnailItemState extends State { child: FlowyHover( resetHoverOnRebuild: false, style: HoverStyle( - backgroundColor: Colors.black.withOpacity(0.6), - hoverColor: Colors.black.withOpacity(0.9), + backgroundColor: Colors.black.withValues(alpha: 0.6), + hoverColor: Colors.black.withValues(alpha: 0.9), ), child: const Padding( padding: EdgeInsets.all(4), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/multi_image_layouts.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/multi_image_layouts.dart index 00919a20cc0ad..43d1c7ae36d6c 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/multi_image_layouts.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/multi_image_layouts.dart @@ -1,10 +1,9 @@ -import 'package:flutter/material.dart'; - import 'package:appflowy/plugins/document/presentation/editor_plugins/image/common.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_browser_layout.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/image/multi_image_block_component/layouts/image_grid_layout.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_block_component.dart'; import 'package:appflowy_editor/appflowy_editor.dart' hide ResizableImage; +import 'package:flutter/material.dart'; abstract class ImageBlockMultiLayout extends StatefulWidget { const ImageBlockMultiLayout({ @@ -65,7 +64,6 @@ class ImageLayoutRender extends StatelessWidget { isLocalMode: isLocalMode, ); case MultiImageLayout.browser: - default: return ImageBrowserLayout( node: node, editorState: editorState, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_menu.dart index 8abeaf9e99de3..52bb41fd847d8 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_menu.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_menu.dart @@ -1,8 +1,5 @@ import 'dart:io'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/document/application/document_bloc.dart'; @@ -25,6 +22,8 @@ import 'package:flowy_infra/size.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:http/http.dart'; import 'package:path/path.dart' as p; import 'package:provider/provider.dart'; @@ -103,7 +102,7 @@ class _MultiImageMenuState extends State { BoxShadow( blurRadius: 5, spreadRadius: 1, - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ], borderRadius: BorderRadius.circular(4.0), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart index 021476aa4e4d3..42fc0c56b007f 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart @@ -228,7 +228,7 @@ class _ResizableImageState extends State { child: Container( height: 40, decoration: BoxDecoration( - color: Colors.black.withOpacity(0.5), + color: Colors.black.withValues(alpha: 0.5), borderRadius: const BorderRadius.all( Radius.circular(5.0), ), @@ -264,7 +264,7 @@ class _ImageLoadFailedWidget extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: 8.0), decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(4.0)), - border: Border.all(color: Colors.grey.withOpacity(0.6)), + border: Border.all(color: Colors.grey.withValues(alpha: 0.6)), ), child: Column( mainAxisSize: MainAxisSize.min, @@ -282,7 +282,7 @@ class _ImageLoadFailedWidget extends StatelessWidget { FlowyText( error, textAlign: TextAlign.center, - color: Theme.of(context).hintColor.withOpacity(0.6), + color: Theme.of(context).hintColor.withValues(alpha: 0.6), fontSize: 10, maxLines: 2, ), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/upload_image_menu/widgets/embed_image_url_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/upload_image_menu/widgets/embed_image_url_widget.dart index caddbf464af6d..28dccad72d2dc 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/upload_image_menu/widgets/embed_image_url_widget.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/upload_image_menu/widgets/embed_image_url_widget.dart @@ -57,7 +57,8 @@ class _EmbedImageUrlWidgetState extends State { width: 300, child: FlowyButton( backgroundColor: Theme.of(context).colorScheme.primary, - hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.9), + hoverColor: + Theme.of(context).colorScheme.primary.withValues(alpha: 0.9), showDefaultBoxDecorationOnMobile: true, radius: UniversalPlatform.isMobile ? BorderRadius.circular(8) : null, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/link_preview/link_preview_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/link_preview/link_preview_menu.dart index 61e5156060b45..cf7d72cc2a56e 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/link_preview/link_preview_menu.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/link_preview/link_preview_menu.dart @@ -39,7 +39,7 @@ class _LinkPreviewMenuState extends State { BoxShadow( blurRadius: 5, spreadRadius: 1, - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ], borderRadius: BorderRadius.circular(4.0), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_block.dart index a5bc340f713e5..d65609f1a8f01 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_block.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_block.dart @@ -124,8 +124,6 @@ class MentionBlock extends StatelessWidget { reminderOption: reminderOption ?? ReminderOption.none, includeTime: mention[MentionBlockKeys.includeTime] ?? false, ); - default: - return const SizedBox.shrink(); } } } diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_color_list.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_color_list.dart index d3d4c5daa9624..6ec777429c514 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_color_list.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_color_list.dart @@ -86,7 +86,7 @@ class _TextColorAndBackgroundColorState EditorTextColorWidget( selectedColor: selectedTextColor?.tryToColor(), onSelectedColor: (textColor) async { - final hex = textColor.alpha == 0 ? null : textColor.toHex(); + final hex = textColor.a == 0 ? null : textColor.toHex(); final selection = widget.selection; if (selection.isCollapsed) { widget.editorState.updateToggledStyle( @@ -123,8 +123,7 @@ class _TextColorAndBackgroundColorState EditorBackgroundColors( selectedColor: selectedBackgroundColor?.tryToColor(), onSelectedColor: (backgroundColor) async { - final hex = - backgroundColor.alpha == 0 ? null : backgroundColor.toHex(); + final hex = backgroundColor.a == 0 ? null : backgroundColor.toHex(); final selection = widget.selection; if (selection.isCollapsed) { widget.editorState.updateToggledStyle( @@ -296,7 +295,7 @@ class _TextColorItem extends StatelessWidget { child: FlowyText( 'A', fontSize: 24, - color: color.alpha == 0 ? null : color, + color: color.a == 0 ? null : color, ), ), ); diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_cell_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_cell_block_component.dart index 376ed90069336..112343c6d8b41 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_cell_block_component.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_cell_block_component.dart @@ -468,7 +468,7 @@ class SimpleTableCellBlockWidgetState extends State final isSelectingTable = simpleTableContext?.isSelectingTable.value ?? false; if (isSelectingTable) { - return Theme.of(context).colorScheme.primary.withOpacity(0.1); + return Theme.of(context).colorScheme.primary.withValues(alpha: 0.1); } final columnColor = node.buildColumnColor(context); diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_constants.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_constants.dart index 6bdbcd516a6b1..79201b38faa47 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_constants.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_constants.dart @@ -294,7 +294,7 @@ extension SimpleTableColors on BuildContext { Color get simpleTableDividerColor => Theme.of(this).isLightMode ? const Color(0x141F2329) - : const Color(0xFF23262B).withOpacity(0.5); + : const Color(0xFF23262B).withValues(alpha: 0.5); Color get simpleTableMoreActionBackgroundColor => Theme.of(this).isLightMode ? const Color(0xFFF2F3F5) diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_more_action.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_more_action.dart index be82ee3627777..4906ed85eb74e 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_more_action.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_more_action.dart @@ -412,7 +412,9 @@ class SimpleTableActionMenu extends StatelessWidget { editorState.service.keyboardService?.closeKeyboard(); // delay the bottom sheet show to make sure the keyboard is closed Future.delayed(Durations.short3, () { - _showTableActionBottomSheet(context); + if (context.mounted) { + _showTableActionBottomSheet(context); + } }); }, child: Container( diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/_simple_table_bottom_sheet_actions.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/_simple_table_bottom_sheet_actions.dart index aae1acb68b4c8..b81ff89ee83fd 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/_simple_table_bottom_sheet_actions.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/_simple_table_bottom_sheet_actions.dart @@ -622,7 +622,7 @@ class _SimpleTableHeaderActionButtonState fit: BoxFit.fill, child: CupertinoSwitch( value: value, - activeColor: Theme.of(context).colorScheme.primary, + activeTrackColor: Theme.of(context).colorScheme.primary, onChanged: (_) => _toggle(), ), ), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_bottom_sheet.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_bottom_sheet.dart index 644aae1926c4e..97519422ece55 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_bottom_sheet.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_bottom_sheet.dart @@ -264,7 +264,7 @@ class _SimpleTableCellBottomSheetState } void _onTextColorSelected(Color color) { - final hex = color.alpha == 0 ? null : color.toHex(); + final hex = color.a == 0 ? null : color.toHex(); switch (widget.type) { case SimpleTableMoreActionType.column: widget.editorState.updateColumnTextColor( @@ -284,7 +284,7 @@ class _SimpleTableCellBottomSheetState } void _onCellBackgroundColorSelected(Color color) { - final hex = color.alpha == 0 ? null : color.toHex(); + final hex = color.a == 0 ? null : color.toHex(); switch (widget.type) { case SimpleTableMoreActionType.column: widget.editorState.updateColumnBackgroundColor( diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/sub_page/block_transaction_handler.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/sub_page/block_transaction_handler.dart index 35ff1f219bf04..a549e87f834e9 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/sub_page/block_transaction_handler.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/sub_page/block_transaction_handler.dart @@ -1,5 +1,3 @@ -import 'package:flutter/material.dart'; - import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/application/mobile_router.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/block_transaction_handler/block_transaction_handler.dart'; @@ -14,6 +12,7 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/style_widget/snap_bar.dart'; +import 'package:flutter/material.dart'; import 'package:universal_platform/universal_platform.dart'; class SubPageBlockTransactionHandler extends BlockTransactionHandler { @@ -162,7 +161,9 @@ class SubPageBlockTransactionHandler extends BlockTransactionHandler { if (UniversalPlatform.isDesktop) { getIt().openPlugin(view); } else { - await context.pushView(view); + if (context.mounted) { + await context.pushView(view); + } } }); }, diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart index 31377a93b7583..130f9a9ca1570 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart @@ -111,7 +111,8 @@ class EditorStyleCustomizer { fontSize: fontSize, fontWeight: FontWeight.normal, color: Colors.red, - backgroundColor: theme.colorScheme.inverseSurface.withOpacity(0.8), + backgroundColor: + theme.colorScheme.inverseSurface.withValues(alpha: 0.8), ), ), ), @@ -159,7 +160,7 @@ class EditorStyleCustomizer { fontSize: fontSize, fontWeight: FontWeight.normal, color: Colors.red, - backgroundColor: Colors.grey.withOpacity(0.3), + backgroundColor: Colors.grey.withValues(alpha: 0.3), ), ), applyHeightToFirstAscent: true, @@ -241,7 +242,7 @@ class EditorStyleCustomizer { fontFamily: defaultFontFamily, fontSize: fontSize, height: 1.5, - color: AFThemeExtension.of(context).onBackground.withOpacity(0.6), + color: AFThemeExtension.of(context).onBackground.withValues(alpha: 0.6), ); } @@ -281,7 +282,7 @@ class EditorStyleCustomizer { final afThemeExtension = AFThemeExtension.of(context); return InlineActionsMenuStyle( backgroundColor: theme.cardColor, - groupTextColor: afThemeExtension.onBackground.withOpacity(.8), + groupTextColor: afThemeExtension.onBackground.withValues(alpha: .8), menuItemTextColor: afThemeExtension.onBackground, menuItemSelectedColor: theme.colorScheme.secondary, menuItemSelectedTextColor: theme.colorScheme.onSurface, @@ -470,7 +471,7 @@ class EditorStyleCustomizer { padding: const EdgeInsets.symmetric(vertical: 4.0), child: FlowyHover( style: HoverStyle( - hoverColor: Colors.grey.withOpacity(0.3), + hoverColor: Colors.grey.withValues(alpha: 0.3), ), child: child, ), diff --git a/frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_handler.dart b/frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_handler.dart index be9a6c2f5fc6b..63ccb048393cc 100644 --- a/frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_handler.dart +++ b/frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_handler.dart @@ -165,7 +165,7 @@ class _InlineActionsHandlerState extends State { BoxShadow( blurRadius: 5, spreadRadius: 1, - color: Colors.black.withOpacity(0.1), + color: Colors.black.withValues(alpha: 0.1), ), ], ), diff --git a/frontend/appflowy_flutter/lib/plugins/shared/share/export_tab.dart b/frontend/appflowy_flutter/lib/plugins/shared/share/export_tab.dart index ff95fe6acc90a..bf0b7fee2601c 100644 --- a/frontend/appflowy_flutter/lib/plugins/shared/share/export_tab.dart +++ b/frontend/appflowy_flutter/lib/plugins/shared/share/export_tab.dart @@ -198,7 +198,7 @@ class _ExportButton extends StatelessWidget { Widget build(BuildContext context) { final color = Theme.of(context).isLightMode ? const Color(0x1E14171B) - : Colors.white.withOpacity(0.1); + : Colors.white.withValues(alpha: 0.1); final radius = BorderRadius.circular(10.0); return FlowyButton( margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 14), diff --git a/frontend/appflowy_flutter/lib/plugins/shared/share/publish_color_extension.dart b/frontend/appflowy_flutter/lib/plugins/shared/share/publish_color_extension.dart index 960f59b07de6e..1c957016e463b 100644 --- a/frontend/appflowy_flutter/lib/plugins/shared/share/publish_color_extension.dart +++ b/frontend/appflowy_flutter/lib/plugins/shared/share/publish_color_extension.dart @@ -5,7 +5,7 @@ class ShareMenuColors { static Color borderColor(BuildContext context) { final borderColor = Theme.of(context).isLightMode ? const Color(0x1E14171B) - : Colors.white.withOpacity(0.1); + : Colors.white.withValues(alpha: 0.1); return borderColor; } } diff --git a/frontend/appflowy_flutter/lib/plugins/shared/share/publish_tab.dart b/frontend/appflowy_flutter/lib/plugins/shared/share/publish_tab.dart index 68d1918c7f319..1f754a4372e70 100644 --- a/frontend/appflowy_flutter/lib/plugins/shared/share/publish_tab.dart +++ b/frontend/appflowy_flutter/lib/plugins/shared/share/publish_tab.dart @@ -217,7 +217,7 @@ class _PublishedWidgetState extends State<_PublishedWidget> { title: LocaleKeys.shareAction_visitSite.tr(), borderRadius: const BorderRadius.all(Radius.circular(10)), fillColor: Theme.of(context).colorScheme.primary, - hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.9), + hoverColor: Theme.of(context).colorScheme.primary.withValues(alpha: 0.9), textColor: Theme.of(context).colorScheme.onPrimary, ); } @@ -508,7 +508,7 @@ class _PublishDatabaseSelector extends StatefulWidget { class _PublishDatabaseSelectorState extends State<_PublishDatabaseSelector> { final PropertyValueNotifier> _databaseStatus = PropertyValueNotifier>([]); - late final _borderColor = Theme.of(context).hintColor.withOpacity(0.3); + late final _borderColor = Theme.of(context).hintColor.withValues(alpha: 0.3); @override void initState() { diff --git a/frontend/appflowy_flutter/lib/shared/icon_emoji_picker/colors.dart b/frontend/appflowy_flutter/lib/shared/icon_emoji_picker/colors.dart index 8728c3be4a6b1..40b9c1d6fa6f6 100644 --- a/frontend/appflowy_flutter/lib/shared/icon_emoji_picker/colors.dart +++ b/frontend/appflowy_flutter/lib/shared/icon_emoji_picker/colors.dart @@ -5,7 +5,7 @@ extension PickerColors on BuildContext { Color get pickerTextColor { return Theme.of(this).isLightMode ? const Color(0x80171717) - : Colors.white.withOpacity(0.5); + : Colors.white.withValues(alpha: 0.5); } Color get pickerIconColor { @@ -15,12 +15,12 @@ extension PickerColors on BuildContext { Color get pickerSearchBarBorderColor { return Theme.of(this).isLightMode ? const Color(0x1E171717) - : Colors.white.withOpacity(0.12); + : Colors.white.withValues(alpha: 0.12); } Color get pickerButtonBoarderColor { return Theme.of(this).isLightMode ? const Color(0x1E171717) - : Colors.white.withOpacity(0.12); + : Colors.white.withValues(alpha: 0.12); } } diff --git a/frontend/appflowy_flutter/lib/shared/popup_menu/appflowy_popup_menu.dart b/frontend/appflowy_flutter/lib/shared/popup_menu/appflowy_popup_menu.dart index 1e9aa1a3c3d41..786d666060aed 100644 --- a/frontend/appflowy_flutter/lib/shared/popup_menu/appflowy_popup_menu.dart +++ b/frontend/appflowy_flutter/lib/shared/popup_menu/appflowy_popup_menu.dart @@ -1613,7 +1613,7 @@ class _PopupMenuDefaultsM3 extends PopupMenuThemeData { return WidgetStateProperty.resolveWith((Set states) { final TextStyle style = _textTheme.labelLarge!; if (states.contains(WidgetState.disabled)) { - return style.apply(color: _colors.onSurface.withOpacity(0.38)); + return style.apply(color: _colors.onSurface.withValues(alpha: 0.38)); } return style.apply(color: _colors.onSurface); }); diff --git a/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart b/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart index 920a994927baf..5bb08e3fdfe7b 100644 --- a/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart +++ b/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart @@ -1,4 +1,4 @@ -library flowy_plugin; +library; import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/startup/plugin/plugin.dart'; diff --git a/frontend/appflowy_flutter/lib/util/color_to_hex_string.dart b/frontend/appflowy_flutter/lib/util/color_to_hex_string.dart index 34925235cbaac..61694367bb8ab 100644 --- a/frontend/appflowy_flutter/lib/util/color_to_hex_string.dart +++ b/frontend/appflowy_flutter/lib/util/color_to_hex_string.dart @@ -5,12 +5,17 @@ import 'package:flutter/material.dart'; extension ColorExtension on Color { /// return a hex string in 0xff000000 format String toHexString() { - return '0x${value.toRadixString(16).padLeft(8, '0')}'; + final alpha = (a * 255).toInt().toRadixString(16).padLeft(2, '0'); + final red = (r * 255).toInt().toRadixString(16).padLeft(2, '0'); + final green = (g * 255).toInt().toRadixString(16).padLeft(2, '0'); + final blue = (b * 255).toInt().toRadixString(16).padLeft(2, '0'); + + return '0x$alpha$red$green$blue'.toLowerCase(); } /// return a random color static Color random({double opacity = 1.0}) { return Color((math.Random().nextDouble() * 0xFFFFFF).toInt()) - .withOpacity(opacity); + .withValues(alpha: opacity); } } diff --git a/frontend/appflowy_flutter/lib/workspace/application/appearance_defaults.dart b/frontend/appflowy_flutter/lib/workspace/application/appearance_defaults.dart index d900afd6eb838..c3190a8e40496 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/appearance_defaults.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/appearance_defaults.dart @@ -1,7 +1,6 @@ -import 'package:flutter/material.dart'; - import 'package:appflowy/workspace/application/settings/appearance/base_appearance.dart'; import 'package:flowy_infra/theme.dart'; +import 'package:flutter/material.dart'; /// A class for the default appearance settings for the app class DefaultAppearanceSettings { @@ -15,6 +14,6 @@ class DefaultAppearanceSettings { } static Color getDefaultSelectionColor(BuildContext context) { - return Theme.of(context).colorScheme.primary.withOpacity(0.2); + return Theme.of(context).colorScheme.primary.withValues(alpha: 0.2); } } diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/appearance_cubit.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/appearance_cubit.dart index 37027bcf385b2..b64ef7d5b8d39 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/appearance_cubit.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/appearance_cubit.dart @@ -309,7 +309,6 @@ ThemeModePB _themeModeToPB(ThemeMode themeMode) { case ThemeMode.dark: return ThemeModePB.Dark; case ThemeMode.system: - default: return ThemeModePB.System; } } @@ -358,8 +357,6 @@ enum AppFlowyTextDirection { return TextDirectionPB.RTL; case AppFlowyTextDirection.auto: return TextDirectionPB.AUTO; - default: - return TextDirectionPB.FALLBACK; } } } diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/mobile_appearance.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/mobile_appearance.dart index 63235ba217a25..6aa649d3202bf 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/mobile_appearance.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/mobile_appearance.dart @@ -49,7 +49,7 @@ class MobileAppearance extends BaseAppearance { error: const Color(0xffFB006D), onError: const Color(0xffFB006D), outline: const Color(0xffe3e3e3), - outlineVariant: const Color(0xffCBD5E0).withOpacity(0.24), + outlineVariant: const Color(0xffCBD5E0).withValues(alpha: 0.24), //Snack bar surface: Colors.white, onSurface: _onSurfaceColor, // text/body color diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/settings_shortcuts_service.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/settings_shortcuts_service.dart index 25b51c9a81499..af95d5af5a061 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/settings_shortcuts_service.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/settings_shortcuts_service.dart @@ -53,8 +53,8 @@ class SettingsShortcutService { } } - /// Extracts shortcuts from the saved json file. The shortcuts in the saved file consist of [List]. - /// This list needs to be converted to List. This function is intended to facilitate the same. + // Extracts shortcuts from the saved json file. The shortcuts in the saved file consist of [List]. + // This list needs to be converted to List. This function is intended to facilitate the same. List getShortcutsFromJson(String savedJson) { final shortcuts = EditorShortcuts.fromJson(jsonDecode(savedJson)); return shortcuts.commandShortcuts; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/recent_view_tile.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/recent_view_tile.dart index deb401ea5c482..000de7c9db28b 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/recent_view_tile.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/recent_view_tile.dart @@ -33,8 +33,8 @@ class RecentViewTile extends StatelessWidget { ), ], ), - focusColor: Theme.of(context).colorScheme.primary.withOpacity(0.1), - hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.1), + focusColor: Theme.of(context).colorScheme.primary.withValues(alpha: 0.1), + hoverColor: Theme.of(context).colorScheme.primary.withValues(alpha: 0.1), onTap: () { onSelected(); diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_tile.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_tile.dart index 1db18b77fb9c4..5f26f0759731a 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_tile.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_tile.dart @@ -82,7 +82,8 @@ class _SearchResultTileState extends State { child: FlowyHover( isSelected: () => _hasFocus, style: HoverStyle( - hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.1), + hoverColor: + Theme.of(context).colorScheme.primary.withValues(alpha: 0.1), foregroundColorOnHover: AFThemeExtension.of(context).textColor, ), child: Padding( diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart index 6c9c2faebf958..6a01b163977e1 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart @@ -326,7 +326,7 @@ class _SecondaryViewState extends State ? const Color(0x1F1F2329) : Theme.of(context) .shadowColor - .withOpacity(0.08), + .withValues(alpha: 0.08), ), ], ), diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/footer/sidebar_toast.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/footer/sidebar_toast.dart index 6d2b93be45216..5e1a6f90e0586 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/footer/sidebar_toast.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/footer/sidebar_toast.dart @@ -174,8 +174,8 @@ class _PlanIndicatorState extends State { begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - const Color(0xFF8032FF).withOpacity(.1), - const Color(0xFFEF35FF).withOpacity(.1), + const Color(0xFF8032FF).withValues(alpha: .1), + const Color(0xFFEF35FF).withValues(alpha: .1), ], ); diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/import/import_panel.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/import/import_panel.dart index 6a23c7def989e..716002e91745e 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/import/import_panel.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/import/import_panel.dart @@ -204,8 +204,6 @@ class _ImportPanelState extends State { ..importType = ImportTypePB.AFDatabase, ); break; - default: - break; } } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart index 7afb4a6298c23..9b279cc11a889 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart @@ -250,16 +250,16 @@ enum ConfirmPopupStyle { class ConfirmPopupColor { static Color titleColor(BuildContext context) { if (Theme.of(context).isLightMode) { - return const Color(0xFF171717).withOpacity(0.8); + return const Color(0xFF171717).withValues(alpha: 0.8); } - return const Color(0xFFffffff).withOpacity(0.8); + return const Color(0xFFffffff).withValues(alpha: 0.8); } static Color descriptionColor(BuildContext context) { if (Theme.of(context).isLightMode) { - return const Color(0xFF171717).withOpacity(0.7); + return const Color(0xFF171717).withValues(alpha: 0.7); } - return const Color(0xFFffffff).withOpacity(0.7); + return const Color(0xFFffffff).withValues(alpha: 0.7); } } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart index f3038c0bec74c..ff393a8305b06 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart @@ -370,7 +370,7 @@ class _CreateWorkspaceButton extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), border: Border.all( - color: const Color(0x01717171).withOpacity(0.12), + color: const Color(0x01717171).withValues(alpha: 0.12), width: 0.8, ), ), @@ -438,7 +438,7 @@ class _ImportNotionButton extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), border: Border.all( - color: const Color(0x01717171).withOpacity(0.12), + color: const Color(0x01717171).withValues(alpha: 0.12), width: 0.8, ), ), diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/draggable_view_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/draggable_view_item.dart index 2b27024cffe3f..c604fae432616 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/draggable_view_item.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/draggable_view_item.dart @@ -111,7 +111,8 @@ class _DraggableViewItemState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(6.0), color: position == DraggableHoverPosition.center - ? widget.centerHighlightColor ?? hoverColor.withOpacity(0.5) + ? widget.centerHighlightColor ?? + hoverColor.withValues(alpha: 0.5) : Colors.transparent, ), child: widget.child, @@ -150,7 +151,10 @@ class _DraggableViewItemState extends State { borderRadius: BorderRadius.circular(4.0), color: position == DraggableHoverPosition.center ? widget.centerHighlightColor ?? - Theme.of(context).colorScheme.secondary.withOpacity(0.5) + Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.5) : Colors.transparent, ), child: widget.child, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/account_deletion.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/account_deletion.dart index 6f1c4920cb756..9b2f75ddd072e 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/account_deletion.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/account/account_deletion.dart @@ -76,7 +76,8 @@ class _AccountDeletionButtonState extends State { padding: const EdgeInsets.symmetric(horizontal: 26, vertical: 10), fillColor: Colors.transparent, radius: Corners.s8Border, - hoverColor: Theme.of(context).colorScheme.error.withOpacity(0.1), + hoverColor: + Theme.of(context).colorScheme.error.withValues(alpha: 0.1), fontColor: Theme.of(context).colorScheme.error, fontSize: 12, isDangerous: true, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_plan_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_plan_view.dart index 22306501643e0..bf1e479226da9 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_plan_view.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_plan_view.dart @@ -602,8 +602,8 @@ class _PlanProgressIndicator extends StatelessWidget { borderRadius: BorderRadius.circular(8), color: AFThemeExtension.of(context).progressBarBGColor, border: Border.all( - color: const Color(0xFFDDF1F7).withOpacity( - theme.brightness == Brightness.light ? 1 : 0.1, + color: const Color(0xFFDDF1F7).withValues( + alpha: theme.brightness == Brightness.light ? 1 : 0.1, ), ), ), @@ -673,7 +673,7 @@ class _AddOnBox extends StatelessWidget { border: Border.all( color: isActive ? const Color(0xFFBDBDBD) : const Color(0xFF9C00FB), ), - color: const Color(0xFFF7F8FC).withOpacity(0.05), + color: const Color(0xFFF7F8FC).withValues(alpha: 0.05), borderRadius: BorderRadius.circular(16), ), child: Column( diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart index 87ea9d9260392..74496fd1d1624 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart @@ -481,7 +481,7 @@ class KeyBadge extends StatelessWidget { borderRadius: Corners.s4Border, boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.25), + color: Colors.black.withValues(alpha: 0.25), blurRadius: 1, offset: const Offset(0, 1), ), diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart index ab8d5ee078394..1cfc83339859c 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart @@ -1090,9 +1090,11 @@ class _FontListPopupState extends State<_FontListPopup> { hoverColor: Theme.of(context) .colorScheme .onSurface - .withOpacity(0.12), - selectedTileColor: - Theme.of(context).colorScheme.primary.withOpacity(0.12), + .withValues(alpha: 0.12), + selectedTileColor: Theme.of(context) + .colorScheme + .primary + .withValues(alpha: 0.12), contentPadding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4), minTileHeight: 0, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/sites/domain/domain_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/sites/domain/domain_item.dart index 2ac7814de4679..8f9df5f1b6590 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/sites/domain/domain_item.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/sites/domain/domain_item.dart @@ -249,7 +249,7 @@ class _FreePlanUpgradeButton extends StatelessWidget { horizontal: 8.0, vertical: 6.0, ), - hoverColor: context.proSecondaryColor.withOpacity(0.9), + hoverColor: context.proSecondaryColor.withValues(alpha: 0.9), onTap: () { if (isOwner) { showToastNotification( 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 84ba87144b058..45444d897c71d 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart @@ -170,8 +170,6 @@ class SettingsDialog extends StatelessWidget { ); case SettingsPage.featureFlags: return const FeatureFlagsPage(); - default: - return const SizedBox.shrink(); } } } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/flowy_gradient_button.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/flowy_gradient_button.dart index eb39df8b32c19..68556f82944a8 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/flowy_gradient_button.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/flowy_gradient_button.dart @@ -1,6 +1,5 @@ -import 'package:flutter/material.dart'; - import 'package:flowy_infra_ui/style_widget/text.dart'; +import 'package:flutter/material.dart'; class FlowyGradientButton extends StatefulWidget { const FlowyGradientButton({ @@ -49,7 +48,7 @@ class _FlowyGradientButtonState extends State { boxShadow: [ BoxShadow( blurRadius: 4, - color: Colors.black.withOpacity(0.25), + color: Colors.black.withValues(alpha: 0.25), offset: const Offset(0, 2), ), ], diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/settings_dropdown.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/settings_dropdown.dart index 56d2c8d2cc6e6..3b2e8832109b6 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/settings_dropdown.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/settings_dropdown.dart @@ -61,7 +61,7 @@ class _SettingsDropdownState extends State> { const WidgetStatePropertyAll(Size(double.infinity, 250)), elevation: const WidgetStatePropertyAll(10), shadowColor: - WidgetStatePropertyAll(Colors.black.withOpacity(0.4)), + WidgetStatePropertyAll(Colors.black.withValues(alpha: 0.4)), backgroundColor: WidgetStatePropertyAll( Theme.of(context).cardColor, ), diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/single_setting_action.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/single_setting_action.dart index a356e3fd50e63..6b0c920a04ea6 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/single_setting_action.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/single_setting_action.dart @@ -128,11 +128,11 @@ class SingleSettingAction extends StatelessWidget { Color? hoverColor(BuildContext context) { if (buttonType.isDangerous) { - return Theme.of(context).colorScheme.error.withOpacity(0.1); + return Theme.of(context).colorScheme.error.withValues(alpha: 0.1); } if (buttonType.isPrimary) { - return Theme.of(context).colorScheme.primary.withOpacity(0.9); + return Theme.of(context).colorScheme.primary.withValues(alpha: 0.9); } if (buttonType.isHighlight) { diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/emoji_picker/src/emji_picker_config.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/emoji_picker/src/emji_picker_config.dart index 22d2bbe03490b..f329e9dd1c025 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/emoji_picker/src/emji_picker_config.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/emoji_picker/src/emji_picker_config.dart @@ -3,8 +3,8 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; -import 'models/emoji_category_models.dart'; import 'emoji_picker.dart'; +import 'models/emoji_category_models.dart'; part 'emji_picker_config.freezed.dart'; @@ -87,8 +87,6 @@ class EmojiPickerConfig with _$EmojiPickerConfig { return emojiCategoryIcons.flagIcon; case EmojiCategory.SEARCH: return emojiCategoryIcons.searchIcon; - default: - throw Exception('Unsupported EmojiCategory'); } } } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart index f3cd25afde555..ea8ebfe36b548 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart @@ -16,8 +16,8 @@ class ThemeUploadDecoration extends StatelessWidget { borderRadius: BorderRadius.circular(ThemeUploadWidget.borderRadius), color: Theme.of(context).colorScheme.surface, border: Border.all( - color: AFThemeExtension.of(context).onBackground.withOpacity( - ThemeUploadWidget.fadeOpacity, + color: AFThemeExtension.of(context).onBackground.withValues( + alpha: ThemeUploadWidget.fadeOpacity, ), ), ), @@ -28,7 +28,7 @@ class ThemeUploadDecoration extends StatelessWidget { color: Theme.of(context) .colorScheme .onSurface - .withOpacity(ThemeUploadWidget.fadeOpacity), + .withValues(alpha: ThemeUploadWidget.fadeOpacity), radius: const Radius.circular(ThemeUploadWidget.borderRadius), child: ClipRRect( borderRadius: BorderRadius.circular(ThemeUploadWidget.borderRadius), diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart index edb382d6eefe2..a7286bee48827 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart @@ -15,7 +15,7 @@ class ThemeUploadFailureWidget extends StatelessWidget { color: Theme.of(context) .colorScheme .error - .withOpacity(ThemeUploadWidget.fadeOpacity), + .withValues(alpha: ThemeUploadWidget.fadeOpacity), constraints: const BoxConstraints.expand(), padding: ThemeUploadWidget.padding, child: Column( diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart index 5e0ad15f385a9..1d3e7ab0f8cf2 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart @@ -14,7 +14,7 @@ class ThemeUploadLoadingWidget extends StatelessWidget { color: Theme.of(context) .colorScheme .surface - .withOpacity(ThemeUploadWidget.fadeOpacity), + .withValues(alpha: ThemeUploadWidget.fadeOpacity), constraints: const BoxConstraints.expand(), child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/upload_new_theme_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/upload_new_theme_widget.dart index 0113d26a37f5c..02a7c8e7ab509 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/upload_new_theme_widget.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/upload_new_theme_widget.dart @@ -15,7 +15,7 @@ class UploadNewThemeWidget extends StatelessWidget { color: Theme.of(context) .colorScheme .surface - .withOpacity(ThemeUploadWidget.fadeOpacity), + .withValues(alpha: ThemeUploadWidget.fadeOpacity), padding: ThemeUploadWidget.padding, child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/social_media_section.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/social_media_section.dart index f5c8ffa146145..43b3ab9b62668 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/social_media_section.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/social_media_section.dart @@ -79,9 +79,6 @@ extension QuestionBubbleExtension on SocialMedia { case SocialMedia.forum: return Theme.of(context).hintColor; - - default: - return null; } } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/image_viewer/interactive_image_toolbar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/image_viewer/interactive_image_toolbar.dart index a602aaed58538..765a385b0b6e7 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/image_viewer/interactive_image_toolbar.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/image_viewer/interactive_image_toolbar.dart @@ -119,7 +119,7 @@ class InteractiveImageToolbar extends StatelessWidget { child: FlowyHover( resetHoverOnRebuild: false, style: HoverStyle( - hoverColor: Colors.white.withOpacity(0.1), + hoverColor: Colors.white.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(4), ), child: Padding( @@ -204,7 +204,7 @@ class InteractiveImageToolbar extends StatelessWidget { return DecoratedBox( decoration: BoxDecoration( borderRadius: BorderRadius.circular(6), - color: Colors.black.withOpacity(0.6), + color: Colors.black.withValues(alpha: 0.6), ), child: Padding( padding: const EdgeInsets.all(4), @@ -284,8 +284,9 @@ class _ToolbarItem extends StatelessWidget { child: FlowyHover( resetHoverOnRebuild: false, style: HoverStyle( - hoverColor: - isDisabled ? Colors.transparent : Colors.white.withOpacity(0.1), + hoverColor: isDisabled + ? Colors.transparent + : Colors.white.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(4), ), child: Container( diff --git a/frontend/appflowy_flutter/packages/appflowy_popover/example/lib/example_button.dart b/frontend/appflowy_flutter/packages/appflowy_popover/example/lib/example_button.dart index ebd757aad3ea9..12bfd87ac3956 100644 --- a/frontend/appflowy_flutter/packages/appflowy_popover/example/lib/example_button.dart +++ b/frontend/appflowy_flutter/packages/appflowy_popover/example/lib/example_button.dart @@ -23,7 +23,7 @@ class _PopoverMenuState extends State { borderRadius: const BorderRadius.all(Radius.circular(8)), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.5), + color: Colors.grey.withValues(alpha: 0.5), spreadRadius: 5, blurRadius: 7, offset: const Offset(0, 3), // changes position of shadow diff --git a/frontend/appflowy_flutter/packages/flowy_infra/lib/utils/color_converter.dart b/frontend/appflowy_flutter/packages/flowy_infra/lib/utils/color_converter.dart index 19ca90d78f87e..4f80f81e629c1 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra/lib/utils/color_converter.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra/lib/utils/color_converter.dart @@ -13,5 +13,12 @@ class ColorConverter implements JsonConverter { } @override - String toJson(Color color) => "0x${color.value.toRadixString(16)}"; + String toJson(Color color) { + final alpha = (color.a * 255).toInt().toRadixString(16).padLeft(2, '0'); + final red = (color.r * 255).toInt().toRadixString(16).padLeft(2, '0'); + final green = (color.g * 255).toInt().toRadixString(16).padLeft(2, '0'); + final blue = (color.b * 255).toInt().toRadixString(16).padLeft(2, '0'); + + return '0x$alpha$red$green$blue'.toLowerCase(); + } } diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_popover_layout.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_popover_layout.dart index 0d4bacde52d27..fb29bb06371da 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_popover_layout.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_popover_layout.dart @@ -1,5 +1,7 @@ import 'dart:math' as math; + import 'package:flutter/material.dart'; + import 'flowy_overlay.dart'; class PopoverLayoutDelegate extends SingleChildLayoutDelegate { @@ -133,8 +135,6 @@ class PopoverLayoutDelegate extends SingleChildLayoutDelegate { case AnchorDirection.custom: childConstraints = constraints.loosen(); break; - default: - throw UnimplementedError(); } return childConstraints; } diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/layout.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/layout.dart index 87dd63b715599..84e7bb8ebd215 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/layout.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/layout.dart @@ -1,5 +1,7 @@ import 'dart:math' as math; + import 'package:flutter/material.dart'; + import 'flowy_overlay.dart'; class OverlayLayoutDelegate extends SingleChildLayoutDelegate { @@ -133,8 +135,6 @@ class OverlayLayoutDelegate extends SingleChildLayoutDelegate { case AnchorDirection.custom: childConstraints = constraints.loosen(); break; - default: - throw UnimplementedError(); } return childConstraints; } diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/list_overlay.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/list_overlay.dart index 2b61839ac349b..d1964e0c83b7a 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/list_overlay.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/list_overlay.dart @@ -128,7 +128,7 @@ class OverlayContainer extends StatelessWidget { padding: padding, decoration: FlowyDecoration.decoration( Theme.of(context).colorScheme.surface, - Theme.of(context).colorScheme.shadow.withOpacity(0.15), + Theme.of(context).colorScheme.shadow.withValues(alpha: 0.15), ), constraints: constraints, child: child, 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 c227d8b8efc37..9a54d51fed8ad 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 @@ -52,8 +52,8 @@ class PrimaryRoundedButton extends StatelessWidget { ), margin: margin ?? const EdgeInsets.symmetric(horizontal: 14.0), backgroundColor: backgroundColor ?? Theme.of(context).colorScheme.primary, - hoverColor: - hoverColor ?? Theme.of(context).colorScheme.primary.withOpacity(0.9), + hoverColor: hoverColor ?? + Theme.of(context).colorScheme.primary.withValues(alpha: 0.9), radius: BorderRadius.circular(radius ?? 10.0), onTap: onTap, ); diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/text_input.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/text_input.dart index bc391daf9ef72..95fd82363ea0e 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/text_input.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/text_input.dart @@ -1,11 +1,10 @@ import 'dart:async'; import 'dart:math' as math; +import 'package:flowy_infra/size.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flowy_infra/size.dart'; - class FlowyFormTextInput extends StatelessWidget { static EdgeInsets kDefaultTextInputPadding = const EdgeInsets.only(bottom: 2); @@ -68,7 +67,7 @@ class FlowyFormTextInput extends StatelessWidget { hintStyle: Theme.of(context) .textTheme .bodyMedium! - .copyWith(color: Theme.of(context).hintColor.withOpacity(0.7)), + .copyWith(color: Theme.of(context).hintColor.withValues(alpha: 0.7)), isDense: true, inputBorder: const ThinUnderlineBorder( borderSide: BorderSide(width: 5, color: Colors.red), diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/buttons/base_styled_button.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/buttons/base_styled_button.dart index 8087c712fe3c5..c81c81f3563f0 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/buttons/base_styled_button.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/buttons/base_styled_button.dart @@ -121,7 +121,7 @@ class BaseStyledBtnState extends State { fillColor: Colors.transparent, hoverColor: widget.hoverColor ?? Colors.transparent, highlightColor: widget.highlightColor ?? Colors.transparent, - focusColor: widget.focusColor ?? Colors.grey.withOpacity(0.35), + focusColor: widget.focusColor ?? Colors.grey.withValues(alpha: 0.35), constraints: BoxConstraints( minHeight: widget.minHeight ?? 0, minWidth: widget.minWidth ?? 0), onPressed: widget.onPressed, diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/dialog/styled_dialogs.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/dialog/styled_dialogs.dart index e29f778d8476b..7048ed32ec5e9 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/dialog/styled_dialogs.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/dialog/styled_dialogs.dart @@ -96,7 +96,7 @@ class Dialogs { {required Widget child}) async { return await Navigator.of(context).push( StyledDialogRoute( - barrier: DialogBarrier(color: Colors.black.withOpacity(0.4)), + barrier: DialogBarrier(color: Colors.black.withValues(alpha: 0.4)), pageBuilder: (BuildContext buildContext, Animation animation, Animation secondaryAnimation) { return SafeArea(child: child); diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/flowy_tooltip.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/flowy_tooltip.dart index c4c3263d39c7e..a34a55b9f8ee8 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/flowy_tooltip.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/widget/flowy_tooltip.dart @@ -66,7 +66,7 @@ extension FlowyToolTipExtension on BuildContext { } TextStyle? tooltipHintTextStyle({double? fontSize}) => tooltipTextStyle( - fontColor: tooltipFontColor().withOpacity(0.7), + fontColor: tooltipFontColor().withValues(alpha: 0.7), fontSize: fontSize, ); diff --git a/frontend/appflowy_flutter/packages/flowy_svg/lib/src/flowy_svg.dart b/frontend/appflowy_flutter/packages/flowy_svg/lib/src/flowy_svg.dart index cba112dc2bfb6..b5ded7b713cd2 100644 --- a/frontend/appflowy_flutter/packages/flowy_svg/lib/src/flowy_svg.dart +++ b/frontend/appflowy_flutter/packages/flowy_svg/lib/src/flowy_svg.dart @@ -80,7 +80,7 @@ class FlowySvg extends StatelessWidget { Widget build(BuildContext context) { Color? iconColor = color ?? Theme.of(context).iconTheme.color; if (opacity != null) { - iconColor = iconColor?.withOpacity(opacity!); + iconColor = iconColor?.withValues(alpha: opacity!); } final textScaleFactor = MediaQuery.textScalerOf(context).scale(1);