Skip to content

Commit 9b633bd

Browse files
authored
🔥 Require Flutter 3.3 (#184)
1 parent 3307b67 commit 9b633bd

File tree

11 files changed

+60
-262
lines changed

11 files changed

+60
-262
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ that can be found in the LICENSE file. -->
66

77
See the [Migration Guide](guides/migration_guide.md) for the details of breaking changes between versions.
88

9+
## 4.0.0-dev.2
10+
11+
### New features
12+
13+
- Migrate to Flutter 3.3, and drop supports for previous Flutter versions.
14+
915
## 4.0.0-dev.1
1016

1117
To know more about breaking changes, see [Migration Guide][].

README-ZH.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ Language: [English](README.md) | 中文简体
3131
* [Flutter WeChat Camera Picker](#flutter-wechat-camera-picker)
3232
* [特性 ✨](#特性-)
3333
* [截图 📸](#截图-)
34+
* [开始前的注意事项 ‼️](#开始前的注意事项-)
3435
* [准备工作 🍭](#准备工作-)
35-
* [版本限制](#版本限制)
36+
* [版本兼容](#版本兼容)
3637
* [配置](#配置)
3738
* [Android 13 (API 33) 权限配置](#android-13-api-33-权限配置)
3839
* [使用方法 📖](#使用方法-)
40+
* [国际化](#国际化)
3941
* [简单的使用方法](#简单的使用方法)
4042
* [使用配置](#使用配置)
4143
* [简单的使用方法](#简单的使用方法-1)
@@ -94,7 +96,10 @@ Language: [English](README.md) | 中文简体
9496
该插件仅保证能与 **stable 渠道的 Flutter SDK** 配合使用。
9597
我们不会为其他渠道的 Flutter SDK 做实时支持。
9698

97-
Flutter SDK:`>=2.8.0`
99+
| | 2.8.0 | 3.3.0 |
100+
|--------|:-----:|:-----:|
101+
| 4.0.0+ |||
102+
| 3.0.0+ |||
98103

99104
如果在 `flutter pub get` 时遇到了 `resolve conflict` 失败问题,
100105
请使用 `dependency_overrides` 解决。
@@ -134,9 +139,7 @@ import 'package:wechat_camera_picker/wechat_camera_picker.dart';
134139
如果你不需要拍照或录像,你可以考虑将对应权限移除:
135140

136141
```xml
137-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
138-
xmlns:tools="http://schemas.android.com/tools"
139-
package="com.your.app">
142+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
140143
<!-- 如果需要拍照,添加该权限 -->
141144
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
142145
<!-- 如果需要录像,添加该权限 -->

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ before you have any questions.
9999
The package only guarantees to be working on **the stable version of Flutter**.
100100
We won't update it in real-time to align with other channels of Flutter.
101101

102-
Flutter SDK: `>=2.8.0` .
102+
| | 2.8.0 | 3.3.0 |
103+
|--------|:-----:|:-----:|
104+
| 4.0.0+ |||
105+
| 3.0.0+ |||
103106

104107
If you got a `resolve conflict` error when running `flutter pub get`,
105108
please use `dependency_overrides` to fix it.
@@ -138,9 +141,7 @@ If you don't need to take photos or videos,
138141
consider removing relevant permission in your apps, more specifically:
139142

140143
```xml
141-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
142-
xmlns:tools="http://schemas.android.com/tools"
143-
package="com.your.app">
144+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
144145
<!-- Add this if you need to take photos. -->
145146
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
146147
<!-- Add this if you need to take videos. -->
@@ -263,4 +264,5 @@ Thank goes to these wonderful people ([emoji key](https://allcontributors.org/do
263264
<!-- ALL-CONTRIBUTORS-LIST:END -->
264265
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
265266

267+
[photo_manager pub]: https://pub.dev/packages/photo_manager
266268
[Migration Guide]: https://github.com/fluttercandies/flutter_wechat_camera_picker/blob/main/guides/migration_guide.md

analysis_options.yaml

Lines changed: 14 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -1,236 +1,17 @@
1-
# Specify analysis options.
2-
#
3-
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
4-
# See the configuration guide for more
5-
# https://github.com/dart-lang/sdk/tree/main/pkg/analyzer#configuring-the-analyzer
6-
#
7-
# There are other similar analysis options files in the flutter repos,
8-
# which should be kept in sync with this file:
9-
#
10-
# - analysis_options.yaml (this file)
11-
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
12-
# - https://github.com/flutter/engine/blob/master/analysis_options.yaml
13-
# - https://github.com/flutter/packages/blob/master/analysis_options.yaml
14-
#
15-
# This file contains the analysis options used for code in the flutter/flutter
16-
# repository.
17-
18-
analyzer:
19-
language:
20-
strict-casts: true
21-
strict-raw-types: true
22-
errors:
23-
# treat missing required parameters as a warning (not a hint)
24-
missing_required_param: warning
25-
# treat missing returns as a warning (not a hint)
26-
missing_return: warning
27-
# allow having TODO comments in the code
28-
todo: ignore
29-
deprecated_member_use: ignore
1+
includes: package:flutter_lints/flutter.yaml
302

313
linter:
324
rules:
33-
# This list is derived from the list of all available lints located at
34-
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
35-
- always_declare_return_types
36-
- always_put_control_body_on_new_line
37-
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
38-
- always_require_non_null_named_parameters
39-
- always_specify_types
40-
# - always_use_package_imports # we do this commonly
41-
- annotate_overrides
42-
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
43-
- avoid_bool_literals_in_conditional_expressions
44-
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
45-
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
46-
- avoid_classes_with_only_static_members
47-
- avoid_double_and_int_checks
48-
- avoid_dynamic_calls
49-
- avoid_empty_else
50-
- avoid_equals_and_hash_code_on_mutable_classes
51-
- avoid_escaping_inner_quotes
52-
- avoid_field_initializers_in_const_classes
53-
# - avoid_final_parameters # incompatible with prefer_final_parameters
54-
- avoid_function_literals_in_foreach_calls
55-
- avoid_implementing_value_types
56-
- avoid_init_to_null
57-
- avoid_js_rounded_ints
58-
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
59-
- avoid_null_checks_in_equality_operators
60-
# - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
61-
- avoid_print
62-
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
63-
- avoid_redundant_argument_values
64-
- avoid_relative_lib_imports
65-
- avoid_renaming_method_parameters
66-
- avoid_return_types_on_setters
67-
# - avoid_returning_null # still violated by some pre-nnbd code that we haven't yet migrated
68-
- avoid_returning_null_for_future
69-
- avoid_returning_null_for_void
70-
# - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives
71-
- avoid_setters_without_getters
72-
- avoid_shadowing_type_parameters
73-
- avoid_single_cascade_in_expression_statements
74-
- avoid_slow_async_io
75-
- avoid_type_to_string
76-
- avoid_types_as_parameter_names
77-
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
78-
- avoid_unnecessary_containers
79-
- avoid_unused_constructor_parameters
80-
- avoid_void_async
81-
# - avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere
82-
- await_only_futures
83-
- camel_case_extensions
84-
- camel_case_types
85-
- cancel_subscriptions
86-
# - cascade_invocations # doesn't match the typical style of this repo
87-
- cast_nullable_to_non_nullable
88-
# - close_sinks # not reliable enough
89-
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
90-
# - conditional_uri_does_not_exist # not yet tested
91-
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
92-
- control_flow_in_finally
93-
# - curly_braces_in_flow_control_structures # not required by flutter style
94-
- depend_on_referenced_packages
95-
- deprecated_consistency
96-
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
97-
- directives_ordering
98-
# - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
99-
- empty_catches
100-
- empty_constructor_bodies
101-
- empty_statements
102-
- eol_at_end_of_file
103-
- exhaustive_cases
104-
- file_names
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 required by flutter style
111-
- leading_newlines_in_multiline_strings
112-
- library_names
113-
- library_prefixes
114-
- library_private_types_in_public_api
115-
# - lines_longer_than_80_chars # not required by flutter style
116-
- list_remove_unrelated_type
117-
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
118-
- missing_whitespace_between_adjacent_strings
119-
- no_adjacent_strings_in_list
120-
- no_default_cases
121-
- no_duplicate_case_values
122-
- no_leading_underscores_for_library_prefixes
123-
- no_leading_underscores_for_local_identifiers
124-
- no_logic_in_create_state
125-
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
126-
- non_constant_identifier_names
127-
- noop_primitive_operations
128-
- null_check_on_nullable_type_parameter
129-
- null_closures
130-
# - omit_local_variable_types # opposite of always_specify_types
131-
# - one_member_abstracts # too many false positives
132-
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
133-
- overridden_fields
134-
- package_api_docs
135-
- package_names
136-
- package_prefixed_library_names
137-
# - parameter_assignments # we do this commonly
138-
- prefer_adjacent_string_concatenation
139-
- prefer_asserts_in_initializer_lists
140-
# - prefer_asserts_with_message # not required by flutter style
141-
- prefer_collection_literals
142-
- prefer_conditional_assignment
143-
- prefer_const_constructors
144-
- prefer_const_constructors_in_immutables
145-
- prefer_const_declarations
146-
- prefer_const_literals_to_create_immutables
147-
# - prefer_constructors_over_static_methods # far too many false positives
148-
- prefer_contains
149-
# - prefer_double_quotes # opposite of prefer_single_quotes
150-
- prefer_equal_for_default_values
151-
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
152-
- prefer_final_fields
153-
- prefer_final_in_for_each
154-
- prefer_final_locals
155-
# - prefer_final_parameters # we should enable this one day when it can be auto-fixed (https://github.com/dart-lang/linter/issues/3104), see also parameter_assignments
156-
- prefer_for_elements_to_map_fromIterable
157-
- prefer_foreach
158-
- prefer_function_declarations_over_variables
159-
- prefer_generic_function_type_aliases
160-
- prefer_if_elements_to_conditional_expressions
161-
- prefer_if_null_operators
162-
- prefer_initializing_formals
163-
- prefer_inlined_adds
164-
# - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants
165-
- prefer_interpolation_to_compose_strings
166-
- prefer_is_empty
167-
- prefer_is_not_empty
168-
- prefer_is_not_operator
169-
- prefer_iterable_whereType
170-
# - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
171-
# - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
172-
- prefer_null_aware_operators
173-
- prefer_relative_imports
174-
- prefer_single_quotes
175-
- prefer_spread_collections
176-
- prefer_typing_uninitialized_variables
177-
- prefer_void_to_null
178-
- provide_deprecation_message
179-
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
180-
- recursive_getters
181-
- require_trailing_commas
182-
- secure_pubspec_urls
183-
- sized_box_for_whitespace
184-
# - sized_box_shrink_expand # not yet tested
185-
- slash_for_doc_comments
186-
- sort_child_properties_last
187-
- sort_constructors_first
188-
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
189-
- sort_unnamed_constructors_first
190-
- test_types_in_equals
191-
- throw_in_finally
192-
- tighten_type_of_initializing_formals
193-
# - type_annotate_public_apis # subset of always_specify_types
194-
- type_init_formals
195-
# - unawaited_futures # too many false positives, especially with the way AnimationController works
196-
- unnecessary_await_in_return
197-
- unnecessary_brace_in_string_interps
198-
- unnecessary_const
199-
- unnecessary_constructor_name
200-
# - unnecessary_final # conflicts with prefer_final_locals
201-
- unnecessary_getters_setters
202-
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
203-
- unnecessary_late
204-
- unnecessary_new
205-
- unnecessary_null_aware_assignments
206-
- unnecessary_null_checks
207-
- unnecessary_null_in_if_null_operators
208-
- unnecessary_nullable_for_final_variable_declarations
209-
- unnecessary_overrides
210-
- unnecessary_parenthesis
211-
# - unnecessary_raw_strings # what's "necessary" is a matter of opinion; consistency across strings can help readability more than this lint
212-
- unnecessary_statements
213-
- unnecessary_string_escapes
214-
- unnecessary_string_interpolations
215-
- unnecessary_this
216-
- unrelated_type_equality_checks
217-
- unsafe_html
218-
# - use_build_context_synchronously
219-
# - use_colored_box # not yet tested
220-
# - use_decorated_box # not yet tested
221-
# - use_enums # not yet tested
222-
- use_full_hex_values_for_flutter_colors
223-
- use_function_type_syntax_for_parameters
224-
- use_if_null_to_convert_nulls_to_bools
225-
- use_is_even_rather_than_modulo
226-
- use_key_in_widget_constructors
227-
- use_late_for_private_fields_and_variables
228-
- use_named_constants
229-
- use_raw_strings
230-
- use_rethrow_when_possible
231-
- use_setters_to_change_properties
232-
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
233-
- use_test_throws_matchers
234-
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
235-
- valid_regexps
236-
- void_checks
5+
always_declare_return_types: true
6+
flutter_style_todos: true
7+
library_private_types_in_public_api: false
8+
prefer_final_fields: true
9+
prefer_final_in_for_each: true
10+
prefer_final_locals: true
11+
prefer_single_quotes: true
12+
require_trailing_commas: true
13+
sort_child_properties_last: true
14+
sort_constructors_first: true
15+
sort_unnamed_constructors_first: true
16+
unnecessary_late: true
17+
use_build_context_synchronously: false

example/lib/main.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by an Apache license that can be found
33
// in the LICENSE file.
44

5-
import 'dart:ui' as ui;
6-
75
import 'package:flutter/material.dart';
86
import 'package:flutter/services.dart';
97

@@ -31,7 +29,14 @@ class MyApp extends StatelessWidget {
3129
return MaterialApp(
3230
onGenerateTitle: (BuildContext context) => context.l10n.appTitle,
3331
theme: ThemeData(
34-
brightness: MediaQueryData.fromWindow(ui.window).platformBrightness,
32+
brightness: Brightness.light,
33+
primarySwatch: themeColor.swatch,
34+
textSelectionTheme: const TextSelectionThemeData(
35+
cursorColor: themeColor,
36+
),
37+
),
38+
darkTheme: ThemeData(
39+
brightness: Brightness.dark,
3540
primarySwatch: themeColor.swatch,
3641
textSelectionTheme: const TextSelectionThemeData(
3742
cursorColor: themeColor,

example/lib/widgets/method_list_view.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class _MethodListViewState extends State<MethodListView> {
6464
const SizedBox(height: 5),
6565
Text(
6666
model.description,
67-
style: Theme.of(context).textTheme.caption,
67+
style: Theme.of(context).textTheme.bodySmall,
6868
),
6969
],
7070
),

example/lib/widgets/preview_asset_widget.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ class _PreviewAssetWidgetState extends State<PreviewAssetWidget> {
4343
return;
4444
}
4545
final VideoPlayerController controller;
46+
final Uri uri = Uri.parse(url);
4647
if (Platform.isAndroid) {
47-
controller = VideoPlayerController.contentUri(Uri.parse(url));
48+
controller = VideoPlayerController.contentUri(uri);
4849
} else {
49-
controller = VideoPlayerController.network(url);
50+
controller = VideoPlayerController.networkUrl(uri);
5051
}
5152
_playerController = controller;
5253
try {

example/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ version: 4.0.0+24
44
publish_to: none
55

66
environment:
7-
sdk: ">=2.15.0 <3.0.0"
8-
flutter: ">=2.8.0"
7+
sdk: ">=2.18.0 <3.0.0"
8+
flutter: ">=3.3.0"
99

1010
dependencies:
1111
flutter:
@@ -18,7 +18,7 @@ dependencies:
1818
path: ../
1919

2020
package_info_plus: ^4.0.0
21-
video_player: ^2.3.0
21+
video_player: ^2.7.0
2222

2323
flutter:
2424
uses-material-design: true

0 commit comments

Comments
 (0)