Skip to content

Commit

Permalink
fix: flutter analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Jan 17, 2025
1 parent 93b2a54 commit 3c3880d
Show file tree
Hide file tree
Showing 111 changed files with 260 additions and 250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class _PromptInputMentionPageMenuState
void initState() {
super.initState();
Future.delayed(Duration.zero, () {
context.read<ChatInputControlCubit>().refreshViews();
if (mounted) {
context.read<ChatInputControlCubit>().refreshViews();
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/appflowy_flutter/lib/env/cloud_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Future<void> useLocalServer() async {
await _setAuthenticatorType(AuthenticatorType.local);
}

/// Use getIt<AppFlowyCloudSharedEnv>() to get the shared environment.
// Use getIt<AppFlowyCloudSharedEnv>() to get the shared environment.
class AppFlowyCloudSharedEnv {
AppFlowyCloudSharedEnv({
required AuthenticatorType authenticatorType,
Expand Down
4 changes: 2 additions & 2 deletions frontend/appflowy_flutter/lib/flutter/af_dropdown_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,11 @@ class _AFDropdownMenuState<T> extends State<AFDropdownMenu<T>> {

// 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<Color>(
focusedBackgroundColor.withOpacity(0.12),
focusedBackgroundColor.withValues(alpha: 0.12),
),
)
: effectiveStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Future<T?> showMobileBottomSheet<T>(
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<T>(
context: context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';

Expand Down Expand Up @@ -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),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 {
Expand Down Expand Up @@ -49,7 +48,7 @@ class _MobileEditPropertyScreenState extends State<MobileEditPropertyScreen> {
final fieldId = widget.field.id;

return PopScope(
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (!didPop) {
context.pop(_fieldOptionValues);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
],
);
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ class _MobileSpaceTabState extends State<MobileSpaceTab>
);
case MobileSpaceTabType.favorites:
return MobileFavoriteSpace(userProfile: widget.userProfile);
default:
throw Exception('Unknown tab type: $tab');
}
}).toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ class WorkspaceMenuMoreOptions extends StatelessWidget {
WorkspaceMenuMoreOption.leave,
),
);
default:
return const Placeholder();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Future<T?> showFlowyCupertinoConfirmDialog<T>({
}) {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
),
),
Expand Down Expand Up @@ -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),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,22 @@ 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),
blurRadius: 8,
spreadRadius: 2,
color: isLightMode
? const Color(0x051F2329)
: Theme.of(context).shadowColor.withOpacity(0.02),
: Theme.of(context).shadowColor.withValues(alpha: 0.02),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ class _AIMessageActionBarState extends State<AIMessageActionBar> {
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),
blurRadius: 8,
spreadRadius: 2,
color: isLightMode
? const Color(0x051F2329)
: Theme.of(context).shadowColor.withOpacity(0.02),
: Theme.of(context).shadowColor.withValues(alpha: 0.02),
),
],
),
Expand Down Expand Up @@ -324,22 +324,22 @@ 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),
blurRadius: 8,
spreadRadius: 2,
color: isLightMode
? const Color(0x051F2329)
: Theme.of(context).shadowColor.withOpacity(0.02),
: Theme.of(context).shadowColor.withValues(alpha: 0.02),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
],
),
Expand Down
Loading

0 comments on commit 3c3880d

Please sign in to comment.