Skip to content

Commit 8daed63

Browse files
authored
Merge pull request #8 from jlnrrg/feature/iconList
Major Changes
2 parents 7de6463 + 86f97c8 commit 8daed63

15 files changed

+1402
-525
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.buildlog/
99
.history
1010
.svn/
11+
.vscode/
1112

1213
# IntelliJ related
1314
*.iml

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.0.0 - 2021-03-10
2+
3+
* **Breaking change:** icons passed as List
4+
* AnimationDirection added
5+
16
## 0.4.1 - 2021-02-28
27

38
* Create travis QA

README.md

Lines changed: 78 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
😊 Flutter package to create custom <strong>animated</strong> IconButton.</br>
77
😵 <strong>Includes all available icons.</strong> Based on native IconButton.
88

9+
## Breaking Change
10+
After `1.0.0` version you can use multiple icons.
11+
12+
913
<img src="https://github.com/Frezyx/animated_icon_button/blob/master/example/rep_files/preview.gif?raw=true" width="270">
1014

1115
## Getting Started
@@ -15,7 +19,7 @@ Follow these steps to use this library
1519

1620
```yaml
1721
dependencies:
18-
animated_icon_button: ^0.4.1 #latest version
22+
animated_icon_button: ^1.0.0 #latest version
1923
```
2024
2125
### Add import package
@@ -26,24 +30,59 @@ import 'package:animated_icon_button/animated_icon_button.dart';
2630

2731
### Easy to use
2832
Simple example of use AnimatedIconButton<br>
29-
Put this code in your project at an screen and learn how it works 😊
33+
Put this code in your project at an screen and wait for magic 😊
34+
```dart
35+
AnimatedIconButton(
36+
onPressed: () => print('all icons pressed'),
37+
icons: [
38+
AnimatedIconButtonEntry(
39+
icon: Icon(Icons.add),
40+
onPressed: () => print('add pressed'),
41+
),
42+
AnimatedIconButtonEntry(
43+
icon: Icon(Icons.close),
44+
),
45+
],
46+
),
47+
```
48+
49+
50+
### More icons
51+
Now you can use more than 2 icons
52+
Add new icons to your list and they will change one by one
3053

3154
```dart
3255
AnimatedIconButton(
3356
size: 35,
3457
onPressed: () {
35-
print("button with color pressed");
58+
print('all icons pressed');
3659
},
37-
duration: Duration(milliseconds: 200),
38-
endIcon: Icon(
39-
Icons.close,
40-
color: Colors.red,
60+
duration: const Duration(milliseconds: 200),
61+
icons: <AnimatedIconButtonEntry>[
62+
AnimatedIconButtonEntry(
63+
icon: Icon(
64+
Icons.mic,
65+
color: Colors.purple,
66+
),
67+
onPressed: () => print('mic pressed'),
68+
backgroundColor: Colors.white,
69+
),
70+
AnimatedIconButtonEntry(
71+
icon: Icon(
72+
Icons.g_translate,
73+
color: Colors.purple,
74+
),
75+
backgroundColor: Colors.white,
4176
),
42-
startIcon: Icon(
43-
Icons.add,
44-
color: Colors.purple,
45-
),
46-
)
77+
AnimatedIconButtonEntry(
78+
icon: Icon(
79+
Icons.collections_sharp,
80+
color: Colors.purple,
81+
),
82+
backgroundColor: Colors.white,
83+
),
84+
],
85+
),
4786
```
4887

