Skip to content

Commit

Permalink
Update CHANGELOG, README, version to 5.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Frezyx committed May 18, 2023
1 parent 2f00f9c commit 01ecf91
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 5.3.0

- Implement **buttonIndexedTextBuilder** and **buttonTextBuilder**
for building only text of buttons. See more in [docs](https://github.com/Frezyx/group_button)
- Recreate example host folders

## 5.2.2
- **INFO** Update README badages
## 5.2.1
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ GroupButton<DateTime>(
)
```

### Button builders

Also you can use generic button values with cutsom buttonBuilder <br>
In order to turn values into any widget
```dart
Expand All @@ -104,7 +106,14 @@ GroupButton<DateTime>(
),
```

### Customize
In this package, there are four different possibilities for customizing your buttons through builders

- 1 **buttonBuilder** It will build a fully custom button based on the value parameter
- 2 **buttonIndexedBuilder** same as buttonBuilder. But based on button index.
- 3 **buttonTextBuilder** It will replace the text of your button, which is constructed based on the style parameters passed in GroupButtonOptions. The appearance of the button remains the same, but the text is changed. Based on button value.
- 4 **buttonIndexedTextBuilder** same as buttonTextBuilder. But based on button index.

### Fully Customize
In order to customize your buttons inside *GroupButton* you can use *GroupButtonOptions*

```dart
Expand Down
6 changes: 3 additions & 3 deletions lib/src/group_button_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GroupButton<T> extends StatelessWidget {
this.buttonIndexedBuilder,
this.buttonBuilder,
this.buttonIndexedTextBuilder,
this.buttonValueTextBuilder,
this.buttonTextBuilder,
this.enableDeselect = false,
this.maxSelected,
@Deprecated(
Expand Down Expand Up @@ -95,7 +95,7 @@ class GroupButton<T> extends StatelessWidget {
///
/// If you do not set up [buttonIndexedBuilder] and [buttonBuilder],
/// the text will be displayed on top of the button.
final GroupButtonValueTextBuilder<T>? buttonValueTextBuilder;
final GroupbuttonTextBuilder<T>? buttonTextBuilder;

@override
Widget build(BuildContext context) {
Expand All @@ -108,7 +108,7 @@ class GroupButton<T> extends StatelessWidget {
buttonIndexedBuilder: buttonIndexedBuilder,
buttonBuilder: buttonBuilder,
buttonIndexedTextBuilder: buttonIndexedTextBuilder,
buttonValueTextBuilder: buttonValueTextBuilder,
buttonTextBuilder: buttonTextBuilder,
enableDeselect: enableDeselect,
maxSelected: maxSelected,

Expand Down
6 changes: 3 additions & 3 deletions lib/src/group_button_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GroupButtonBody<T> extends StatefulWidget {
this.buttonIndexedBuilder,
this.buttonBuilder,
this.buttonIndexedTextBuilder,
this.buttonValueTextBuilder,
this.buttonTextBuilder,
}) : super(key: key);

final List<T> buttons;
Expand Down Expand Up @@ -75,7 +75,7 @@ class GroupButtonBody<T> extends StatefulWidget {
final GroupButtonIndexedBuilder? buttonIndexedBuilder;
final GroupButtonValueBuilder<T>? buttonBuilder;
final GroupButtonIndexedTextBuilder? buttonIndexedTextBuilder;
final GroupButtonValueTextBuilder<T>? buttonValueTextBuilder;
final GroupbuttonTextBuilder<T>? buttonTextBuilder;

@override
State<GroupButtonBody<T>> createState() => _GroupButtonBodyState<T>();
Expand Down Expand Up @@ -168,7 +168,7 @@ class _GroupButtonBodyState<T> extends State<GroupButtonBody<T>> {
button = GroupButtonItem(
text: widget.buttonIndexedTextBuilder
?.call(_isSelected(i), i, context) ??
widget.buttonValueTextBuilder
widget.buttonTextBuilder
?.call(_isSelected(i), widget.buttons[i], context) ??
widget.buttons[i].toString(),
onPressed: _controller.disabledIndexes.contains(i)
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/models/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typedef GroupButtonIndexedTextBuilder = String Function(
);

/// Custom builder method to create custom buttons by value
typedef GroupButtonValueTextBuilder<T> = String Function(
typedef GroupbuttonTextBuilder<T> = String Function(
bool selected,
T value,
BuildContext context,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: group_button
description: Flutter custom widget to make a group buttons. Included Radio and CheckBox buttons.
version: 5.2.2
version: 5.3.0
homepage: https://github.com/Frezyx/group_button

environment:
Expand Down

0 comments on commit 01ecf91

Please sign in to comment.