Skip to content

Commit c7da516

Browse files
committed
fix: some launch review issues
1 parent 0e7ac85 commit c7da516

File tree

7 files changed

+47
-47
lines changed

7 files changed

+47
-47
lines changed

frontend/appflowy_flutter/integration_test/mobile/document/slash_menu_test.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:appflowy/mobile/presentation/selection_menu/mobile_selection_menu_item.dart';
12
import 'package:appflowy/mobile/presentation/selection_menu/mobile_selection_menu_item_widget.dart';
23
import 'package:appflowy/mobile/presentation/selection_menu/mobile_selection_menu_widget.dart';
34
import 'package:appflowy/plugins/document/presentation/editor_plugins/slash_menu/slash_menu_items/mobile_items.dart';
@@ -36,8 +37,16 @@ void main() {
3637
await tester.ime.insertText(searchText);
3738
final itemWidgets = find.byType(MobileSelectionMenuItemWidget);
3839
int number = 0;
39-
for (final mobileItem in mobileItems) {
40-
for (final item in mobileItem.children) {
40+
for (final item in mobileItems) {
41+
if (item is MobileSelectionMenuItem) {
42+
for (final childItem in item.children) {
43+
if (childItem.name
44+
.toLowerCase()
45+
.contains(searchText.toLowerCase())) {
46+
number++;
47+
}
48+
}
49+
} else {
4150
if (item.name.toLowerCase().contains(searchText.toLowerCase())) {
4251
number++;
4352
}
@@ -55,6 +64,7 @@ void main() {
5564
matching: find.byType(ListView),
5665
);
5766
for (final item in mobileItems) {
67+
if (item is! MobileSelectionMenuItem) continue;
5868
await tester.editor.showSlashMenu();
5969
await tester.scrollUntilVisible(
6070
find.text(item.name),

frontend/appflowy_flutter/lib/mobile/presentation/base/mobile_view_page.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,13 @@ class _MobileViewPageState extends State<MobileViewPage> {
304304
),
305305
const HSpace(4),
306306
],
307-
FlowyText.medium(
308-
widget.fixedTitle ?? view?.name ?? widget.title ?? '',
309-
fontSize: 15.0,
310-
overflow: TextOverflow.ellipsis,
311-
figmaLineHeight: 18.0,
307+
Flexible(
308+
child: FlowyText.medium(
309+
widget.fixedTitle ?? view?.name ?? widget.title ?? ' ',
310+
fontSize: 15.0,
311+
overflow: TextOverflow.ellipsis,
312+
figmaLineHeight: 18.0,
313+
),
312314
),
313315
const HSpace(4.0),
314316
_buildLockStatusIcon(context, view),

frontend/appflowy_flutter/lib/mobile/presentation/selection_menu/mobile_selection_menu.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
import 'dart:math';
23

34
import 'package:appflowy/mobile/presentation/selection_menu/mobile_selection_menu_item.dart';
45
import 'package:appflowy_editor/appflowy_editor.dart';
@@ -172,7 +173,7 @@ class MobileSelectionMenu extends SelectionMenuService {
172173
// Workaround: We can customize the padding through the [EditorStyle],
173174
// but the coordinates of overlay are not properly converted currently.
174175
// Just subtract the padding here as a result.
175-
const menuHeight = 192.0;
176+
const menuHeight = 192.0, menuWidth = 240.0 + 10;
176177
const menuOffset = Offset(0, 10);
177178
final editorOffset =
178179
editorState.renderBox?.localToGlobal(Offset.zero) ?? Offset.zero;
@@ -194,8 +195,9 @@ class MobileSelectionMenu extends SelectionMenuService {
194195
offset = topRight - menuOffset;
195196
_alignment = Alignment.bottomLeft;
196197

198+
final limitX = editorWidth - menuWidth;
197199
_offset = Offset(
198-
offset.dx,
200+
min(offset.dx, limitX),
199201
MediaQuery.of(context).size.height - offset.dy,
200202
);
201203
}
@@ -206,8 +208,10 @@ class MobileSelectionMenu extends SelectionMenuService {
206208
? Alignment.topRight
207209
: Alignment.bottomRight;
208210

211+
final x = editorWidth - _offset.dx + editorOffset.dx;
212+
final limitX = editorWidth - menuWidth + editorOffset.dx;
209213
_offset = Offset(
210-
editorWidth - _offset.dx + editorOffset.dx,
214+
min(x, limitX),
211215
_offset.dy,
212216
);
213217
}

frontend/appflowy_flutter/lib/mobile/presentation/selection_menu/mobile_selection_menu_item_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class MobileSelectionMenuItemWidget extends StatelessWidget {
5858
Spacer(),
5959
Icon(
6060
Icons.keyboard_arrow_right_rounded,
61-
color: Color(0xff1E2022).withValues(alpha: 0.3),
61+
color: style.selectionMenuItemTextColor.withValues(alpha: 0.3),
6262
),
6363
],
6464
],

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_menu_items/mobile_items.dart

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ import 'package:easy_localization/easy_localization.dart';
77

88
import 'slash_menu_items.dart';
99

10-
final List<MobileSelectionMenuItem> mobileItems = [
10+
final List<SelectionMenuItem> mobileItems = [
1111
textStyleMobileSlashMenuItem,
1212
listMobileSlashMenuItem,
1313
toggleListMobileSlashMenuItem,
1414
fileOrMediaMobileSlashMenuItem,
1515
decorationsMobileSlashMenuItem,
16-
tableMobileSlashMenuItem,
17-
dateOrReminderMobileSlashMenuItem,
16+
tableSlashMenuItem,
17+
dateOrReminderSlashMenuItem,
1818
advancedMobileSlashMenuItem,
1919
];
2020

21-
final List<MobileSelectionMenuItem> mobileItemsInTale = [
21+
final List<SelectionMenuItem> mobileItemsInTale = [
2222
textStyleMobileSlashMenuItem,
2323
listMobileSlashMenuItem,
2424
toggleListMobileSlashMenuItem,
2525
fileOrMediaMobileSlashMenuItem,
2626
decorationsMobileSlashMenuItem,
27-
dateOrReminderMobileSlashMenuItem,
27+
dateOrReminderSlashMenuItem,
2828
advancedMobileSlashMenuItem,
2929
];
3030

@@ -113,31 +113,6 @@ MobileSelectionMenuItem decorationsMobileSlashMenuItem =
113113
],
114114
);
115115

116-
MobileSelectionMenuItem tableMobileSlashMenuItem = MobileSelectionMenuItem(
117-
getName: LocaleKeys.document_slashMenu_name_table.tr,
118-
handler: _handler,
119-
icon: (_, isSelected, style) => SelectableSvgWidget(
120-
data: FlowySvgs.slash_menu_icon_simple_table_s,
121-
isSelected: isSelected,
122-
style: style,
123-
),
124-
nameBuilder: slashMenuItemNameBuilder,
125-
children: [tableSlashMenuItem],
126-
);
127-
128-
MobileSelectionMenuItem dateOrReminderMobileSlashMenuItem =
129-
MobileSelectionMenuItem(
130-
getName: LocaleKeys.document_slashMenu_name_dateOrReminder.tr,
131-
handler: _handler,
132-
icon: (_, isSelected, style) => SelectableSvgWidget(
133-
data: FlowySvgs.slash_menu_icon_date_or_reminder_s,
134-
isSelected: isSelected,
135-
style: style,
136-
),
137-
nameBuilder: slashMenuItemNameBuilder,
138-
children: [dateOrReminderSlashMenuItem],
139-
);
140-
141116
MobileSelectionMenuItem advancedMobileSlashMenuItem = MobileSelectionMenuItem(
142117
getName: LocaleKeys.document_slashMenu_name_advanced.tr,
143118
handler: _handler,

frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class InlinePageReferenceService extends InlineActionsDelegate {
236236
keywords: [view.nameOrDefault.toLowerCase()],
237237
label: view.nameOrDefault,
238238
icon: (onSelected) => view.icon.value.isNotEmpty
239-
? EmojiIconWidget(
239+
? RawEmojiIconWidget(
240240
emoji: view.icon.toEmojiIconData(),
241241
emojiSize: 14,
242242
)

frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_menu_group.dart

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,27 @@ class InlineActionsWidget extends StatefulWidget {
9292
class _InlineActionsWidgetState extends State<InlineActionsWidget> {
9393
@override
9494
Widget build(BuildContext context) {
95+
final icon = widget.item.icon;
96+
final hasIcon = icon != null;
9597
return Padding(
9698
padding: const EdgeInsets.symmetric(vertical: 2),
9799
child: SizedBox(
98100
width: kInlineMenuWidth,
99101
child: FlowyButton(
100102
expand: true,
101103
isSelected: widget.isSelected,
102-
leftIcon: widget.item.icon?.call(widget.isSelected),
103-
text: FlowyText.regular(
104-
widget.item.label,
105-
figmaLineHeight: 18,
106-
overflow: TextOverflow.ellipsis,
104+
text: Row(
105+
children: [
106+
if (hasIcon) ...[
107+
icon.call(widget.isSelected),
108+
SizedBox(width: 12),
109+
],
110+
FlowyText.regular(
111+
widget.item.label,
112+
figmaLineHeight: 18,
113+
overflow: TextOverflow.ellipsis,
114+
),
115+
],
107116
),
108117
onTap: _onPressed,
109118
),

0 commit comments

Comments
 (0)