Skip to content

Commit

Permalink
update 1.0.5 (ref changelog)
Browse files Browse the repository at this point in the history
  • Loading branch information
xpwmaosldk committed Apr 8, 2024
1 parent 8c0d85d commit a0606cf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.5
- Add new property: buttonSpacing, groupSpacing.

## 1.0.4
- Remove autoSetState.
- Add new property: buttonElevation, buttonRadius.
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ This package is very simple. Without depending on other packages, the code is le
- Widget iconToLast
- double fontSize (default 15)
- String? fontFamily
- double? buttonElevation (default 5)
- double? buttonRadius (default 10)
- double buttonElevation (default 5)
- double buttonRadius (default 10)
- double buttonSpacing (default 4)
- double groupSpacing (default 10)
-

# Note
The number increments in the versions (+numbers) are updates unrelated to functionality (mostly related to pub.dev or documents).
20 changes: 13 additions & 7 deletions lib/number_pagination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class NumberPagination extends StatefulWidget {
this.fontFamily,
this.buttonElevation = 5,
this.buttonRadius = 10,
this.buttonSpacing = 4.0,
this.groupSpacing = 10.0,
});

///Trigger when page changed
Expand Down Expand Up @@ -67,13 +69,17 @@ class NumberPagination extends StatefulWidget {
///The Radius of the buttons.
final double buttonRadius;

// Spacing between buttons, default is 4.0
final double buttonSpacing;

// Spacing between button groups, default is 10.0
final double groupSpacing;

@override
_NumberPaginationState createState() => _NumberPaginationState();
}

class _NumberPaginationState extends State<NumberPagination> {
static const double buttonSpacing = 4.0;
static const double groupSpacing = 10.0;
late int currentPage;

@override
Expand Down Expand Up @@ -140,7 +146,7 @@ class _NumberPaginationState extends State<NumberPagination> {
);
}

Widget _buildControlButton(Widget icon, bool enabled, VoidCallback? onTap) {
Widget _buildControlButton(Widget icon, bool enabled, VoidCallback onTap) {
return ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: widget.buttonElevation,
Expand Down Expand Up @@ -178,21 +184,21 @@ class _NumberPaginationState extends State<NumberPagination> {
currentPage != 1,
() => _changePage(1),
),
SizedBox(width: buttonSpacing),
SizedBox(width: widget.buttonSpacing),
_buildControlButton(
widget.iconPrevious,
currentPage != 1,
() => _changePage(currentPage - 1),
),
SizedBox(width: groupSpacing),
SizedBox(width: widget.groupSpacing),
_buildPageNumbers(rangeStart, rangeEnd),
SizedBox(width: groupSpacing),
SizedBox(width: widget.groupSpacing),
_buildControlButton(
widget.iconNext,
currentPage != widget.pageTotal,
() => _changePage(currentPage + 1),
),
SizedBox(width: buttonSpacing),
SizedBox(width: widget.buttonSpacing),
_buildControlButton(
widget.iconToLast,
currentPage != widget.pageTotal,
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: number_pagination
description: Pagination using numbers, similar to the classic web-style pagination. Explore pages by numbers, not infinite scrolling!

version: 1.0.4
version: 1.0.5
homepage: https://github.com/xpwmaosldk/number_pagination

screenshots:
Expand Down

0 comments on commit a0606cf

Please sign in to comment.