Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: desktop Search UI improvement (#7950)

Morn0b24f2cd3738
diff --git a/frontend/appflowy_flutter/integration_test/desktop/document/document_toolbar_test.dart b/frontend/appflowy_flutter/integration_test/desktop/document/document_toolbar_test.dart
index bc068a4ac9..d31924a3cc 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/document/document_toolbar_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/document/document_toolbar_test.dart
@@ -408,7 +408,8 @@ void main() {
expect(getNodeText(node), link);
});
- testWidgets('insert link and clear link name and remove link', (tester) async {
+ testWidgets('insert link and clear link name and remove link',
+ (tester) async {
const text = 'edit link', link = 'https://test.appflowy.cloud';
await prepareForToolbar(tester, text);
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/search/mobile_view_ancestors.dart b/frontend/appflowy_flutter/lib/mobile/presentation/search/mobile_view_ancestors.dart
index 7362211938..0f9db93363 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/search/mobile_view_ancestors.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/search/mobile_view_ancestors.dart
@@ -1,4 +1,5 @@
import 'package:appflowy/startup/startup.dart';
+import 'package:appflowy/workspace/presentation/command_palette/widgets/search_special_styles.dart';
import 'package:appflowy_ui/appflowy_ui.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flutter/material.dart';
@@ -100,4 +101,30 @@ extension ViewAncestorTextExtension on ViewAncestorState {
maxLines: 1,
textDirection: TextDirection.ltr,
);
+
+ Widget buildOnelinePath(BuildContext context) {
+ final ancestors = ancestor.ancestors;
+ List<String> displayPath = ancestors.map((e) => e.name).toList();
+ if (ancestors.length > 2) {
+ displayPath = [ancestors.first.name, '...', ancestors.last.name];
+ }
+ return RichText(
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ text: TextSpan(
+ children: [
+ WidgetSpan(
+ child: Padding(
+ padding: EdgeInsets.symmetric(horizontal: 8),
+ child: Text('-', style: context.searchPanelPath),
+ ),
+ ),
+ TextSpan(
+ text: displayPath.join(' / '),
+ style: context.searchPanelPath,
+ ),
+ ],
+ ),
+ );
+ }
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/cover/document_immersive_cover_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/cover/document_immersive_cover_bloc.dart
index 3006fc3104..eec4e273b3 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/cover/document_immersive_cover_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/cover/document_immersive_cover_bloc.dart
@@ -21,6 +21,7 @@ class DocumentImmersiveCoverBloc
await event.when(
initial: () async {
final latestView = await ViewBackendService.getView(view.id);
+ if (isClosed) return;
add(
DocumentImmersiveCoverEvent.updateCoverAndIcon(
latestView.fold(
diff --git a/frontend/appflowy_flutter/lib/workspace/application/command_palette/search_result_ext.dart b/frontend/appflowy_flutter/lib/workspace/application/command_palette/search_result_ext.dart
index abce585681..f7d7d753d9 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/command_palette/search_result_ext.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/command_palette/search_result_ext.dart
@@ -13,10 +13,14 @@ extension GetIcon on ResultIconPB {
final iconValue = value, iconType = ty;
if (iconType == ResultIconTypePB.Emoji) {
return iconValue.isNotEmpty
- ? RawEmojiIconWidget(
- emoji: EmojiIconData(iconType.toFlowyIconType(), iconValue),
- emojiSize: size,
- lineHeight: lineHeight,
+ ? Text(
+ iconValue,
+ strutStyle: StrutStyle(
+ fontSize: size,
+ height: lineHeight,
+ forceStrutHeight: true,
+ leadingDistribution: TextLeadingDistribution.even,
+ ),
)
: null;
} else if (iconType == ResultIconTypePB.Icon ||
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/command_palette.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/command_palette.dart
index bf7d43800f..8a9161ad21 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/command_palette.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/command_palette.dart
@@ -200,6 +200,7 @@ class CommandPaletteModal extends StatelessWidget {
},
child: BlocBuilder<CommandPaletteBloc, CommandPaletteState>(
builder: (context, state) {
+ final theme = AppFlowyTheme.of(context);
final noQuery = state.query?.isEmpty ?? true, hasQuery = !noQuery;
final hasResult = state.combinedResponseItems.isNotEmpty;
return FlowyDialog(
@@ -207,42 +208,45 @@ class CommandPaletteModal extends StatelessWidget {
insetPadding: const EdgeInsets.only(top: 100),
constraints: const BoxConstraints(
maxHeight: 640,
- maxWidth: 900,
+ maxWidth: 960,
+ minWidth: 572,
minHeight: 640,
),
expandHeight: false,
child: shortcutBuilder(
// Change mainAxisSize to max so Expanded works correctly.
- Column(
- children: [
- SearchField(query: state.query, isLoading: state.searching),
- if (noQuery)
- Flexible(
- child: RecentViewsList(
- onSelected: () => FlowyOverlay.pop(context),
+ Padding(
+ padding: EdgeInsets.all(theme.spacing.xl),
+ child: Column(
+ children: [
+ SearchField(query: state.query, isLoading: state.searching),
+ if (noQuery)
+ Flexible(
+ child: RecentViewsList(
+ onSelected: () => FlowyOverlay.pop(context),
+ ),
+ ),
+ if (hasResult && hasQuery) ...[
+ AFDivider(),
+ Flexible(
+ child: SearchResultList(
+ trash: state.trash,
+ resultItems:
+ state.combinedResponseItems.values.toList(),
+ resultSummaries: state.resultSummaries,
+ ),
),
- ),
- if (hasResult && hasQuery) ...[
- AFDivider(),
- Flexible(
- child: SearchResultList(
- trash: state.trash,
- resultItems:
- state.combinedResponseItems.values.toList(),
- resultSummaries: state.resultSummaries,
+ ]
+ // When there are no results and the query is not empty and not loading,
+ // show the no results message, centered in the available space.
+ else if (hasQuery && !state.searching) ...[
+ if (showAskingAI) SearchAskAiEntrance(),
+ Expanded(
+ child: const NoSearchResultsHint(),
),
- ),
- ]
- // When there are no results and the query is not empty and not loading,
- // show the no results message, centered in the available space.
- else if (hasQuery && !state.searching) ...[
- AFDivider(),
- if (showAskingAI) SearchAskAiEntrance(),
- Expanded(
- child: const NoSearchResultsHint(),
- ),
+ ],
],
- ],
+ ),
),
),
);
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/page_preview.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/page_preview.dart
index de54a6e8f1..5b818bfc1a 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/page_preview.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/page_preview.dart
@@ -1,15 +1,25 @@
+import 'dart:io';
+
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';
import 'package:appflowy/mobile/presentation/search/mobile_view_ancestors.dart';
+import 'package:appflowy/plugins/document/presentation/editor_plugins/cover/document_immersive_cover_bloc.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/header/emoji_icon_widget.dart';
+import 'package:appflowy/shared/appflowy_network_image.dart';
+import 'package:appflowy/shared/flowy_gradient_colors.dart';
import 'package:appflowy/shared/icon_emoji_picker/flowy_icon_emoji_picker.dart';
import 'package:appflowy/util/int64_extension.dart';
+import 'package:appflowy/util/theme_extension.dart';
import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart';
import 'package:appflowy/workspace/application/settings/date_time/date_format_ext.dart';
+import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:appflowy/workspace/application/view/view_ext.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
+import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_ui/appflowy_ui.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';
@@ -26,46 +36,152 @@ class PagePreview extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = AppFlowyTheme.of(context);
+ final backgroundColor =
+ Theme.of(context).isLightMode ? Color(0xffF8FAFF) : Color(0xff32343F);
- return Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 20,
- vertical: 24,
- ),
- child: SingleChildScrollView(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox.square(
- dimension: 24,
- child: Center(child: buildIcon(theme, view)),
+ return BlocProvider(
+ create: (context) => DocumentImmersiveCoverBloc(view: view)
+ ..add(const DocumentImmersiveCoverEvent.initial()),
+ child:
+ BlocBuilder<DocumentImmersiveCoverBloc, DocumentImmersiveCoverState>(
+ builder: (context, state) {
+ final cover = buildCover(state, context);
+ return Container(
+ height: MediaQuery.of(context).size.height,
+ width: 280,
+ decoration: BoxDecoration(
+ color: backgroundColor,
+ borderRadius: BorderRadius.circular(12),
),
- VSpace(8),
- buildTitle(context, view),
- buildPath(context, view),
- ...buildTime(
- context,
- LocaleKeys.commandPalette_created.tr(),
- view.createTime.toDateTime(),
+ margin: EdgeInsets.symmetric(vertical: 16),
+ child: Stack(
+ children: [
+ SingleChildScrollView(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ ClipRRect(
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(12),
+ topRight: Radius.circular(12),
+ ),
+ child: cover ?? VSpace(80),
+ ),
+ VSpace(24),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ buildTitle(context, view),
+ buildPath(context, view),
+ ...buildTime(
+ context,
+ LocaleKeys.commandPalette_created.tr(),
+ view.createTime.toDateTime(),
+ ),
+ if (view.lastEdited != view.createTime)
+ ...buildTime(
+ context,
+ LocaleKeys.commandPalette_edited.tr(),
+ view.lastEdited.toDateTime(),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ Positioned(
+ top: 70,
+ left: 20,
+ child: SizedBox.square(
+ dimension: 24,
+ child: Center(child: buildIcon(theme, view, cover != null)),
+ ),
+ ),
+ ],
),
- if (view.lastEdited != view.createTime)
- ...buildTime(
- context,
- LocaleKeys.commandPalette_edited.tr(),
- view.lastEdited.toDateTime(),
- ),
- ],
- ),
+ );
+ },
),
);
}
- Widget buildIcon(AppFlowyThemeData theme, ViewPB view) {
- return view.icon.value.isNotEmpty
+ Widget? buildCover(DocumentImmersiveCoverState state, BuildContext context) {
+ final cover = state.cover;
+ final type = state.cover.type;
+ const height = 80.0;
+ if (type == PageStyleCoverImageType.customImage ||
+ type == PageStyleCoverImageType.unsplashImage) {
+ final userProfile = context.read<UserWorkspaceBloc?>()?.state.userProfile;
+ if (userProfile == null) return null;
+
+ return SizedBox(
+ height: height,
+ width: double.infinity,
+ child: FlowyNetworkImage(
+ url: cover.value,
+ userProfilePB: userProfile,
+ ),
+ );
+ }
+
+ if (type == PageStyleCoverImageType.builtInImage) {
+ return SizedBox(
+ height: height,
+ width: double.infinity,
+ child: Image.asset(
+ PageStyleCoverImageType.builtInImagePath(cover.value),
+ fit: BoxFit.cover,
+ ),
+ );
+ }
+
+ if (type == PageStyleCoverImageType.pureColor) {
+ final color = FlowyTint.fromId(cover.value)?.color(context) ??
+ cover.value.tryToColor();
+ return Container(
+ height: height,
+ width: double.infinity,
+ color: color,
+ );
+ }
+
+ if (type == PageStyleCoverImageType.gradientColor) {
+ return Container(
+ height: height,
+ width: double.infinity,
+ decoration: BoxDecoration(
+ gradient: FlowyGradientColor.fromId(cover.value).linear,
+ ),
+ );
+ }
+
+ if (type == PageStyleCoverImageType.localImage) {
+ return SizedBox(
+ height: height,
+ width: double.infinity,
+ child: Image.file(
+ File(cover.value),
+ fit: BoxFit.cover,
+ ),
+ );
+ }
+
+ return null;
+ }
+
+ Widget buildIcon(AppFlowyThemeData theme, ViewPB view, bool hasCover) {
+ final hasIcon = view.icon.value.isNotEmpty;
+ if (!hasIcon && hasCover) return const SizedBox.shrink();
+ return hasIcon
? RawEmojiIconWidget(
emoji: view.icon.toEmojiIconData(),
- emojiSize: 20.0,
- lineHeight: 1,
+ emojiSize: 16.0,
+ lineHeight: 20 / 16,
)
: FlowySvg(
view.iconData,
@@ -109,7 +225,8 @@ class PagePreview extends StatelessWidget {
padding: EdgeInsets.all(theme.spacing.xs),
onTap: onViewOpened,
builder: (context, isHovering, disabled) => FlowySvg(
- FlowySvgs.search_arrow_right_m,
+ FlowySvgs.search_open_tab_m,
+ color: theme.iconColorScheme.secondary,
size: const Size.square(20),
),
),
@@ -131,7 +248,7 @@ class PagePreview extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- VSpace(16),
+ VSpace(20),
Text(
LocaleKeys.commandPalette_location.tr(),
style: theme.textStyle.caption
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/recent_views_list.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/recent_views_list.dart
index c49e1c93ee..55caa96c12 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/recent_views_list.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/recent_views_list.dart
@@ -1,7 +1,5 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
-import 'package:appflowy/plugins/document/presentation/editor_plugins/header/emoji_icon_widget.dart';
-import 'package:appflowy/shared/icon_emoji_picker/flowy_icon_emoji_picker.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart';
import 'package:appflowy/workspace/application/action_navigation/navigation_action.dart';
@@ -9,7 +7,7 @@ import 'package:appflowy/workspace/application/recent/recent_views_bloc.dart';
import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:appflowy/workspace/application/view/view_ext.dart';
import 'package:appflowy/workspace/presentation/command_palette/widgets/search_recent_view_cell.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
+import 'package:appflowy/workspace/presentation/command_palette/widgets/search_special_styles.dart';
import 'package:appflowy_backend/protobuf/flowy-user/workspace.pbenum.dart';
import 'package:appflowy_ui/appflowy_ui.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -32,137 +30,142 @@ class RecentViewsList extends StatelessWidget {
RecentViewsBloc()..add(const RecentViewsEvent.initial()),
child: BlocBuilder<RecentViewsBloc, RecentViewsState>(
builder: (context, state) {
- // We remove duplicates by converting the list to a set first
- final List<ViewPB> recentViews =
- state.views.map((e) => e.item).toSet().toList();
- final theme = AppFlowyTheme.of(context);
- final workspaceState = context.read<UserWorkspaceBloc?>()?.state;
- final showAskingAI = workspaceState?.userProfile.workspaceType ==
- WorkspaceTypePB.ServerW;
- final hoveredView = state.hoveredView;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- AFDivider(),
- Flexible(
- child: Row(
- children: [
- Flexible(
- flex: 2,
- child: Align(
- alignment: Alignment.topLeft,
- child: ScrollControllerBuilder(
- builder: (context, controller) {
- return FlowyScrollbar(
- controller: controller,
- child: SingleChildScrollView(
- controller: controller,
- physics: const ClampingScrollPhysics(),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- if (showAskingAI) SearchAskAiEntrance(),
- Container(
- height: 20,
- padding: const EdgeInsets.symmetric(
- horizontal: 8,
- ),
- margin: const EdgeInsets.symmetric(
- horizontal: 12,
- vertical: 8,
- ),
- child: Text(
- LocaleKeys.sideBar_recent.tr(),
- style: theme.textStyle.body.enhanced(
- color:
- theme.textColorScheme.secondary,
- ),
- ),
- ),
- ListView.separated(
- shrinkWrap: true,
- physics:
- const NeverScrollableScrollPhysics(),
- itemCount: recentViews.length,
- padding:
- EdgeInsets.symmetric(horizontal: 12),
- itemBuilder: (_, index) {
- final view = recentViews[index];
-
- final icon = view.icon.value.isNotEmpty
- ? RawEmojiIconWidget(
- emoji:
- view.icon.toEmojiIconData(),
- emojiSize: 16.0,
- lineHeight: 20 / 16,
- )
- : FlowySvg(
- view.iconData,
- size: const Size.square(20),
- color: theme
- .iconColorScheme.secondary,
- );
+ return LayoutBuilder(
+ builder: (context, constrains) {
+ final maxWidth = constrains.maxWidth;
+ final hidePreview = maxWidth < 884;
+ return Row(
+ children: [
+ buildLeftPanel(state, context, hidePreview),
+ if (!hidePreview) buildPreview(state),
+ ],
+ );
+ },
+ );
+ },
+ ),
+ );
+ }
- return SearchRecentViewCell(
- icon: SizedBox.square(
- dimension: 24,
- child: Center(child: icon),
- ),
- view: view,
- onSelected: onSelected,
- );
- },
- separatorBuilder: (_, index) {
- final view = recentViews[index];
- final isHovered =
- hoveredView?.id == view.id;
- if (isHovered) return VSpace(1);
- if (index < recentViews.length - 1) {
- final nextView =
- recentViews[index + 1];
- final isNextHovered =
- hoveredView?.id == nextView.id;
- if (isNextHovered) return VSpace(1);
- }
- return const AFDivider();
- },
- ),
- VSpace(8),
- ],
- ),
- ),
- );
- },
- ),
- ),
+ Widget buildLeftPanel(
+ RecentViewsState state,
+ BuildContext context,
+ bool hidePreview,
+ ) {
+ final workspaceState = context.read<UserWorkspaceBloc?>()?.state;
+ final showAskingAI =
+ workspaceState?.userProfile.workspaceType == WorkspaceTypePB.ServerW;
+ return Flexible(
+ child: Align(
+ alignment: Alignment.topLeft,
+ child: ScrollControllerBuilder(
+ builder: (context, controller) {
+ return Padding(
+ padding: EdgeInsets.only(right: hidePreview ? 0 : 6),
+ child: FlowyScrollbar(
+ controller: controller,
+ child: SingleChildScrollView(
+ controller: controller,
+ physics: const ClampingScrollPhysics(),
+ child: Padding(
+ padding: EdgeInsets.only(
+ right: hidePreview ? 0 : 6,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ if (showAskingAI) SearchAskAiEntrance(),
+ buildTitle(context),
+ buildViewList(state, context),
+ VSpace(8),
+ ],
),
- if (hoveredView != null) ...[
- AFDivider(axis: Axis.vertical),
- Flexible(
- child: Align(
- alignment: Alignment.topLeft,
- child: PagePreview(
- view: hoveredView,
- onViewOpened: () {
- getIt<ActionNavigationBloc>().add(
- ActionNavigationEvent.performAction(
- action: NavigationAction(
- objectId: hoveredView.id,
- ),
- ),
- );
- onSelected();
- },
- ),
- ),
- ),
- ],
- ],
+ ),
),
),
- ],
+ );
+ },
+ ),
+ ),
+ );
+ }
+
+ Widget buildTitle(BuildContext context) {
+ final theme = AppFlowyTheme.of(context);
+
+ return Container(
+ padding: EdgeInsets.symmetric(
+ horizontal: theme.spacing.m,
+ vertical: theme.spacing.s,
+ ),
+ child: Text(
+ LocaleKeys.sideBar_recent.tr(),
+ style: context.searchPanelTitle1,
+ ),
+ );
+ }
+
+ Widget buildViewList(RecentViewsState state, BuildContext context) {
+ final theme = AppFlowyTheme.of(context);
+ final recentViews = state.views.map((e) => e.item).toSet().toList();
+
+ if (recentViews.isEmpty) {
+ return const SizedBox.shrink();
+ }
+ return ListView.builder(
+ shrinkWrap: true,
+ physics: const NeverScrollableScrollPhysics(),
+ itemCount: recentViews.length,
+ itemBuilder: (_, index) {
+ final view = recentViews[index];
+
+ final icon = view.icon.value.isNotEmpty
+ ? Text(
+ view.icon.value,
+ strutStyle: StrutStyle(
+ fontSize: 16,
+ height: 20 / 16,
+ forceStrutHeight: true,
+ leadingDistribution: TextLeadingDistribution.even,
+ ),
+ )
+ : FlowySvg(
+ view.iconData,
+ size: const Size.square(18),
+ color: theme.iconColorScheme.secondary,
+ );
+
+ return SearchRecentViewCell(
+ icon: SizedBox.square(
+ dimension: 20,
+ child: Center(child: icon),
+ ),
+ view: view,
+ onSelected: onSelected,
+ );
+ },
+ );
+ }
+
+ Widget buildPreview(RecentViewsState state) {
+ final hoveredView = state.hoveredView;
+ if (hoveredView == null) {
+ return const SizedBox.shrink();
+ }
+ return Align(
+ alignment: Alignment.topLeft,
+ child: PagePreview(
+ key: ValueKey(hoveredView.id),
+ view: hoveredView,
+ onViewOpened: () {
+ getIt<ActionNavigationBloc>().add(
+ ActionNavigationEvent.performAction(
+ action: NavigationAction(
+ objectId: hoveredView.id,
+ ),
+ ),
);
+ onSelected();
},
),
);
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_ask_ai_entrance.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_ask_ai_entrance.dart
index 126f420cbb..c693b9f1c7 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_ask_ai_entrance.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_ask_ai_entrance.dart
@@ -1,6 +1,7 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/workspace/application/command_palette/command_palette_bloc.dart';
+import 'package:appflowy/workspace/presentation/command_palette/widgets/search_special_styles.dart';
import 'package:appflowy_backend/protobuf/flowy-search/result.pb.dart';
import 'package:appflowy_ui/appflowy_ui.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -16,14 +17,15 @@ class SearchAskAiEntrance extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bloc = context.read<CommandPaletteBloc?>(), state = bloc?.state;
- final generatingAIOverview = state?.generatingAIOverview ?? false;
- final hasAIOverview =
- _mockSummary?.isNotEmpty ?? state?.resultSummaries.isNotEmpty ?? false;
- if (generatingAIOverview) {
- return _AISearching();
- } else if (hasAIOverview) {
- return _AIOverview();
- }
+ if (bloc == null || state == null) return _AskAIFor();
+
+ final generatingAIOverview = state.generatingAIOverview;
+ if (generatingAIOverview) return _AISearching();
+
+ final hasMockSummary = _mockSummary?.isNotEmpty ?? false,
+ hasSummaries = state.resultSummaries.isNotEmpty;
+ if (hasMockSummary || hasSummaries) return _AIOverview();
+
return _AskAIFor();
}
}
@@ -34,12 +36,12 @@ class _AskAIFor extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = AppFlowyTheme.of(context);
- final spaceM = theme.spacing.m, spaceL = theme.spacing.l;
+ final spaceM = theme.spacing.m, spaceXL = theme.spacing.xl;
return Padding(
- padding: EdgeInsets.fromLTRB(spaceL, spaceM, spaceL, 0),
+ padding: EdgeInsets.only(top: spaceM),
child: AFBaseButton(
borderRadius: spaceM,
- padding: EdgeInsets.symmetric(vertical: spaceL, horizontal: spaceM),
+ padding: EdgeInsets.symmetric(vertical: spaceXL, horizontal: spaceM),
backgroundColor: (context, isHovering, disable) {
if (isHovering) {
return theme.fillColorScheme.contentHover;
@@ -51,12 +53,17 @@ class _AskAIFor extends StatelessWidget {
builder: (ctx, isHovering, disable) {
return Row(
children: [
- FlowySvg(
- FlowySvgs.m_home_ai_chat_icon_m,
- size: Size.square(20),
- blendMode: null,
+ SizedBox.square(
+ dimension: 24,
+ child: Center(
+ child: FlowySvg(
+ FlowySvgs.m_home_ai_chat_icon_m,
+ size: Size.square(20),
+ blendMode: null,
+ ),
+ ),
),
- HSpace(12),
+ HSpace(8),
buildText(context),
],
);
@@ -111,9 +118,9 @@ class _AISearching extends StatelessWidget {
Widget build(BuildContext context) {
final theme = AppFlowyTheme.of(context);
return Padding(
- padding: EdgeInsets.fromLTRB(16, 20, 16, 8),
+ padding: EdgeInsets.symmetric(vertical: 20, horizontal: 8),
child: SizedBox(
- height: 22,
+ height: 24,
child: Row(
children: [
FlowySvg(
@@ -146,12 +153,15 @@ class _AIOverview extends StatelessWidget {
return const SizedBox.shrink();
}
return Padding(
- padding: EdgeInsets.fromLTRB(16, 20, 16, 8),
+ padding: EdgeInsets.symmetric(
+ vertical: theme.spacing.xxl,
+ horizontal: theme.spacing.m,
+ ),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildHeader(context),
- VSpace(8),
+ VSpace(12),
LayoutBuilder(
builder: (context, constrains) {
final summary = summaries.first;
@@ -160,10 +170,11 @@ class _AIOverview extends StatelessWidget {
summary: summary,
maxWidth: constrains.maxWidth,
theme: AppFlowyTheme.of(context),
+ textStyle: context.searchPanelTitle3,
);
},
),
- VSpace(8),
+ VSpace(12),
SizedBox(
width: 143,
child: AFOutlinedButton.normal(
@@ -177,10 +188,10 @@ class _AIOverview extends StatelessWidget {
size: Size.square(20),
color: theme.iconColorScheme.primary,
),
- HSpace(8),
+ HSpace(6),
Text(
LocaleKeys.commandPalette_aiAskFollowUp.tr(),
- style: theme.textStyle.body.standard(
+ style: theme.textStyle.body.enhanced(
color: theme.textColorScheme.primary,
),
),
@@ -202,9 +213,8 @@ class _AIOverview extends StatelessWidget {
}
Widget buildHeader(BuildContext context) {
- final theme = AppFlowyTheme.of(context);
return SizedBox(
- height: 22,
+ height: 24,
child: Row(
children: [
FlowySvg(
@@ -215,8 +225,7 @@ class _AIOverview extends StatelessWidget {
HSpace(8),
Text(
LocaleKeys.commandPalette_aiOverview.tr(),
- style: theme.textStyle.heading4
- .enhanced(color: theme.textColorScheme.primary),
+ style: context.searchPanelAIOverview,
),
],
),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_field.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_field.dart
index 91824c618a..74ca3bf7b4 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_field.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_field.dart
@@ -6,10 +6,8 @@ import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/workspace/application/command_palette/command_palette_bloc.dart';
import 'package:easy_localization/easy_localization.dart';
-import 'package:flowy_infra/size.dart';
import 'package:flowy_infra_ui/style_widget/text_field.dart';
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
-import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class SearchField extends StatefulWidget {
@@ -59,83 +57,82 @@ class _SearchFieldState extends State<SearchField> {
}
Widget _buildSuffixIcon(BuildContext context) {
- return ValueListenableBuilder<TextEditingValue>(
- valueListenable: controller,
- builder: (context, value, _) {
- final hasText = value.text.trim().isNotEmpty;
- if (!hasText) return const SizedBox.shrink();
- return FlowyTooltip(
- message: LocaleKeys.commandPalette_clearSearchTooltip.tr(),
- child: MouseRegion(
- cursor: SystemMouseCursors.click,
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: _clearSearch,
- child: SizedBox.square(
- dimension: 28,
- child: Center(
- child: FlowySvg(
- FlowySvgs.search_clear_m,
- color: AppFlowyTheme.of(context).iconColorScheme.secondary,
- size: const Size.square(20),
- ),
+ return Padding(
+ padding: const EdgeInsets.only(left: 8, right: 12),
+ child: FlowyTooltip(
+ message: LocaleKeys.commandPalette_clearSearchTooltip.tr(),
+ child: MouseRegion(
+ cursor: SystemMouseCursors.click,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: _clearSearch,
+ child: SizedBox.square(
+ dimension: 28,
+ child: Center(
+ child: FlowySvg(
+ FlowySvgs.search_clear_m,
+ color: AppFlowyTheme.of(context).iconColorScheme.secondary,
+ size: const Size.square(20),
),
),
),
),
- );
- },
+ ),
+ ),
);
}
@override
Widget build(BuildContext context) {
final theme = AppFlowyTheme.of(context);
+ final radius = BorderRadius.circular(theme.spacing.l);
- return Container(
- height: 52,
- padding: EdgeInsets.symmetric(horizontal: 16),
- child: Row(
- children: [
- FlowySvg(
- FlowySvgs.search_icon_m,
- color: theme.iconColorScheme.secondary,
- size: Size.square(20),
- ),
- HSpace(8),
- Expanded(
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 15),
- child: FlowyTextField(
- focusNode: focusNode,
- controller: controller,
- textStyle: theme.textStyle.heading4
- .standard(color: theme.textColorScheme.primary),
- decoration: InputDecoration(
- constraints: const BoxConstraints(maxHeight: 48),
- contentPadding: EdgeInsets.zero,
- enabledBorder: const OutlineInputBorder(
- borderSide: BorderSide(color: Colors.transparent),
- borderRadius: Corners.s8Border,
- ),
- isDense: false,
- hintText: LocaleKeys.search_searchOrAskAI.tr(),
- hintStyle: theme.textStyle.heading4
- .standard(color: theme.textColorScheme.tertiary),
- counterText: "",
- focusedBorder: const OutlineInputBorder(
- borderRadius: Corners.s8Border,
- borderSide: BorderSide(color: Colors.transparent),
- ),
+ return SizedBox(
+ height: 44,
+ child: ValueListenableBuilder<TextEditingValue>(
+ valueListenable: controller,
+ builder: (context, value, _) {
+ final hasText = value.text.trim().isNotEmpty;
+ return FlowyTextField(
+ focusNode: focusNode,
+ controller: controller,
+ textStyle: theme.textStyle.heading4
+ .standard(color: theme.textColorScheme.primary),
+ decoration: InputDecoration(
+ contentPadding:
+ EdgeInsets.symmetric(vertical: 11, horizontal: 12),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide(color: theme.borderColorScheme.primary),
+ borderRadius: radius,
+ ),
+ isDense: false,
+ hintText: LocaleKeys.search_searchOrAskAI.tr(),
+ hintStyle: theme.textStyle.heading4
+ .standard(color: theme.textColorScheme.tertiary),
+ counterText: "",
+ focusedBorder: OutlineInputBorder(
+ borderRadius: radius,
+ borderSide:
+ BorderSide(color: theme.borderColorScheme.themeThick),
+ ),
+ prefixIcon: Padding(
+ padding: const EdgeInsets.only(left: 12, right: 8),
+ child: FlowySvg(
+ FlowySvgs.search_icon_m,
+ color: theme.iconColorScheme.secondary,
+ size: Size.square(20),
),
- onChanged: (value) => context
- .read<CommandPaletteBloc>()
- .add(CommandPaletteEvent.searchChanged(search: value)),
),
+ prefixIconConstraints: BoxConstraints.loose(Size(40, 20)),
+ suffixIconConstraints:
+ hasText ? BoxConstraints.loose(Size(48, 28)) : null,
+ suffixIcon: hasText ? _buildSuffixIcon(context) : null,
),
- ),
- _buildSuffixIcon(context),
- ],
+ onChanged: (value) => context
+ .read<CommandPaletteBloc>()
+ .add(CommandPaletteEvent.searchChanged(search: value)),
+ );
+ },
),
);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_recent_view_cell.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_recent_view_cell.dart
index f0cd404348..08097099eb 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_recent_view_cell.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_recent_view_cell.dart
@@ -4,6 +4,7 @@ import 'package:appflowy/workspace/application/action_navigation/action_navigati
import 'package:appflowy/workspace/application/action_navigation/navigation_action.dart';
import 'package:appflowy/workspace/application/recent/recent_views_bloc.dart';
import 'package:appflowy/workspace/application/view/view_ext.dart';
+import 'package:appflowy/workspace/presentation/command_palette/widgets/search_special_styles.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:appflowy_ui/appflowy_ui.dart';
import 'package:flowy_infra/theme_extension.dart';
@@ -42,8 +43,7 @@ class _SearchRecentViewCellState extends State<SearchRecentViewCell> {
@override
Widget build(BuildContext context) {
- final theme = AppFlowyTheme.of(context),
- textColor = theme.textColorScheme.primary;
+ final theme = AppFlowyTheme.of(context);
final sapceM = theme.spacing.m, spaceL = theme.spacing.l;
final bloc = context.read<RecentViewsBloc>(), state = bloc.state;
final hoveredView = state.hoveredView;
@@ -84,19 +84,14 @@ class _SearchRecentViewCellState extends State<SearchRecentViewCell> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.icon,
- HSpace(12),
- Flexible(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- view.nameOrDefault,
- style: theme.textStyle.body.standard(color: textColor),
- ),
- buildPath(theme),
- ],
- ),
+ HSpace(8),
+ Text(
+ view.nameOrDefault,
+ maxLines: 1,
+ style: context.searchPanelTitle2,
+ overflow: TextOverflow.ellipsis,
),
+ Flexible(child: buildPath(theme)),
],
),
),
@@ -109,7 +104,10 @@ class _SearchRecentViewCellState extends State<SearchRecentViewCell> {
return BlocProvider(
create: (context) => ViewAncestorBloc(view.id),
child: BlocBuilder<ViewAncestorBloc, ViewAncestorState>(
- builder: (context, state) => state.buildPath(context),
+ builder: (context, state) {
+ if (state.ancestor.ancestors.isEmpty) return const SizedBox.shrink();
+ return state.buildOnelinePath(context);
+ },
),
);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_cell.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_cell.dart
index eb7522530c..fde95f53c6 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_cell.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_result_cell.dart
@@ -6,6 +6,7 @@ import 'package:appflowy/workspace/application/command_palette/command_palette_b
import 'package:appflowy/workspace/application/command_palette/search_result_ext.dart';
import 'package:appflowy/workspace/application/command_palette/search_result_list_bloc.dart';
import 'package:appflowy/workspace/application/view/prelude.dart';
+import 'package:appflowy/workspace/presentation/command_palette/widgets/search_special_styles.dart';
import 'package:appflowy_backend/protobuf/flowy-search/result.pbenum.dart';
import 'package:appflowy_ui/appflowy_ui.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -61,7 +62,6 @@ class _SearchResultCellState extends State<SearchResultCell> {
);
final theme = AppFlowyTheme.of(context);
- final textColor = theme.textColorScheme.primary;
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: _handleSelection,
@@ -102,39 +102,37 @@ class _SearchResultCellState extends State<SearchResultCell> {
foregroundColorOnHover: AFThemeExtension.of(context).textColor,
),
child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
- child: Row(
+ padding: EdgeInsets.symmetric(
+ horizontal: theme.spacing.m,
+ vertical: theme.spacing.xl,
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- SizedBox.square(
- dimension: 24,
- child: Center(child: buildIcon(theme)),
- ),
- HSpace(12),
- Flexible(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- RichText(
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- text: buildHighLightSpan(
- content: title,
- normal:
- theme.textStyle.body.standard(color: textColor),
- highlight: theme.textStyle.body
- .standard(color: textColor)
- .copyWith(
- backgroundColor:
- theme.fillColorScheme.themeSelect,
- ),
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox.square(
+ dimension: 20,
+ child: Center(child: buildIcon(theme)),
+ ),
+ HSpace(8),
+ RichText(
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ text: buildHighLightSpan(
+ content: title,
+ normal: context.searchPanelTitle2,
+ highlight: context.searchPanelTitle2.copyWith(
+ backgroundColor: theme.fillColorScheme.themeSelect,
),
),
- buildPath(theme),
- ...buildSummary(theme),
- ],
- ),
+ ),
+ Flexible(child: buildPath(theme)),
+ ],
),
+ ...buildSummary(theme),
],
),
),
@@ -147,18 +145,21 @@ class _SearchResultCellState extends State<SearchResultCell> {
final icon = item.icon;
final color = theme.iconColorScheme.secondary;
if (icon.ty == ResultIconTypePB.Emoji) {
- return icon.getIcon(size: 20, iconColor: color) ?? SizedBox.shrink();
+ return icon.getIcon(size: 16, lineHeight: 20 / 16, iconColor: color) ??
+ SizedBox.shrink();
} else {
- return icon.getIcon(size: 20, iconColor: color) ?? SizedBox.shrink();
+ return icon.getIcon(iconColor: color) ?? SizedBox.shrink();
}
}
Widget buildPath(AppFlowyThemeData theme) {
return BlocProvider(
- key: ValueKey(viewId),
- create: (context) => ViewAncestorBloc(viewId),
+ create: (context) => ViewAncestorBloc(item.id),
child: BlocBuilder<ViewAncestorBloc, ViewAncestorState>(
- builder: (context, state) => state.buildPath(context),
+ builder: (context, state) {
+ if (state.ancestor.ancestors.isEmpty) return const SizedBox.shrink();
+ return state.buildOnelinePath(context);
+ },
),
);
}
@@ -190,17 +191,14 @@ class _SearchResultCellState extends State<SearchResultCell> {
return [
VSpace(4),
RichText(
- maxLines: 3,
+ maxLines: 2,
overflow: TextOverflow.ellipsis,
text: buildHighLightSpan(
content: item.content,
- normal: theme.textStyle.caption
- .standard(color: theme.textColorScheme.secondary),
- highlight: theme.textStyle.caption
- .standard(color: theme.textColorScheme.primary)
- .copyWith(
- backgroundColor: theme.fillColorScheme.themeSelect,
- ),
+ normal: context.searchPanelSummary,
+ highlight: context.searchPanelSummary.copyWith(
+ backgroundColor: theme.fillColorScheme.themeSelect,
+ ),
),
),
];
@@ -228,6 +226,7 @@ class SearchResultPreview extends StatelessWidget {
return PagePreview(
view: view,
+ key: ValueKey(view.id),
onViewOpened: () {
context
.read<SearchResultListBloc?>()
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_results_list.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_results_list.dart
index d13d2e63b3..4908002ddb 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_results_list.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_results_list.dart
@@ -5,6 +5,7 @@ import 'package:appflowy/workspace/application/command_palette/command_palette_b
import 'package:appflowy/workspace/application/command_palette/search_result_list_bloc.dart';
import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
import 'package:appflowy/workspace/presentation/command_palette/widgets/search_ask_ai_entrance.dart';
+import 'package:appflowy/workspace/presentation/command_palette/widgets/search_special_styles.dart';
import 'package:appflowy_backend/protobuf/flowy-user/workspace.pbenum.dart';
import 'package:appflowy_ui/appflowy_ui.dart';
import 'package:flutter/material.dart';
@@ -65,16 +66,20 @@ class _SearchResultListState extends State<SearchResultList> {
},
child: BlocBuilder<SearchResultListBloc, SearchResultListState>(
builder: (context, state) {
- final showPreview = state.hoveredResult != null;
- return Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Flexible(flex: 2, child: _buildResultsSection(context)),
- if (showPreview) ...[
- AFDivider(axis: Axis.vertical),
- Flexible(child: const SearchCellPreview()),
- ],
- ],
+ final hasHoverResult = state.hoveredResult != null;
+ return LayoutBuilder(
+ builder: (context, constrains) {
+ final maxWidth = constrains.maxWidth;
+ final hidePreview = maxWidth < 884;
+ return Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(child: _buildResultsSection(context, hidePreview)),
+ if (!hidePreview && hasHoverResult)
+ const SearchCellPreview(),
+ ],
+ );
+ },
);
},
),
@@ -84,19 +89,19 @@ class _SearchResultListState extends State<SearchResultList> {
Widget _buildSectionHeader(BuildContext context) {
final theme = AppFlowyTheme.of(context);
- return Container(
- height: 20,
- padding: const EdgeInsets.symmetric(horizontal: 8),
+ return Padding(
+ padding: EdgeInsets.symmetric(
+ vertical: theme.spacing.s,
+ horizontal: theme.spacing.m,
+ ),
child: Text(
LocaleKeys.commandPalette_bestMatches.tr(),
- style: theme.textStyle.body.enhanced(
- color: theme.textColorScheme.secondary,
- ),
+ style: context.searchPanelTitle1,
),
);
}
- Widget _buildResultsSection(BuildContext context) {
+ Widget _buildResultsSection(BuildContext context, bool hidePreview) {
final workspaceState = context.read<UserWorkspaceBloc?>()?.state;
final showAskingAI =
workspaceState?.userProfile.workspaceType == WorkspaceTypePB.ServerW;
@@ -108,55 +113,57 @@ class _SearchResultListState extends State<SearchResultList> {
return ScrollControllerBuilder(
builder: (context, controller) {
final hoveredId = bloc.state.hoveredResult?.id;
- return FlowyScrollbar(
- controller: controller,
- child: SingleChildScrollView(
+ return Padding(
+ padding: EdgeInsets.only(right: hidePreview ? 0 : 6),
+ child: FlowyScrollbar(
controller: controller,
- physics: ClampingScrollPhysics(),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- if (showAskingAI) SearchAskAiEntrance(),
- Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- _buildSectionHeader(context),
- VSpace(8),
- ListView.separated(
- physics: const NeverScrollableScrollPhysics(),
- shrinkWrap: true,
- itemCount: resultItems.length,
- separatorBuilder: (_, index) {
- final item = resultItems[index];
- final isHovered = hoveredId == item.id;
- if (isHovered) return VSpace(1);
- if (index < resultItems.length - 1) {
- final nextView = resultItems[index + 1];
- final isNextHovered = hoveredId == nextView.id;
- if (isNextHovered) return VSpace(1);
- }
- return const AFDivider();
- },
- itemBuilder: (_, index) {
- final item = resultItems[index];
- return SearchResultCell(
- item: item,
- isHovered: hoveredId == item.id,
- query: context
- .read<CommandPaletteBloc?>()
- ?.state
- .query,
- );
- },
- ),
- ],
- ),
+ child: SingleChildScrollView(
+ controller: controller,
+ physics: ClampingScrollPhysics(),
+ child: Padding(
+ padding: EdgeInsets.only(right: hidePreview ? 0 : 6),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ if (showAskingAI) SearchAskAiEntrance(),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ _buildSectionHeader(context),
+ VSpace(8),
+ ListView.separated(
+ physics: const NeverScrollableScrollPhysics(),
+ separatorBuilder: (_, index) {
+ final item = resultItems[index];
+ final isHovered = hoveredId == item.id;
+ if (isHovered) return VSpace(1);
+ if (index < resultItems.length - 1) {
+ final nextView = resultItems[index + 1];
+ final isNextHovered = hoveredId == nextView.id;
+ if (isNextHovered) return VSpace(1);
+ }
+ return const AFDivider();
+ },
+ shrinkWrap: true,
+ itemCount: resultItems.length,
+ itemBuilder: (_, index) {
+ final item = resultItems[index];
+ return SearchResultCell(
+ item: item,
+ isHovered: hoveredId == item.id,
+ query: context
+ .read<CommandPaletteBloc?>()
+ ?.state
+ .query,
+ );
+ },
+ ),
+ ],
+ ),
+ ],
),
- ],
+ ),
),
),
);
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_special_styles.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_special_styles.dart
new file mode 100644
index 0000000000..108434e609
--- /dev/null
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_special_styles.dart
@@ -0,0 +1,56 @@
+import 'package:appflowy_ui/appflowy_ui.dart';
+import 'package:flutter/material.dart';
+
+extension DesktopSearchSpecialStyles on BuildContext {
+ TextStyle get searchPanelTitle1 {
+ return TextStyle(
+ fontSize: 16,
+ height: 24 / 16,
+ fontWeight: FontWeight.w500,
+ letterSpacing: 0.2,
+ color: AppFlowyTheme.of(this).textColorScheme.secondary,
+ );
+ }
+
+ TextStyle get searchPanelTitle2 {
+ return TextStyle(
+ fontSize: 14,
+ height: 20 / 14,
+ fontWeight: FontWeight.w500,
+ color: AppFlowyTheme.of(this).textColorScheme.primary,
+ );
+ }
+
+ TextStyle get searchPanelTitle3 {
+ return TextStyle(
+ fontSize: 14,
+ height: 22 / 14,
+ fontWeight: FontWeight.w400,
+ color: AppFlowyTheme.of(this).textColorScheme.primary,
+ );
+ }
+
+ TextStyle get searchPanelAIOverview {
+ return TextStyle(
+ fontSize: 16,
+ height: 24 / 16,
+ fontWeight: FontWeight.w500,
+ letterSpacing: 0.2,
+ color: AppFlowyTheme.of(this).textColorScheme.secondary,
+ );
+ }
+
+ TextStyle get searchPanelPath {
+ return TextStyle(
+ fontSize: 12,
+ height: 18 / 12,
+ fontWeight: FontWeight.w400,
+ letterSpacing: 0.1,
+ color: AppFlowyTheme.of(this).textColorScheme.tertiary,
+ );
+ }
+
+ TextStyle get searchPanelSummary => searchPanelPath.copyWith(
+ color: AppFlowyTheme.of(this).textColorScheme.secondary,
+ );
+}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_summary_cell.dart b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_summary_cell.dart
index 4c158e1b54..c445eda81d 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_summary_cell.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/command_palette/widgets/search_summary_cell.dart
@@ -19,12 +19,14 @@ class SearchSummaryCell extends StatefulWidget {
required this.summary,
required this.maxWidth,
required this.theme,
+ required this.textStyle,
super.key,
});
final SearchSummaryPB summary;
final double maxWidth;
final AppFlowyThemeData theme;
+ final TextStyle textStyle;
@override
State<SearchSummaryCell> createState() => _SearchSummaryCellState();
@@ -42,9 +44,7 @@ class _SearchSummaryCellState extends State<SearchSummaryCell> {
double get maxWidth => widget.maxWidth;
AppFlowyThemeData get theme => widget.theme;
- TextStyle get textStyle => theme.textStyle.body.standard(
- color: theme.textColorScheme.primary,
- );
+ TextStyle get textStyle => widget.textStyle;
TextStyle get showMoreStyle => theme.textStyle.body.standard(
color: theme.textColorScheme.secondary,
@@ -433,7 +433,7 @@ class ReferenceSources extends StatelessWidget {
if (icon.ty == ResultIconTypePB.Emoji) {
return icon.getIcon(size: 16, lineHeight: 20 / 16) ?? SizedBox.shrink();
} else {
- return icon.getIcon(size: 20, iconColor: theme.iconColorScheme.primary) ??
+ return icon.getIcon(iconColor: theme.iconColorScheme.primary) ??
SizedBox.shrink();
}
}
diff --git a/frontend/resources/flowy_icons/20x/search_open_tab.svg b/frontend/resources/flowy_icons/20x/search_open_tab.svg
new file mode 100644
index 0000000000..538f771b92
--- /dev/null
+++ b/frontend/resources/flowy_icons/20x/search_open_tab.svg
@@ -0,0 +1,3 @@
+<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M9.64645 9.80593C9.45118 10.0012 9.45118 10.3178 9.64645 10.513C9.84171 10.7083 10.1583 10.7083 10.3536 10.513L9.64645 9.80593ZM16.5 3.65948H17C17 3.38334 16.7761 3.15948 16.5 3.15948V3.65948ZM12.6406 3.15948C12.3644 3.15948 12.1406 3.38334 12.1406 3.65948C12.1406 3.93563 12.3644 4.15948 12.6406 4.15948V3.15948ZM16 7.51886C16 7.795 16.2239 8.01886 16.5 8.01886C16.7761 8.01886 17 7.795 17 7.51886H16ZM17 10C17 9.72386 16.7761 9.5 16.5 9.5C16.2238 9.5 16 9.72386 16 10H17ZM15.5481 15.5481L15.1945 15.1945L15.1945 15.1945L15.5481 15.5481ZM4.4519 15.5481L4.80546 15.1945L4.80545 15.1945L4.4519 15.5481ZM4.4519 4.45191L4.80546 4.80546L4.80546 4.80546L4.4519 4.45191ZM9.99999 4C10.2761 4 10.5 3.77614 10.5 3.5C10.5 3.22386 10.2761 3 9.99999 3V4ZM10 10.1595L10.3536 10.513L16.8536 4.01304L16.5 3.65948L16.1464 3.30593L9.64645 9.80593L10 10.1595ZM16.5 3.65948V3.15948H12.6406V3.65948V4.15948H16.5V3.65948ZM16.5 3.65948H16V7.51886H16.5H17V3.65948H16.5ZM16.5 10H16C16 11.5462 15.9989 12.6555 15.8855 13.4995C15.7739 14.3291 15.5621 14.827 15.1945 15.1945L15.5481 15.5481L15.9016 15.9016C16.486 15.3173 16.7501 14.5732 16.8765 13.6328C17.001 12.7067 17 11.5179 17 10H16.5ZM15.5481 15.5481L15.1945 15.1945C14.827 15.5621 14.3291 15.7739 13.4995 15.8855C12.6555 15.9989 11.5462 16 9.99999 16V16.5V17C11.5179 17 12.7067 17.0011 13.6327 16.8766C14.5732 16.7501 15.3173 16.486 15.9016 15.9016L15.5481 15.5481ZM9.99999 16.5V16C8.45379 16 7.34444 15.9989 6.50049 15.8855C5.67092 15.7739 5.17303 15.5621 4.80546 15.1945L4.4519 15.5481L4.09835 15.9016C4.68268 16.486 5.42677 16.7501 6.36724 16.8766C7.29332 17.0011 8.48206 17 9.99999 17V16.5ZM4.4519 15.5481L4.80545 15.1945C4.43789 14.827 4.22606 14.3291 4.11453 13.4995C4.00106 12.6555 4 11.5462 4 10H3.5H3C3 11.5179 2.99894 12.7067 3.12345 13.6328C3.24989 14.5732 3.51401 15.3173 4.09836 15.9016L4.4519 15.5481ZM3.5 10H4C4 8.4538 4.00106 7.34445 4.11453 6.50049C4.22606 5.67091 4.43789 5.17302 4.80546 4.80546L4.4519 4.45191L4.09835 4.09835C3.51401 4.68269 3.24989 5.42678 3.12345 6.36724C2.99894 7.29332 3 8.48207 3 10H3.5ZM4.4519 4.45191L4.80546 4.80546C5.17302 4.43789 5.67091 4.22606 6.50049 4.11453C7.34444 4.00106 8.45379 4 9.99999 4V3.5V3C8.48206 3 7.29332 2.99894 6.36724 3.12345C5.42677 3.24989 4.68268 3.51402 4.09835 4.09835L4.4519 4.45191Z" fill="#6F748C"/>
+</svg>