Skip to content

Commit

Permalink
Release 5.3.3 version
Browse files Browse the repository at this point in the history
  • Loading branch information
Frezyx committed Aug 24, 2023
1 parent 3bc8602 commit d4d98e5
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 105 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 5.3.3
- Remove self linter with **flutter_lints**
- Fix linter issues
- Format files

# 5.3.2
- Update sdk version to **'>=2.15.0 <4.0.0'**

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Follow these steps to use this package

```yaml
dependencies:
group_button: ^5.3.2
group_button: ^5.3.3
```

### Add import package
Expand Down
75 changes: 1 addition & 74 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,74 +1 @@
linter:
rules:
# deprecated_member_use_from_same_package: true
# Good for libraries to prevent unnecessary code paths.
# Dart SDK: >= 2.0.0 • (Linter v0.1.25)
# https://dart-lang.github.io/linter/lints/literal_only_boolean_expressions.html
literal_only_boolean_expressions: true

# One of the most important rules. Docs for package public APIs make a good package.
# Like catching undocumented code? Enable `public_member_api_docs` as well.
# Dart SDK: >= 2.0.0 • (Linter v0.1.1)
# https://dart-lang.github.io/linter/lints/package_api_docs.html
package_api_docs: true

# Too strict. Implementing all exported public APIs (`package_api_docs`) is enough.
# Dart SDK: >= 2.0.0 • (Linter v0.1.11)
# https://dart-lang.github.io/linter/lints/public_member_api_docs.html
# public_member_api_docs

# Adding a key without using it isn't helpful in applications, only for the Flutter SDK
# Dart SDK: >= 2.8.0-dev.1.0 • (Linter v0.1.108)
# https://dart-lang.github.io/linter/lints/use_key_in_widget_constructors.html
use_key_in_widget_constructors: true
always_declare_return_types: true
annotate_overrides: true
avoid_init_to_null: true
avoid_null_checks_in_equality_operators: true
avoid_relative_lib_imports: true
avoid_return_types_on_setters: true
avoid_shadowing_type_parameters: true
avoid_single_cascade_in_expression_statements: true
avoid_types_as_parameter_names: true
await_only_futures: true
camel_case_extensions: true
curly_braces_in_flow_control_structures: true
empty_catches: true
empty_constructor_bodies: true
library_names: true
library_prefixes: true
no_duplicate_case_values: true
null_closures: true
omit_local_variable_types: true
prefer_adjacent_string_concatenation: true
prefer_collection_literals: true
prefer_conditional_assignment: true
prefer_contains: true
prefer_equal_for_default_values: true
prefer_final_fields: true
prefer_for_elements_to_map_fromIterable: true
prefer_generic_function_type_aliases: true
prefer_if_null_operators: true
prefer_inlined_adds: true
prefer_is_empty: true
prefer_is_not_empty: true
prefer_iterable_whereType: true
prefer_single_quotes: true
prefer_spread_collections: true
recursive_getters: true
slash_for_doc_comments: true
sort_child_properties_last: true
type_init_formals: true
unawaited_futures: true
unnecessary_brace_in_string_interps: true
unnecessary_const: true
unnecessary_getters_setters: true
unnecessary_new: true
unnecessary_null_in_if_null_operators: true
unnecessary_this: true
unrelated_type_equality_checks: true
unsafe_html: true
use_full_hex_values_for_flutter_colors: true
use_function_type_syntax_for_parameters: true
use_rethrow_when_possible: true
valid_regexps: true
include: package:flutter_lints/flutter.yaml
2 changes: 1 addition & 1 deletion lib/src/group_button_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GroupButton<T> extends StatelessWidget {
'Use GroupButtonController onDisabledButtonPressed field '
'This feature was deprecated after version 4.6.0 ',
)
this.onDisablePressed,
this.onDisablePressed,
}) : assert(
maxSelected != null ? maxSelected >= 0 : true,
'maxSelected must not be negative',
Expand Down
5 changes: 2 additions & 3 deletions lib/src/utils/controller/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ class GroupButtonController extends ChangeNotifier {
int? selectedIndex,
List<int> selectedIndexes = const [],
List<int> disabledIndexes = const [],
Function(int index)? onDisablePressed,
this.onDisablePressed,
}) : _selectedIndex = selectedIndex,
_selectedIndexes = selectedIndexes.toSet(),
_disabledIndexes = disabledIndexes.toSet(),
onDisablePressed = onDisablePressed;
_disabledIndexes = disabledIndexes.toSet();

