mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-06-27 02:50:15 +00:00
fix: LR issues of desktop search (#7914)
* fix: update error view for search preview * chore: add some logs for command palette * fix: alignment issue
This commit is contained in:
parent
79009d2851
commit
5029776685
@ -10,6 +10,7 @@ import 'package:appflowy/workspace/presentation/command_palette/widgets/recent_v
|
||||
import 'package:appflowy/workspace/presentation/command_palette/widgets/search_field.dart';
|
||||
import 'package:appflowy/workspace/presentation/command_palette/widgets/search_results_list.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-user/workspace.pbenum.dart';
|
||||
import 'package:appflowy_ui/appflowy_ui.dart';
|
||||
@ -109,6 +110,9 @@ class _CommandPaletteControllerState extends State<_CommandPaletteController> {
|
||||
_isOpen = true;
|
||||
final workspaceBloc = _toggleNotifier.value.userWorkspaceBloc;
|
||||
final spaceBloc = _toggleNotifier.value.spaceBloc;
|
||||
Log.info(
|
||||
'CommandPalette onToggle: workspaceType ${workspaceBloc?.state.userProfile.workspaceType}',
|
||||
);
|
||||
FlowyOverlay.show(
|
||||
context: context,
|
||||
builder: (_) => MultiBlocProvider(
|
||||
|
@ -158,3 +158,40 @@ class PagePreview extends StatelessWidget {
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
class SomethingWentWrong extends StatelessWidget {
|
||||
const SomethingWentWrong({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = AppFlowyTheme.of(context);
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
FlowySvg(
|
||||
FlowySvgs.something_wrong_warning_m,
|
||||
color: theme.iconColorScheme.secondary,
|
||||
size: Size.square(24),
|
||||
),
|
||||
const VSpace(8),
|
||||
Text(
|
||||
LocaleKeys.search_somethingWentWrong.tr(),
|
||||
style: theme.textStyle.body
|
||||
.enhanced(color: theme.textColorScheme.secondary),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const VSpace(4),
|
||||
Text(
|
||||
LocaleKeys.search_tryAgainOrLater.tr(),
|
||||
style: theme.textStyle.caption
|
||||
.standard(color: theme.textColorScheme.secondary),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -47,74 +47,78 @@ class RecentViewsList extends StatelessWidget {
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: ScrollControllerBuilder(
|
||||
builder: (context, controller) {
|
||||
return FlowyScrollbar(
|
||||
controller: controller,
|
||||
child: SingleChildScrollView(
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: ScrollControllerBuilder(
|
||||
builder: (context, controller) {
|
||||
return FlowyScrollbar(
|
||||
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,
|
||||
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];
|
||||
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,
|
||||
);
|
||||
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 SearchRecentViewCell(
|
||||
icon: SizedBox.square(
|
||||
dimension: 24,
|
||||
child: Center(child: icon),
|
||||
),
|
||||
view: view,
|
||||
onSelected: onSelected,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, __) => AFDivider(),
|
||||
),
|
||||
VSpace(8),
|
||||
],
|
||||
return SearchRecentViewCell(
|
||||
icon: SizedBox.square(
|
||||
dimension: 24,
|
||||
child: Center(child: icon),
|
||||
),
|
||||
view: view,
|
||||
onSelected: onSelected,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, __) => AFDivider(),
|
||||
),
|
||||
VSpace(8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hoveredView != null) ...[
|
||||
|
@ -6,7 +6,6 @@ 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/command_palette.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';
|
||||
@ -225,7 +224,7 @@ class SearchResultPreview extends StatelessWidget {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
final view = snapshot.data?.toNullable();
|
||||
if (view == null) return NoSearchResultsHint();
|
||||
if (view == null) return SomethingWentWrong();
|
||||
|
||||
return PagePreview(view: view);
|
||||
},
|
||||
|
@ -0,0 +1,5 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12 7V13" stroke="#6F748C" stroke-width="1.5" stroke-linecap="round"/>
|
||||
<path d="M11 16C11 16.2652 11.1054 16.5196 11.2929 16.7071C11.4804 16.8946 11.7348 17 12 17C12.2652 17 12.5196 16.8946 12.7071 16.7071C12.8946 16.5196 13 16.2652 13 16C13 15.7348 12.8946 15.4804 12.7071 15.2929C12.5196 15.1054 12.2652 15 12 15C11.7348 15 11.4804 15.1054 11.2929 15.2929C11.1054 15.4804 11 15.7348 11 16Z" fill="#6F748C"/>
|
||||
<path d="M2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C22 4.92893 22 7.28595 22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12Z" stroke="#6F748C" stroke-width="1.5"/>
|
||||
</svg>
|
After Width: | Height: | Size: 827 B |
@ -2364,6 +2364,8 @@
|
||||
"noResultForSearchingHintWithoutTrash": "Try different questions or keywords\n Some pages may be in the ",
|
||||
"bestMatch": "Best match",
|
||||
"seeMore": "See more",
|
||||
"somethingWentWrong": "Something went wrong",
|
||||
"tryAgainOrLater": "Please try again later",
|
||||
"placeholder": {
|
||||
"actions": "Search actions..."
|
||||
}
|
||||
@ -3403,4 +3405,4 @@
|
||||
"rewrite": "Rewrite",
|
||||
"insertBelow": "Insert below"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user