Skip to content

Commit

Permalink
🔥 Require Flutter 3.3 (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Aug 3, 2023
1 parent 3307b67 commit 9b633bd
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 262 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ that can be found in the LICENSE file. -->

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

## 4.0.0-dev.2

### New features

- Migrate to Flutter 3.3, and drop supports for previous Flutter versions.

## 4.0.0-dev.1

To know more about breaking changes, see [Migration Guide][].
Expand Down
13 changes: 8 additions & 5 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ Language: [English](README.md) | 中文简体
* [Flutter WeChat Camera Picker](#flutter-wechat-camera-picker)
* [特性 ✨](#特性-)
* [截图 📸](#截图-)
* [开始前的注意事项 ‼️](#开始前的注意事项-)
* [准备工作 🍭](#准备工作-)
* [版本限制](#版本限制)
* [版本兼容](#版本兼容)
* [配置](#配置)
* [Android 13 (API 33) 权限配置](#android-13-api-33-权限配置)
* [使用方法 📖](#使用方法-)
* [国际化](#国际化)
* [简单的使用方法](#简单的使用方法)
* [使用配置](#使用配置)
* [简单的使用方法](#简单的使用方法-1)
Expand Down Expand Up @@ -94,7 +96,10 @@ Language: [English](README.md) | 中文简体
该插件仅保证能与 **stable 渠道的 Flutter SDK** 配合使用。
我们不会为其他渠道的 Flutter SDK 做实时支持。

Flutter SDK:`>=2.8.0`
| | 2.8.0 | 3.3.0 |
|--------|:-----:|:-----:|
| 4.0.0+ |||
| 3.0.0+ |||

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

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.your.app">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 如果需要拍照,添加该权限 -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<!-- 如果需要录像,添加该权限 -->
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ before you have any questions.
The package only guarantees to be working on **the stable version of Flutter**.
We won't update it in real-time to align with other channels of Flutter.

Flutter SDK: `>=2.8.0` .
| | 2.8.0 | 3.3.0 |
|--------|:-----:|:-----:|
| 4.0.0+ |||
| 3.0.0+ |||

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

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

[photo_manager pub]: https://pub.dev/packages/photo_manager
[Migration Guide]: https://github.com/fluttercandies/flutter_wechat_camera_picker/blob/main/guides/migration_guide.md
247 changes: 14 additions & 233 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,236 +1,17 @@
# Specify analysis options.
#
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
# See the configuration guide for more
# https://github.com/dart-lang/sdk/tree/main/pkg/analyzer#configuring-the-analyzer
#
# There are other similar analysis options files in the flutter repos,
# which should be kept in sync with this file:
#
# - analysis_options.yaml (this file)
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
# - https://github.com/flutter/engine/blob/master/analysis_options.yaml
# - https://github.com/flutter/packages/blob/master/analysis_options.yaml
#
# This file contains the analysis options used for code in the flutter/flutter
# repository.

analyzer:
language:
strict-casts: true
strict-raw-types: true
errors:
# treat missing required parameters as a warning (not a hint)
missing_required_param: warning
# treat missing returns as a warning (not a hint)
missing_return: warning
# allow having TODO comments in the code
todo: ignore
deprecated_member_use: ignore
includes: package:flutter_lints/flutter.yaml

linter:
rules:
# This list is derived from the list of all available lints located at
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
- always_declare_return_types
- always_put_control_body_on_new_line
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
- always_require_non_null_named_parameters
- always_specify_types
# - always_use_package_imports # we do this commonly
- annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
- avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
- avoid_classes_with_only_static_members
- avoid_double_and_int_checks
- avoid_dynamic_calls
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
# - avoid_final_parameters # incompatible with prefer_final_parameters
- avoid_function_literals_in_foreach_calls
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
- avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
- avoid_print
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
# - avoid_returning_null # still violated by some pre-nnbd code that we haven't yet migrated
- avoid_returning_null_for_future
- avoid_returning_null_for_void
# - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives
- avoid_setters_without_getters
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_slow_async_io
- avoid_type_to_string
- avoid_types_as_parameter_names
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- avoid_void_async
# - avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
# - cascade_invocations # doesn't match the typical style of this repo
- cast_nullable_to_non_nullable
# - close_sinks # not reliable enough
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
# - conditional_uri_does_not_exist # not yet tested
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
# - curly_braces_in_flow_control_structures # not required by flutter style
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
- directives_ordering
# - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
- empty_catches
- empty_constructor_bodies
- empty_statements
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
- iterable_contains_unrelated_type
# - join_return_with_assignment # not required by flutter style
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- library_private_types_in_public_api
# - lines_longer_than_80_chars # not required by flutter style
- list_remove_unrelated_type
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_logic_in_create_state
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
# - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
# - parameter_assignments # we do this commonly
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
# - prefer_asserts_with_message # not required by flutter style
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
# - prefer_constructors_over_static_methods # far too many false positives
- prefer_contains
# - prefer_double_quotes # opposite of prefer_single_quotes
- prefer_equal_for_default_values
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
# - 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
- prefer_for_elements_to_map_fromIterable
- prefer_foreach
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
# - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
# - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
# - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
- prefer_null_aware_operators
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
- recursive_getters
- require_trailing_commas
- secure_pubspec_urls
- sized_box_for_whitespace
# - sized_box_shrink_expand # not yet tested
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # too many false positives, especially with the way AnimationController works
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
# - unnecessary_final # conflicts with prefer_final_locals
- unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
- unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
# - unnecessary_raw_strings # what's "necessary" is a matter of opinion; consistency across strings can help readability more than this lint
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
# - use_build_context_synchronously
# - use_colored_box # not yet tested
# - use_decorated_box # not yet tested
# - use_enums # not yet tested
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
- use_key_in_widget_constructors
- use_late_for_private_fields_and_variables
- use_named_constants
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
- use_test_throws_matchers
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
- valid_regexps
- void_checks
always_declare_return_types: true
flutter_style_todos: true
library_private_types_in_public_api: false
prefer_final_fields: true
prefer_final_in_for_each: true
prefer_final_locals: true
prefer_single_quotes: true
require_trailing_commas: true
sort_child_properties_last: true
sort_constructors_first: true
sort_unnamed_constructors_first: true
unnecessary_late: true
use_build_context_synchronously: false
11 changes: 8 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by an Apache license that can be found
// in the LICENSE file.

import 'dart:ui' as ui;

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

Expand Down Expand Up @@ -31,7 +29,14 @@ class MyApp extends StatelessWidget {
return MaterialApp(
onGenerateTitle: (BuildContext context) => context.l10n.appTitle,
theme: ThemeData(
brightness: MediaQueryData.fromWindow(ui.window).platformBrightness,
brightness: Brightness.light,
primarySwatch: themeColor.swatch,
textSelectionTheme: const TextSelectionThemeData(
cursorColor: themeColor,
),
),
darkTheme: ThemeData(
brightness: Brightness.dark,
primarySwatch: themeColor.swatch,
textSelectionTheme: const TextSelectionThemeData(
cursorColor: themeColor,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/widgets/method_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class _MethodListViewState extends State<MethodListView> {
const SizedBox(height: 5),
Text(
model.description,
style: Theme.of(context).textTheme.caption,
style: Theme.of(context).textTheme.bodySmall,
),
],
),
Expand Down
5 changes: 3 additions & 2 deletions example/lib/widgets/preview_asset_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ class _PreviewAssetWidgetState extends State<PreviewAssetWidget> {
return;
}
final VideoPlayerController controller;
final Uri uri = Uri.parse(url);
if (Platform.isAndroid) {
controller = VideoPlayerController.contentUri(Uri.parse(url));
controller = VideoPlayerController.contentUri(uri);
} else {
controller = VideoPlayerController.network(url);
controller = VideoPlayerController.networkUrl(uri);
}
_playerController = controller;
try {
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version: 4.0.0+24
publish_to: none

environment:
sdk: ">=2.15.0 <3.0.0"
flutter: ">=2.8.0"
sdk: ">=2.18.0 <3.0.0"
flutter: ">=3.3.0"

dependencies:
flutter:
Expand All @@ -18,7 +18,7 @@ dependencies:
path: ../

package_info_plus: ^4.0.0
video_player: ^2.3.0
video_player: ^2.7.0

flutter:
uses-material-design: true
Expand Down
Loading

0 comments on commit 9b633bd

Please sign in to comment.