Skip to content

Commit

Permalink
Merge pull request #174 from Macacoazul01/master
Browse files Browse the repository at this point in the history
3.1.8
  • Loading branch information
ghenry authored Apr 20, 2023
2 parents 12d59c5 + c6bcd40 commit 021f11e
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 126 deletions.
1 change: 1 addition & 0 deletions .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"C:\\\\Users\\\\gian_\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_keyboard_visibility-5.4.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"C:\\\\Users\\\\gian_\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_keyboard_visibility-5.4.0\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_keyboard_visibility_macos","path":"C:\\\\Users\\\\gian_\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_keyboard_visibility_macos-1.0.0\\\\","native_build":false,"dependencies":[]}],"linux":[{"name":"flutter_keyboard_visibility_linux","path":"C:\\\\Users\\\\gian_\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_keyboard_visibility_linux-1.0.0\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"flutter_keyboard_visibility_windows","path":"C:\\\\Users\\\\gian_\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_keyboard_visibility_windows-1.0.0\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"C:\\\\Users\\\\gian_\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_linux","flutter_keyboard_visibility_macos","flutter_keyboard_visibility_web","flutter_keyboard_visibility_windows"]},{"name":"flutter_keyboard_visibility_linux","dependencies":[]},{"name":"flutter_keyboard_visibility_macos","dependencies":[]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_keyboard_visibility_windows","dependencies":[]}],"date_created":"2023-04-19 21:51:08.892689","version":"3.7.11"}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.1.8] - 2023-04-19
- Added safeAreaList parameter [PR#174](https://github.com/Pyozer/introduction_screen/pull/174)

## [3.1.7] - 2023-03-16
- Added hideBottomOnKeyboard parameter [PR#171](https://github.com/Pyozer/introduction_screen/pull/171)

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You just need to add `introduction_screen` as a [dependency in your pubspec.yaml

```yaml
dependencies:
introduction_screen: ^3.1.7
introduction_screen: ^3.1.8
```
## Examples
Expand Down Expand Up @@ -459,6 +459,7 @@ This is the full list:
- Change default implicit scrolling behavior by adding `allowImplicitScrolling: true`
- Default `false`
- Reference: [PageView's `allowImplicitScrolling` parameter](https://api.flutter.dev/flutter/widgets/PageView/PageView.html)
- Activate the SafeArea by setting `safeAreaList: [true,true,true,true]` parameter.

### PageViewModel parameters

Expand Down
29 changes: 0 additions & 29 deletions example/test/widget_test.dart

This file was deleted.

203 changes: 108 additions & 95 deletions lib/src/introduction_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ class IntroductionScreen extends StatefulWidget {
/// @Default `false`
final bool allowImplicitScrolling;

/// PageView's bool safe area list.
/// the list defines if the safe area will be active on left,right,top and bottom, respectively.
///
/// @Default `[false,false,false,false]`
final List<bool> safeAreaList;

/// A handler to check if the user is allowed to progress to the next page.
/// If returned value is true, the page will progress to the next page, otherwise the page will not progress.
/// In order to make it work properly with TextFormField, you should place setState in the onChanged callback of the TextFormField.
Expand Down Expand Up @@ -332,6 +338,7 @@ class IntroductionScreen extends StatefulWidget {
this.rtl = false,
this.allowImplicitScrolling = false,
this.canProgress = defaultCanProgressFunction,
this.safeAreaList = const [false,false,false,false]
}) : assert(
pages != null || rawPages != null,
"You must set either 'pages' or 'rawPages' parameter",
Expand Down Expand Up @@ -551,106 +558,112 @@ class IntroductionScreenState extends State<IntroductionScreen> {
);
}

return Scaffold(
backgroundColor: widget.globalBackgroundColor,
resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset,
body: Stack(
children: [
Positioned.fill(
top: widget.bodyPadding.top,
left: widget.bodyPadding.left,
right: widget.bodyPadding.right,
bottom: widget.bodyPadding.bottom,
child: NotificationListener<ScrollNotification>(
onNotification: _onScroll,
child: PageView(
reverse: widget.rtl,
scrollDirection: widget.pagesAxis,
controller: _pageController,
onPageChanged: widget.onChange,
allowImplicitScrolling: widget.allowImplicitScrolling,
physics: widget.freeze
? const NeverScrollableScrollPhysics()
: !widget.canProgress(_currentPage)
? const NeverScrollableScrollPhysics()
: widget.scrollPhysics,
children: widget.pages
?.mapIndexed(
(index, page) => IntroPage(
page: page,
scrollController:
(CustomList(widget.scrollControllers)
?.elementAtOrNull(index)),
isTopSafeArea: widget.isTopSafeArea,
isBottomSafeArea: widget.isBottomSafeArea,
),
)
.toList() ??
widget.rawPages!,
return SafeArea(
left: widget.safeAreaList[0],
right: widget.safeAreaList[1],
top: widget.safeAreaList[2],
bottom: widget.safeAreaList[3],
child: Scaffold(
backgroundColor: widget.globalBackgroundColor,
resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset,
body: Stack(
children: [
Positioned.fill(
top: widget.bodyPadding.top,
left: widget.bodyPadding.left,
right: widget.bodyPadding.right,
bottom: widget.bodyPadding.bottom,
child: NotificationListener<ScrollNotification>(
onNotification: _onScroll,
child: PageView(
reverse: widget.rtl,
scrollDirection: widget.pagesAxis,
controller: _pageController,
onPageChanged: widget.onChange,
allowImplicitScrolling: widget.allowImplicitScrolling,
physics: widget.freeze
? const NeverScrollableScrollPhysics()
: !widget.canProgress(_currentPage)
? const NeverScrollableScrollPhysics()
: widget.scrollPhysics,
children: widget.pages
?.mapIndexed(
(index, page) => IntroPage(
page: page,
scrollController:
(CustomList(widget.scrollControllers)
?.elementAtOrNull(index)),
isTopSafeArea: widget.isTopSafeArea,
isBottomSafeArea: widget.isBottomSafeArea,
),
)
.toList() ??
widget.rawPages!,
),
),
),
),
if (widget.globalHeader != null)
Positioned(
top: 0,
left: 0,
right: 0,
child: widget.globalHeader!,
),
if (_showBottom)
Positioned(
left: widget.controlsPosition.left,
top: widget.controlsPosition.top,
right: widget.controlsPosition.right,
bottom: widget.controlsPosition.bottom,
child: Column(
children: [
Container(
padding: widget.controlsPadding,
margin: widget.controlsMargin,
decoration: widget.dotsContainerDecorator,
child: Row(
children: [
Expanded(
flex: widget.skipOrBackFlex,
child: leftBtn ?? const SizedBox(),
),
Expanded(
flex: widget.dotsFlex,
child: Center(
child: widget.isProgress
? widget.customProgress ??
Semantics(
label:
"Page ${_currentPage.round() + 1} of ${getPagesLength()}",
excludeSemantics: true,
child: DotsIndicator(
reversed: widget.rtl,
dotsCount: getPagesLength(),
position: _currentPage,
decorator: widget.dotsDecorator,
onTap: widget.isProgressTap &&
!widget.freeze
? (pos) =>
animateScroll(pos.toInt())
: null,
),
)
: const SizedBox(),
if (widget.globalHeader != null)
Positioned(
top: 0,
left: 0,
right: 0,
child: widget.globalHeader!,
),
if (_showBottom)
Positioned(
left: widget.controlsPosition.left,
top: widget.controlsPosition.top,
right: widget.controlsPosition.right,
bottom: widget.controlsPosition.bottom,
child: Column(
children: [
Container(
padding: widget.controlsPadding,
margin: widget.controlsMargin,
decoration: widget.dotsContainerDecorator,
child: Row(
children: [
Expanded(
flex: widget.skipOrBackFlex,
child: leftBtn ?? const SizedBox(),
),
),
Expanded(
flex: widget.nextFlex,
child: rightBtn ?? const SizedBox(),
),
].asReversed(widget.rtl),
Expanded(
flex: widget.dotsFlex,
child: Center(
child: widget.isProgress
? widget.customProgress ??
Semantics(
label:
"Page ${_currentPage.round() + 1} of ${getPagesLength()}",
excludeSemantics: true,
child: DotsIndicator(
reversed: widget.rtl,
dotsCount: getPagesLength(),
position: _currentPage,
decorator: widget.dotsDecorator,
onTap: widget.isProgressTap &&
!widget.freeze
? (pos) =>
animateScroll(pos.toInt())
: null,
),
)
: const SizedBox(),
),
),
Expanded(
flex: widget.nextFlex,
child: rightBtn ?? const SizedBox(),
),
].asReversed(widget.rtl),
),
),
),
if (widget.globalFooter != null) widget.globalFooter!
],
if (widget.globalFooter != null) widget.globalFooter!
],
),
),
),
],
],
),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: introduction_screen
description: Introduction/Onboarding package for flutter app with some customizations possibilities

version: 3.1.7
version: 3.1.8

homepage: https://github.com/pyozer/introduction_screen

Expand Down

0 comments on commit 021f11e

Please sign in to comment.