Skip to content

Commit

Permalink
Do not force expand when expand is false
Browse files Browse the repository at this point in the history
  • Loading branch information
amantoux committed Jul 7, 2024
1 parent 0ee5cdc commit 87d534f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/fleather/lib/src/widgets/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ class FleatherEditor extends StatefulWidget {

/// The [ScrollController] to use when vertically scrolling the contents.
///
/// If `null` then this editor instantiates a new ScrollController.
///
/// Scroll controller must not be `null` if [scrollable] is set to `false`.
/// If `null` and [scrollable] is `true` then this editor instantiates a
/// new ScrollController
final ScrollController? scrollController;

/// Whether this editor should create a scrollable container for its content.
Expand All @@ -122,9 +121,6 @@ class FleatherEditor extends StatefulWidget {
/// of the document and should normally be placed as a child of another
/// scrollable widget, otherwise the content may be clipped.
///
/// The [scrollController] property must not be `null` when this is set to
/// `false`.
///
/// Set to `true` by default.
final bool scrollable;

Expand Down Expand Up @@ -1701,8 +1697,10 @@ class RawEditorState extends EditorState
);
}

final constraints = widget.expands || widget.scrollable
? const BoxConstraints.expand()
final constraints = widget.scrollable
? widget.expands
? const BoxConstraints.expand()
: const BoxConstraints.expand().copyWith(minHeight: 0)
: BoxConstraints(
minHeight: widget.minHeight ?? 0.0,
maxHeight: widget.maxHeight ?? double.infinity);
Expand All @@ -1716,7 +1714,7 @@ class RawEditorState extends EditorState
child: Focus(
focusNode: effectiveFocusNode,
child: FleatherKeyboardListener(
child: Container(
child: ConstrainedBox(
constraints: constraints,
child: child,
),
Expand Down

0 comments on commit 87d534f

Please sign in to comment.