From a0606cff4575bdbee3137baca471495a752f3a1b Mon Sep 17 00:00:00 2001 From: Jeho Date: Mon, 8 Apr 2024 13:08:32 +0900 Subject: [PATCH] update 1.0.5 (ref changelog) --- CHANGELOG.md | 3 +++ README.md | 7 +++++-- lib/number_pagination.dart | 20 +++++++++++++------- pubspec.yaml | 2 +- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c77d8c5..4755e19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.0.5 +- Add new property: buttonSpacing, groupSpacing. + ## 1.0.4 - Remove autoSetState. - Add new property: buttonElevation, buttonRadius. diff --git a/README.md b/README.md index 67e6040..3ae8dee 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/lib/number_pagination.dart b/lib/number_pagination.dart index 0472e5c..9d1f79e 100644 --- a/lib/number_pagination.dart +++ b/lib/number_pagination.dart @@ -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 @@ -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 { - static const double buttonSpacing = 4.0; - static const double groupSpacing = 10.0; late int currentPage; @override @@ -140,7 +146,7 @@ class _NumberPaginationState extends State { ); } - Widget _buildControlButton(Widget icon, bool enabled, VoidCallback? onTap) { + Widget _buildControlButton(Widget icon, bool enabled, VoidCallback onTap) { return ElevatedButton( style: ElevatedButton.styleFrom( elevation: widget.buttonElevation, @@ -178,21 +184,21 @@ class _NumberPaginationState extends State { 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, diff --git a/pubspec.yaml b/pubspec.yaml index 6069f3c..b8d060f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: