Skip to content

Commit c0aa0e0

Browse files
authored
fix: some launch review issues (#7379)
* fix: some launch review issues * fix: some launch review issues * fix: some launch review issues * feat: add change button for icon uploader
1 parent 55fbb75 commit c0aa0e0

20 files changed

+476
-150
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
@@ -307,11 +307,13 @@ class _MobileViewPageState extends State<MobileViewPage> {
307307
),
308308
const HSpace(4),
309309
],
310-
FlowyText.medium(
311-
name,
312-
fontSize: 15.0,
313-
overflow: TextOverflow.ellipsis,
314-
figmaLineHeight: 18.0,
310+
Flexible(
311+
child: FlowyText.medium(
312+
name,
313+
fontSize: 15.0,
314+
overflow: TextOverflow.ellipsis,
315+
figmaLineHeight: 18.0,
316+
),
315317
),
316318
const HSpace(4.0),
317319
_buildLockStatusIcon(context, view),

frontend/appflowy_flutter/lib/mobile/presentation/inline_actions/mobile_inline_actions_menu_group.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,14 @@ class MobileInlineActionsWidget extends StatelessWidget {
122122
item.icon!.call(isSelected),
123123
SizedBox(width: 12),
124124
],
125-
FlowyText.regular(
126-
item.label,
127-
figmaLineHeight: 18,
128-
overflow: TextOverflow.ellipsis,
129-
fontSize: 16,
130-
color: style.menuItemSelectedTextColor,
125+
Flexible(
126+
child: FlowyText.regular(
127+
item.label,
128+
figmaLineHeight: 18,
129+
overflow: TextOverflow.ellipsis,
130+
fontSize: 16,
131+
color: style.menuItemSelectedTextColor,
132+
),
131133
),
132134
],
133135
),

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
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';
56
import 'package:flutter/material.dart';
67

8+
import 'mobile_selection_menu_item_widget.dart';
79
import 'mobile_selection_menu_widget.dart';
810

911
class MobileSelectionMenu extends SelectionMenuService {
@@ -13,7 +15,7 @@ class MobileSelectionMenu extends SelectionMenuService {
1315
required this.selectionMenuItems,
1416
this.deleteSlashByDefault = false,
1517
this.deleteKeywordsByDefault = false,
16-
this.style = SelectionMenuStyle.light,
18+
this.style = MobileSelectionMenuStyle.light,
1719
this.itemCountFilter = 0,
1820
this.startOffset = 0,
1921
this.singleColumn = false,
@@ -27,7 +29,7 @@ class MobileSelectionMenu extends SelectionMenuService {
2729
final bool singleColumn;
2830

2931
@override
30-
final SelectionMenuStyle style;
32+
final MobileSelectionMenuStyle style;
3133

3234
OverlayEntry? _selectionMenuEntry;
3335
Offset _offset = Offset.zero;
@@ -172,7 +174,7 @@ class MobileSelectionMenu extends SelectionMenuService {
172174
// Workaround: We can customize the padding through the [EditorStyle],
173175
// but the coordinates of overlay are not properly converted currently.
174176
// Just subtract the padding here as a result.
175-
const menuHeight = 192.0;
177+
const menuHeight = 192.0, menuWidth = 240.0 + 10;
176178
const menuOffset = Offset(0, 10);
177179
final editorOffset =
178180
editorState.renderBox?.localToGlobal(Offset.zero) ?? Offset.zero;
@@ -194,8 +196,9 @@ class MobileSelectionMenu extends SelectionMenuService {
194196
offset = topRight - menuOffset;
195197
_alignment = Alignment.bottomLeft;
196198

199+
final limitX = editorWidth - menuWidth;
197200
_offset = Offset(
198-
offset.dx,
201+
min(offset.dx, limitX),
199202
MediaQuery.of(context).size.height - offset.dy,
200203
);
201204
}
@@ -206,8 +209,10 @@ class MobileSelectionMenu extends SelectionMenuService {
206209
? Alignment.topRight
207210
: Alignment.bottomRight;
208211

212+
final x = editorWidth - _offset.dx + editorOffset.dx;
213+
final limitX = editorWidth - menuWidth + editorOffset.dx;
209214
_offset = Offset(
210-
editorWidth - _offset.dx + editorOffset.dx,
215+
min(x, limitX),
211216
_offset.dy,
212217
);
213218
}

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

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ class MobileSelectionMenuItemWidget extends StatelessWidget {
1111
required this.item,
1212
required this.isSelected,
1313
required this.selectionMenuStyle,
14+
required this.onTap,
1415
});
1516

1617
final EditorState editorState;
1718
final SelectionMenuService menuService;
1819
final SelectionMenuItem item;
1920
final bool isSelected;
20-
final SelectionMenuStyle selectionMenuStyle;
21+
final MobileSelectionMenuStyle selectionMenuStyle;
22+
final VoidCallback onTap;
2123

2224
@override
2325
Widget build(BuildContext context) {
@@ -58,12 +60,13 @@ class MobileSelectionMenuItemWidget extends StatelessWidget {
5860
Spacer(),
5961
Icon(
6062
Icons.keyboard_arrow_right_rounded,
61-
color: Color(0xff1E2022).withValues(alpha: 0.3),
63+
color: style.selectionMenuItemRightIconColor,
6264
),
6365
],
6466
],
6567
),
6668
onPressed: () {
69+
onTap.call();
6770
item.handler(
6871
editorState,
6972
menuService,
@@ -74,3 +77,37 @@ class MobileSelectionMenuItemWidget extends StatelessWidget {
7477
);
7578
}
7679
}
80+
81+
class MobileSelectionMenuStyle extends SelectionMenuStyle {
82+
const MobileSelectionMenuStyle({
83+
required super.selectionMenuBackgroundColor,
84+
required super.selectionMenuItemTextColor,
85+
required super.selectionMenuItemIconColor,
86+
required super.selectionMenuItemSelectedTextColor,
87+
required super.selectionMenuItemSelectedIconColor,
88+
required super.selectionMenuItemSelectedColor,
89+
required this.selectionMenuItemRightIconColor,
90+
});
91+
92+
final Color selectionMenuItemRightIconColor;
93+
94+
static const MobileSelectionMenuStyle light = MobileSelectionMenuStyle(
95+
selectionMenuBackgroundColor: Color(0xFFFFFFFF),
96+
selectionMenuItemTextColor: Color(0xFF1F2225),
97+
selectionMenuItemIconColor: Color(0xFF333333),
98+
selectionMenuItemSelectedColor: Color(0xFFF2F5F7),
99+
selectionMenuItemRightIconColor: Color(0xB31E2022),
100+
selectionMenuItemSelectedTextColor: Color.fromARGB(255, 56, 91, 247),
101+
selectionMenuItemSelectedIconColor: Color.fromARGB(255, 56, 91, 247),
102+
);
103+
104+
static const MobileSelectionMenuStyle dark = MobileSelectionMenuStyle(
105+
selectionMenuBackgroundColor: Color(0xFF424242),
106+
selectionMenuItemTextColor: Color(0xFFFFFFFF),
107+
selectionMenuItemIconColor: Color(0xFFFFFFFF),
108+
selectionMenuItemSelectedColor: Color(0xFF666666),
109+
selectionMenuItemRightIconColor: Color(0xB3FFFFFF),
110+
selectionMenuItemSelectedTextColor: Color(0xFF131720),
111+
selectionMenuItemSelectedIconColor: Color(0xFF131720),
112+
);
113+
}

0 commit comments

Comments
 (0)