@@ -34,6 +34,7 @@ class AppFlowyEditor extends StatefulWidget {
3434 this .autoFocus = false ,
3535 this .focusedSelection,
3636 this .customActionMenuBuilder,
37+ this .shrinkWrap = false ,
3738 ThemeData ? themeData,
3839 }) : super (key: key) {
3940 this .themeData = themeData ??
@@ -55,17 +56,21 @@ class AppFlowyEditor extends StatefulWidget {
5556
5657 final List <ToolbarItem > toolbarItems;
5758
58- late final ThemeData themeData;
59-
6059 final bool editable;
6160
6261 /// Set the value to true to focus the editor on the start of the document.
6362 final bool autoFocus;
63+
6464 final Selection ? focusedSelection;
6565
6666 final Positioned Function (BuildContext context, List <ActionMenuItem > items)?
6767 customActionMenuBuilder;
6868
69+ /// If false the Editor is inside an [AppFlowyScroll]
70+ final bool shrinkWrap;
71+
72+ late final ThemeData themeData;
73+
6974 @override
7075 State <AppFlowyEditor > createState () => _AppFlowyEditorState ();
7176}
@@ -116,6 +121,7 @@ class _AppFlowyEditorState extends State<AppFlowyEditor> {
116121 @override
117122 Widget build (BuildContext context) {
118123 services ?? = _buildServices (context);
124+
119125 return Overlay (
120126 initialEntries: [
121127 OverlayEntry (
@@ -125,11 +131,21 @@ class _AppFlowyEditorState extends State<AppFlowyEditor> {
125131 );
126132 }
127133
134+ Widget _buildScroll ({required Widget child}) {
135+ if (widget.shrinkWrap) {
136+ return child;
137+ }
138+
139+ return AppFlowyScroll (
140+ key: editorState.service.scrollServiceKey,
141+ child: child,
142+ );
143+ }
144+
128145 Widget _buildServices (BuildContext context) {
129146 return Theme (
130147 data: widget.themeData,
131- child: AppFlowyScroll (
132- key: editorState.service.scrollServiceKey,
148+ child: _buildScroll (
133149 child: Container (
134150 color: editorStyle.backgroundColor,
135151 padding: editorStyle.padding! ,
0 commit comments