Pārlūkot izejas kodu

fix: scrolling selection-menu when it goes out of bound, fixes #2019 (#2035)

* fix: scrolling selection-menu when it goes out of bound

* refactor: added comma as per style guidelines
Samiksha Garg 2 gadi atpakaļ
vecāks
revīzija
893aae002e

+ 18 - 14
frontend/appflowy_flutter/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_service.dart

@@ -91,20 +91,24 @@ class SelectionMenu implements SelectionMenuService {
         top: showBelow ? _offset.dy : null,
         top: showBelow ? _offset.dy : null,
         bottom: showBelow ? null : _offset.dy,
         bottom: showBelow ? null : _offset.dy,
         left: offset.dx,
         left: offset.dx,
-        child: SelectionMenuWidget(
-          items: [
-            ..._defaultSelectionMenuItems,
-            ...editorState.selectionMenuItems,
-          ],
-          maxItemInRow: 5,
-          editorState: editorState,
-          menuService: this,
-          onExit: () {
-            dismiss();
-          },
-          onSelectionUpdate: () {
-            _selectionUpdateByInner = true;
-          },
+        right: 0,
+        child: SingleChildScrollView(
+          scrollDirection: Axis.horizontal,
+          child: SelectionMenuWidget(
+            items: [
+              ..._defaultSelectionMenuItems,
+              ...editorState.selectionMenuItems,
+            ],
+            maxItemInRow: 5,
+            editorState: editorState,
+            menuService: this,
+            onExit: () {
+              dismiss();
+            },
+            onSelectionUpdate: () {
+              _selectionUpdateByInner = true;
+            },
+          ),
         ),
         ),
       );
       );
     });
     });