int? _selectedIndex;
final Set<int> _selectedIndexes, _disabledIndexes;
Expand Down
3 changes: 2 additions & 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.3.2
version: 5.3.3
homepage: https://github.com/Frezyx/group_button
repository: https://github.com/Frezyx/group_button
issue_tracker: https://github.com/Frezyx/group_button
Expand All @@ -22,5 +22,6 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0

flutter:
48 changes: 24 additions & 24 deletions test/group_button_controller_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,66 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:group_button/group_button.dart';

void main() {
late GroupButtonController _controller;
late GroupButtonController controller;

const selectingList = [0, 1, 2, 3, 4, 5, 6];

group('Test_GroupButtonController', () {
setUp(() {
_controller = GroupButtonController();
controller = GroupButtonController();
});

group('SelectIndex', () {
test('Radio', () async {
_controller.selectIndex(10);
expect(_controller.selectedIndex, 10);
controller.selectIndex(10);
expect(controller.selectedIndex, 10);
});

test('Checkbox', () async {
_controller.selectIndex(10);
expect(_controller.selectedIndexes, contains(10));
controller.selectIndex(10);
expect(controller.selectedIndexes, contains(10));
});
});

group('UnselectIndex', () {
test('Radio', () async {
_controller.selectIndex(10);
_controller.unselectIndex(10);
expect(_controller.selectedIndex, isNull);
controller.selectIndex(10);
controller.unselectIndex(10);
expect(controller.selectedIndex, isNull);
});

test('Checkbox', () async {
_controller.selectIndex(10);
_controller.unselectIndex(10);
expect(_controller.selectedIndexes, isEmpty);
controller.selectIndex(10);
controller.unselectIndex(10);
expect(controller.selectedIndexes, isEmpty);
});
});

test('SelectIndexes', () async {
_controller.selectIndexes(selectingList);
expect(_controller.selectedIndexes, isNotEmpty);
expect(_controller.selectedIndexes, selectingList);
controller.selectIndexes(selectingList);
expect(controller.selectedIndexes, isNotEmpty);
expect(controller.selectedIndexes, selectingList);
});

group('UnselectIndexes', () {
test('All', () async {
_controller.selectIndexes(selectingList);
_controller.unselectIndexes(selectingList);
expect(_controller.selectedIndexes, isEmpty);
controller.selectIndexes(selectingList);
controller.unselectIndexes(selectingList);
expect(controller.selectedIndexes, isEmpty);
});

test('Part', () async {
_controller.selectIndexes(selectingList);
_controller.unselectIndexes(selectingList.getRange(0, 3).toList());
controller.selectIndexes(selectingList);
controller.unselectIndexes(selectingList.getRange(0, 3).toList());
final editableList = [...selectingList];
expect(_controller.selectedIndexes, editableList..removeRange(0, 3));
expect(controller.selectedIndexes, editableList..removeRange(0, 3));
});
});

test('UnselectAll', () async {
_controller.selectIndexes(selectingList);
_controller.unselectAll();
expect(_controller.selectedIndexes, isEmpty);
controller.selectIndexes(selectingList);
controller.unselectAll();
expect(controller.selectedIndexes, isEmpty);
});
});
}
2 changes: 1 addition & 1 deletion test/test_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:group_button/group_button.dart';
class GroupButtonTestWidget extends StatefulWidget {
const GroupButtonTestWidget({Key? key}) : super(key: key);
@override
_GroupButtonTestWidgetState createState() => _GroupButtonTestWidgetState();
State<GroupButtonTestWidget> createState() => _GroupButtonTestWidgetState();
}

class _GroupButtonTestWidgetState extends State<GroupButtonTestWidget> {
Expand Down

0 comments on commit d4d98e5

Please sign in to comment.