Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ScrollViewKeyboardDismissBehavior #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
Google Inc.
Abhijeeth Padarthi <[email protected]>
Alex Li <[email protected]>
Satya Prakash <[email protected]>
2 changes: 1 addition & 1 deletion packages/flutter_simple_treeview/lib/src/node_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class _NodeWidgetState extends State<NodeWidget> {
),
if (_isExpanded && !_isLeaf)
Padding(
padding: EdgeInsets.only(left: widget.indent!),
padding: EdgeInsetsDirectional.only(start: widget.indent!),
child: buildNodes(widget.treeNode.children!, widget.indent,
widget.state, widget.iconSize),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class PositionedList extends StatefulWidget {
this.addSemanticIndexes = true,
this.addRepaintBoundaries = true,
this.addAutomaticKeepAlives = true,
this.keyboardDismissBehavior,
}) : assert(itemCount != null),
assert(itemBuilder != null),
assert((positionedIndex == 0) || (positionedIndex < itemCount)),
Expand Down Expand Up @@ -131,7 +132,9 @@ class PositionedList extends StatefulWidget {
///
/// See [SliverChildBuilderDelegate.addAutomaticKeepAlives].
final bool addAutomaticKeepAlives;

/// A representation of how a [ScrollView] should dismiss
/// the on-screen keyboard.
final ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior;
@override
State<StatefulWidget> createState() => _PositionedListState();
}
Expand Down Expand Up @@ -177,6 +180,7 @@ class _PositionedListState extends State<PositionedList> {
physics: widget.physics,
shrinkWrap: widget.shrinkWrap,
semanticChildCount: widget.semanticChildCount ?? widget.itemCount,
keyboardDismissBehavior: widget.keyboardDismissBehavior,
slivers: <Widget>[
if (widget.positionedIndex > 0)
SliverPadding(
Expand Down
3 changes: 3 additions & 0 deletions packages/scrollable_positioned_list/lib/src/scroll_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class UnboundedCustomScrollView extends CustomScrollView {
List<Widget> slivers = const <Widget>[],
int? semanticChildCount,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior,
}) : _shrinkWrap = shrinkWrap,
_anchor = anchor,
super(
Expand All @@ -43,6 +44,8 @@ class UnboundedCustomScrollView extends CustomScrollView {
semanticChildCount: semanticChildCount,
dragStartBehavior: dragStartBehavior,
slivers: slivers,
keyboardDismissBehavior: keyboardDismissBehavior ??
ScrollViewKeyboardDismissBehavior.manual,
);

// [CustomScrollView] enforces constraints on [CustomScrollView.anchor], so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ScrollablePositionedList extends StatefulWidget {
this.addAutomaticKeepAlives = true,
this.addRepaintBoundaries = true,
this.minCacheExtent,
this.keyboardDismissBehavior,
}) : assert(itemCount != null),
assert(itemBuilder != null),
itemPositionsNotifier = itemPositionsListener as ItemPositionsNotifier?,
Expand Down Expand Up @@ -87,6 +88,7 @@ class ScrollablePositionedList extends StatefulWidget {
this.addAutomaticKeepAlives = true,
this.addRepaintBoundaries = true,
this.minCacheExtent,
this.keyboardDismissBehavior,
}) : assert(itemCount != null),
assert(itemBuilder != null),
assert(separatorBuilder != null),
Expand Down Expand Up @@ -185,6 +187,9 @@ class ScrollablePositionedList extends StatefulWidget {
/// in builds of widgets that would otherwise already be built in the
/// cache extent.
final double? minCacheExtent;
/// A representation of how a [ScrollView] should dismiss
/// the on-screen keyboard.
final ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior;

@override
State<StatefulWidget> createState() => _ScrollablePositionedListState();
Expand Down Expand Up @@ -437,6 +442,7 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
padding: widget.padding,
addAutomaticKeepAlives: widget.addAutomaticKeepAlives,
addRepaintBoundaries: widget.addRepaintBoundaries,
keyboardDismissBehavior: widget.keyboardDismissBehavior,
),
),
),
Expand Down Expand Up @@ -467,6 +473,7 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
padding: widget.padding,
addAutomaticKeepAlives: widget.addAutomaticKeepAlives,
addRepaintBoundaries: widget.addRepaintBoundaries,
keyboardDismissBehavior: widget.keyboardDismissBehavior,
),
),
),
Expand Down