Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

Commit aa60c46

Browse files
committed
feat: refactor introduction widget to be more customizable
1 parent a03b05d commit aa60c46

20 files changed

+1114
-1264
lines changed

README.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,43 @@ To use this package, add `flutter_introduction_widget` as a [dependency in your
1616

1717
Simple way to use the introduction widget:
1818
```dart
19-
Introduction(
20-
introductionSettings: const IntroductionSettings(
21-
buttonMode: IntroductionScreenButtonMode.Text,
22-
showSkipButton: true,
23-
showFinishButton: true,
19+
IntroductionScreen(
20+
options: IntroductionOptions(
21+
pages: [
22+
IntroductionPage(
23+
title: const Text('First page'),
24+
text: const Text('Wow a page'),
25+
graphic: const FlutterLogo(),
26+
),
27+
IntroductionPage(
28+
title: const Text('Second page'),
29+
text: const Text('Another page'),
30+
graphic: const FlutterLogo(),
31+
),
32+
IntroductionPage(
33+
title: const Text('Third page'),
34+
text: const Text('The final page of this app'),
35+
graphic: const FlutterLogo(),
36+
backgroundImage: const NetworkImage(
37+
'https://iconica.nl/wp-content/uploads/2021/12/20210928-_CS17127-1-2048x1365.jpg',
38+
),
39+
),
40+
],
41+
introductionTranslations: const IntroductionTranslations(
42+
skipButton: 'Skip it!',
43+
nextButton: 'Previous',
44+
previousButton: 'Next',
45+
finishButton: 'To the app!',
46+
),
47+
buttonMode: IntroductionScreenButtonMode.text,
48+
buttonBuilder: (context, onPressed, child) =>
49+
ElevatedButton(onPressed: onPressed, child: child),
2450
),
2551
onComplete: () {
26-
debugPrint('done!');
52+
debugPrint('We completed the cycle');
2753
},
28-
pages: [
29-
IntroductionPage(title: 'Page1', text: 'hello'),
30-
IntroductionPage(title: 'Page2', text: 'world'),
31-
IntroductionPage(title: 'Page3', text: 'text'),
32-
],
3354
),
3455
```
35-
### Example
3656

3757
See [Example Code](example/lib/main.dart) for more info.
3858

analysis_options.yaml

Lines changed: 0 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -6,204 +6,6 @@ analyzer:
66
linter:
77
# https://dart.dev/tools/linter-rules#lints
88
rules:
9-
# error rules
10-
always_use_package_imports: false
11-
avoid_dynamic_calls: true
12-
avoid_empty_else: true
13-
avoid_print: true
14-
avoid_relative_lib_imports: true
15-
avoid_returning_null_for_future: true
16-
avoid_slow_async_io: true
17-
avoid_type_to_string: true
18-
avoid_types_as_parameter_names: true
19-
avoid_web_libraries_in_flutter: true
20-
cancel_subscriptions: true
21-
close_sinks: true
22-
comment_references: false
23-
control_flow_in_finally: true
24-
diagnostic_describe_all_properties: false
25-
empty_statements: true
26-
hash_and_equals: true
27-
invariant_booleans: true
28-
iterable_contains_unrelated_type: true
29-
list_remove_unrelated_type: true
30-
literal_only_boolean_expressions: true
31-
no_adjacent_strings_in_list: true
32-
no_duplicate_case_values: true
33-
no_logic_in_create_state: true
34-
prefer_relative_imports: false
35-
prefer_void_to_null: true
36-
test_types_in_equals: true
37-
throw_in_finally: true
38-
unnecessary_statements: true
39-
unrelated_type_equality_checks: true
40-
unsafe_html: true
41-
use_build_context_synchronously: true
42-
use_key_in_widget_constructors: true
43-
valid_regexps: true
44-
# style rules
45-
always_declare_return_types: true
46-
always_put_control_body_on_new_line: true
47-
always_put_required_named_parameters_first: true
48-
always_require_non_null_named_parameters: true
49-
always_specify_types: false
50-
annotate_overrides: true
51-
avoid_annotating_with_dynamic: false
52-
avoid_bool_literals_in_conditional_expressions: true
53-
avoid_catches_without_on_clauses: false
54-
avoid_catching_errors: false
55-
avoid_classes_with_only_static_members: true
56-
avoid_double_and_int_checks: true
57-
avoid_equals_and_hash_code_on_mutable_classes: false
58-
avoid_escaping_inner_quotes: false
59-
avoid_field_initializers_in_const_classes: true
60-
avoid_final_parameters: true
61-
avoid_function_literals_in_foreach_calls: true
62-
avoid_implementing_value_types: true
63-
avoid_init_to_null: true
64-
avoid_js_rounded_ints: true
65-
avoid_multiple_declarations_per_line: true
66-
avoid_null_checks_in_equality_operators: true
67-
avoid_positional_boolean_parameters: true
68-
avoid_private_typedef_functions: true
69-
avoid_redundant_argument_values: false
70-
avoid_renaming_method_parameters: true
71-
avoid_return_types_on_setters: true
72-
avoid_returning_null: true
73-
avoid_returning_null_for_void: true
74-
avoid_returning_this: true
75-
avoid_setters_without_getters: true
76-
avoid_shadowing_type_parameters: true
77-
avoid_single_cascade_in_expression_statements: true
78-
avoid_types_on_closure_parameters: false
79-
avoid_unnecessary_containers: false
80-
avoid_unused_constructor_parameters: true
81-
avoid_void_async: true
82-
await_only_futures: true
83-
camel_case_extensions: true
84-
camel_case_types: true
85-
cascade_invocations: true
86-
cast_nullable_to_non_nullable: true
87-
conditional_uri_does_not_exist: true
88-
constant_identifier_names: true
89-
curly_braces_in_flow_control_structures: true
90-
deprecated_consistency: true
91-
directives_ordering: true
92-
do_not_use_environment: true
93-
empty_catches: true
94-
empty_constructor_bodies: true
95-
eol_at_end_of_file: true
96-
exhaustive_cases: true
97-
file_names: true
98-
flutter_style_todos: true
99-
implementation_imports: true
100-
join_return_with_assignment: true
101-
leading_newlines_in_multiline_strings: true
102-
library_names: true
103-
library_prefixes: true
104-
library_private_types_in_public_api: true
105-
lines_longer_than_80_chars: true
106-
missing_whitespace_between_adjacent_strings: true
107-
no_default_cases: true
108-
no_leading_underscores_for_library_prefixes: true
109-
no_leading_underscores_for_local_identifiers: true
110-
no_runtimeType_toString: true
111-
non_constant_identifier_names: true
112-
noop_primitive_operations: true
113-
null_check_on_nullable_type_parameter: true
114-
null_closures: true
115-
omit_local_variable_types: true
116-
one_member_abstracts: true
117-
only_throw_errors: true
118-
overridden_fields: true
119-
package_api_docs: true
120-
package_prefixed_library_names: true
121-
parameter_assignments: true
122-
prefer_adjacent_string_concatenation: true
123-
prefer_asserts_in_initializer_lists: true
124-
prefer_asserts_with_message: true
125-
prefer_collection_literals: true
126-
prefer_conditional_assignment: true
127-
prefer_const_constructors: true
128-
prefer_const_constructors_in_immutables: true
129-
prefer_const_declarations: false
130-
prefer_const_literals_to_create_immutables: false
131-
prefer_constructors_over_static_methods: true
132-
prefer_contains: true
133-
prefer_double_quotes: false
134-
prefer_equal_for_default_values: true
135-
prefer_expression_function_bodies: false
136-
prefer_final_fields: true
137-
prefer_final_in_for_each: false
138-
prefer_final_locals: false
139-
prefer_final_parameters: false
140-
prefer_for_elements_to_map_fromIterable: true
141-
prefer_foreach: true
142-
prefer_function_declarations_over_variables: true
143-
prefer_generic_function_type_aliases: true
144-
prefer_if_elements_to_conditional_expressions: true
145-
prefer_if_null_operators: true
146-
prefer_initializing_formals: true
147-
prefer_inlined_adds: true
148-
prefer_int_literals: false
149-
prefer_interpolation_to_compose_strings: true
150-
prefer_is_empty: true
151-
prefer_is_not_empty: true
152-
prefer_is_not_operator: true
153-
prefer_iterable_whereType: true
154-
prefer_mixin: true
155-
prefer_null_aware_method_calls: true
156-
prefer_null_aware_operators: true
157-
prefer_single_quotes: true
158-
prefer_spread_collections: true
159-
prefer_typing_uninitialized_variables: true
160-
provide_deprecation_message: true
161-
public_member_api_docs: false
162-
recursive_getters: true
163-
require_trailing_commas: true
164-
sized_box_for_whitespace: true
165-
sized_box_shrink_expand: true
166-
slash_for_doc_comments: true
167-
sort_child_properties_last: true
168-
sort_constructors_first: true
169-
sort_unnamed_constructors_first: true
170-
tighten_type_of_initializing_formals: true
171-
type_annotate_public_apis: true
172-
type_init_formals: true
173-
unawaited_futures: true
174-
unnecessary_await_in_return: true
175-
unnecessary_brace_in_string_interps: true
176-
unnecessary_const: false
177-
unnecessary_constructor_name: true
178-
unnecessary_final: true
179-
unnecessary_getters_setters: true
180-
unnecessary_lambdas: true
181-
unnecessary_late: true
182-
unnecessary_new: true
183-
unnecessary_null_aware_assignments: true
184-
unnecessary_null_checks: true
185-
unnecessary_null_in_if_null_operators: true
186-
unnecessary_nullable_for_final_variable_declarations: true
187-
unnecessary_overrides: true
188-
unnecessary_parenthesis: true
189-
unnecessary_raw_strings: true
190-
unnecessary_string_escapes: true
191-
unnecessary_string_interpolations: true
192-
unnecessary_this: true
193-
use_decorated_box: true
194-
use_full_hex_values_for_flutter_colors: true
195-
use_function_type_syntax_for_parameters: true
196-
use_if_null_to_convert_nulls_to_bools: true
197-
use_is_even_rather_than_modulo: true
198-
use_late_for_private_fields_and_variables: true
199-
use_named_constants: true
200-
use_raw_strings: false
201-
use_rethrow_when_possible: true
202-
use_setters_to_change_properties: true
203-
use_string_buffers: true
204-
use_test_throws_matchers: true
205-
use_to_and_as_if_applicable: true
206-
void_checks: true
2079
# pub rules
20810
depend_on_referenced_packages: true
20911
lowercase_with_underscores: true

example/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# example
2+
3+
A new Flutter project.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13+
14+
For help getting started with Flutter development, view the
15+
[online documentation](https://docs.flutter.dev/), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.

0 commit comments

Comments
 (0)