Skip to content

Commit

Permalink
feat(keyboard): Add keyboard dismiss behavious parameter #212 #195
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyozer committed Mar 23, 2024
1 parent 8cd9e6b commit a0d36fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ You can provide many parameters to customize each pages:
- See next section for all parameters you can pass
- `reverse: true`, reverse order of image and content (title/body). (Default: `false`)
- `useScrollView: false`, by default pages use a Scrollview to handle small screen or long body text. You can remove ScrollView by setting to false.
- `scrollViewKeyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual`, by default the keyboard dismiss behavious is manual, you can change it.
- Only used if useScrollView not set to false.

### PageDecoration parameters

Expand Down
5 changes: 5 additions & 0 deletions lib/src/model/page_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class PageViewModel {
/// Wrap content in scrollView
final bool useScrollView;

/// Keyboard dismiss behavious for scrollView
final ScrollViewKeyboardDismissBehavior scrollViewKeyboardDismissBehavior;

/// Use Row instead of Column when in landscape to place image next to the content.
final bool useRowInLandscape;

Expand All @@ -44,6 +47,8 @@ class PageViewModel {
this.reverse = false,
this.decoration = const PageDecoration(),
this.useScrollView = true,
this.scrollViewKeyboardDismissBehavior =
ScrollViewKeyboardDismissBehavior.manual,
this.useRowInLandscape = false,
}) : assert(
title != null || titleWidget != null,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/ui/intro_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class _IntroPageState extends State<IntroPage>
? SingleChildScrollView(
controller: widget.scrollController,
physics: const BouncingScrollPhysics(),
keyboardDismissBehavior:
page.scrollViewKeyboardDismissBehavior,
child: content,
)
: content,
Expand Down

0 comments on commit a0d36fe

Please sign in to comment.