4988
### Custom animation controller
@@ -61,35 +100,37 @@ In order to animate your icons in a custom way, like on text changed or when pre
61100
animationController: animationController,
62101
size: 35,
63102
onPressed: () {
64-
print("button with color pressed");
103+
print('all icons pressed');
65104
},
66-
endIcon: Icon(
67-
Icons.close,
68-
color: Colors.red,
105+
duration: const Duration(milliseconds: 200),
106+
icons: <AnimatedIconButtonEntry>[
107+
AnimatedIconButtonEntry(
108+
icon: Icon(
109+
Icons.mic,
110+
color: Colors.purple,
111+
),
112+
onPressed: () => print('mic pressed'),
113+
backgroundColor: Colors.white,
114+
),
115+
AnimatedIconButtonEntry(
116+
icon: Icon(
117+
Icons.g_translate,
118+
color: Colors.purple,
119+
),
120+
backgroundColor: Colors.white,
69121
),
70-
startIcon: Icon(
71-
Icons.add,
72-
color: Colors.purple,
73-
),
74-
)
122+
AnimatedIconButtonEntry(
123+
icon: Icon(
124+
Icons.collections_sharp,
125+
color: Colors.purple,
126+
),
127+
backgroundColor: Colors.white,
128+
),
129+
],
130+
),
75131
```
76132

77133
Then, whenever you want, execute your ```animationController.forward()``` and ```animationController.reverse()``` methods to get your icons animated.
78134

79-
Don't forget to remove ```duration``` from your ```AnimatedIconButton``` when using this property.
80-
81-
### Attributes
82-
83-
<strong>size:</strong> The size of AnimatedIconButton <br>
84-
<strong>startIcon:</strong> The icon of the AnimatedIconButton when button is not pressed.<br>
85-
<strong>endIcon:</strong> The icon of the AnimatedIconButton when button is pressed. <br>
86-
<strong>duration:</strong> Animation time of the AnimatedIconButton. <br>
87-
<strong>startBackgroundColor:</strong> The background Color of the AnimatedIconButton when button is not pressed. <br>
88-
<strong>endBackgroundColor:</strong> The background Color of the AnimatedIconButton when button is pressed. <br>
89-
<strong>And all fields of the parent element:</strong> <a href="https://api.flutter.dev/flutter/material/IconButton-class.html">IconButton</a>
90-
<br><br>
91-
92-
For help getting started with 😍 Flutter, view our
93-
[online documentation](https://flutter.dev/docs), which offers tutorials,
94-
samples, guidance on mobile development, and a full API reference.
135+
Don't forget when you use this property ```duration``` is not used, so it can be emitted.
95136

analysis_options.yaml

Lines changed: 186 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,186 @@
1-
include: package:pedantic/analysis_options.1.9.0.yaml
1+
# Specify analysis options.
2+
#
3+
# Until there are meta linter rules, each desired lint must be explicitly enabled.
4+
# See: https://github.com/dart-lang/linter/issues/288
5+
#
6+
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
7+
# See the configuration guide for more
8+
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
9+
#
10+
# There are other similar analysis options files in the flutter repos,
11+
# which should be kept in sync with this file:
12+
#
13+
# - analysis_options.yaml (this file)
14+
# - packages/flutter/lib/analysis_options_user.yaml
15+
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
16+
# - https://github.com/flutter/engine/blob/master/analysis_options.yaml
17+
#
18+
# This file contains the analysis options used by Flutter tools, such as IntelliJ,
19+
# Android Studio, and the `flutter analyze` command.
20+
21+
analyzer:
22+
strong-mode:
23+
implicit-dynamic: false
24+
errors:
25+
# treat missing required parameters as a warning (not a hint)
26+
missing_required_param: error
27+
# treat missing returns as a warning (not a hint)
28+
missing_return: error
29+
# allow having TODOs in the code
30+
todo: ignore
31+
must_be_immutable: error
32+
# Ignore analyzer hints for updating pubspecs when using Future or
33+
# Stream and not importing dart:async
34+
# Please see https://github.com/flutter/flutter/pull/24528 for details.
35+
sdk_version_async_exported_from_core: ignore
36+
exclude:
37+
- 'bin/cache/**'
38+
# the following two are relative to the stocks example and the flutter package respectively
39+
# see https://github.com/dart-lang/sdk/issues/28463
40+
- 'lib/i18n/stock_messages_*.dart'
41+
- 'lib/src/http/**'
42+
- 'lib/generated/**'
43+
- 'lib/**/*.gr.dart'
44+
- 'lib/**/*.g.dart'
45+
- 'lib/**/*.freezed.dart'
46+
47+
# include: package:lint/analysis_options.yaml
48+
49+
linter:
50+
rules:
51+
# these rules are documented on and in the same order as
52+
# the Dart Lint rules page to make maintenance easier
53+
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
54+
- always_declare_return_types
55+
- always_put_control_body_on_new_line
56+
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
57+
- always_require_non_null_named_parameters
58+
- always_specify_types
59+
- annotate_overrides
60+
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
61+
- avoid_as
62+
# - avoid_bool_literals_in_conditional_expressions # not yet tested
63+
# - avoid_catches_without_on_clauses # we do this commonly
64+
# - avoid_catching_errors # we do this commonly
65+
- avoid_classes_with_only_static_members
66+
# - avoid_double_and_int_checks # only useful when targeting JS runtime
67+
- avoid_empty_else
68+
- avoid_field_initializers_in_const_classes
69+
- avoid_function_literals_in_foreach_calls
70+
# - avoid_implementing_value_types # not yet tested
71+
- avoid_init_to_null
72+
# - avoid_js_rounded_ints # only useful when targeting JS runtime
73+
- avoid_null_checks_in_equality_operators
74+
# - avoid_positional_boolean_parameters # not yet tested
75+
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
76+
- avoid_relative_lib_imports
77+
- avoid_renaming_method_parameters
78+
- avoid_return_types_on_setters
79+
# - avoid_returning_null # there are plenty of valid reasons to return null
80+
# - avoid_returning_null_for_future # not yet tested
81+
- avoid_returning_null_for_void
82+
# - avoid_returning_this # there are plenty of valid reasons to return this
83+
# - avoid_setters_without_getters # not yet tested
84+
# - avoid_shadowing_type_parameters # not yet tested
85+
# - avoid_single_cascade_in_expression_statements # not yet tested
86+
- avoid_slow_async_io
87+
- avoid_types_as_parameter_names
88+
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
89+
- avoid_unused_constructor_parameters
90+
- avoid_void_async
91+
- await_only_futures
92+
- camel_case_types
93+
- cancel_subscriptions
94+
# - cascade_invocations # not yet tested
95+
# - close_sinks # not reliable enough
96+
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
97+
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
98+
- control_flow_in_finally
99+
# - curly_braces_in_flow_control_structures # not yet tested
100+
- directives_ordering
101+
- empty_catches
102+
- empty_constructor_bodies
103+
- empty_statements
104+
# - file_names # not yet tested
105+
- flutter_style_todos
106+
- hash_and_equals
107+
- implementation_imports
108+
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
109+
- iterable_contains_unrelated_type
110+
# - join_return_with_assignment # not yet tested
111+
- library_names
112+
- library_prefixes
113+
# - lines_longer_than_80_chars # not yet tested
114+
- list_remove_unrelated_type
115+
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
116+
- no_adjacent_strings_in_list
117+
- no_duplicate_case_values
118+
- non_constant_identifier_names
119+
# - null_closures # not yet tested
120+
# - omit_local_variable_types # opposite of always_specify_types
121+
# - one_member_abstracts # too many false positives
122+
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
123+
- overridden_fields
124+
- package_api_docs
125+
- package_names
126+
- package_prefixed_library_names
127+
# - parameter_assignments # we do this commonly
128+
- prefer_adjacent_string_concatenation
129+
- prefer_asserts_in_initializer_lists
130+
- prefer_collection_literals
131+
- prefer_conditional_assignment
132+
- prefer_const_constructors # Increases apk size but speeds up build since const widgets are created at compile time
133+
# - prefer_const_constructors_in_immutables
134+
- prefer_const_declarations
135+
- prefer_const_literals_to_create_immutables
136+
# - prefer_constructors_over_static_methods # not yet tested
137+
- prefer_contains
138+
- prefer_equal_for_default_values
139+
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
140+
- prefer_final_fields
141+
- prefer_final_locals
142+
- prefer_foreach
143+
# - prefer_function_declarations_over_variables # not yet tested
144+
- prefer_generic_function_type_aliases
145+
- prefer_initializing_formals
146+
# - prefer_int_literals # not yet tested
147+
# - prefer_interpolation_to_compose_strings # not yet tested
148+
- prefer_is_empty
149+
- prefer_is_not_empty
150+
- prefer_iterable_whereType
151+
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
152+
- prefer_single_quotes
153+
- prefer_typing_uninitialized_variables
154+
- prefer_void_to_null
155+
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
156+
- recursive_getters
157+
- slash_for_doc_comments
158+
- sort_constructors_first
159+
- sort_pub_dependencies
160+
- sort_unnamed_constructors_first
161+
# - super_goes_last # no longer needed w/ Dart 2
162+
- test_types_in_equals
163+
- throw_in_finally
164+
# - type_annotate_public_apis # subset of always_specify_types
165+
- type_init_formals
166+
# - unawaited_futures # too many false positives
167+
# - unnecessary_await_in_return # not yet tested
168+
- unnecessary_brace_in_string_interps
169+
- unnecessary_const
170+
- unnecessary_getters_setters
171+
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
172+
- unnecessary_new
173+
- unnecessary_null_aware_assignments
174+
- unnecessary_null_in_if_null_operators
175+
- unnecessary_overrides
176+
- unnecessary_parenthesis
177+
- unnecessary_statements
178+
- unnecessary_this
179+
- unrelated_type_equality_checks
180+
# - use_function_type_syntax_for_parameters # not yet tested
181+
- use_rethrow_when_possible
182+
# - use_setters_to_change_properties # not yet tested
183+
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
184+
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
185+
- valid_regexps
186+
# - void_checks # not yet tested

0 commit comments

Comments
 (0)