diff --git a/analysis_options.yaml b/analysis_options.yaml index 2d6845e..f5055ce 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ -includes: package:flutter_lints/flutter.yaml +include: package:flutter_lints/flutter.yaml linter: rules: diff --git a/example/lib/main.dart b/example/lib/main.dart index 11ca84c..4aa6980 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -22,7 +22,7 @@ void main() { } class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({super.key}); @override Widget build(BuildContext context) { diff --git a/example/lib/pages/home_page.dart b/example/lib/pages/home_page.dart index b2a89f4..2821259 100644 --- a/example/lib/pages/home_page.dart +++ b/example/lib/pages/home_page.dart @@ -14,7 +14,7 @@ import '../widgets/method_list_view.dart'; import '../widgets/selected_assets_view.dart'; class HomePage extends StatefulWidget { - const HomePage({Key? key}) : super(key: key); + const HomePage({super.key}); @override State createState() => _MyHomePageState(); diff --git a/example/lib/pages/splash_page.dart b/example/lib/pages/splash_page.dart index c69373b..dba01fc 100644 --- a/example/lib/pages/splash_page.dart +++ b/example/lib/pages/splash_page.dart @@ -9,7 +9,7 @@ import '../main.dart'; import 'home_page.dart'; class SplashPage extends StatefulWidget { - const SplashPage({Key? key}) : super(key: key); + const SplashPage({super.key}); @override State createState() => _SplashPageState(); diff --git a/example/lib/widgets/asset_widget_builder.dart b/example/lib/widgets/asset_widget_builder.dart index 3d3cc13..82b3f0f 100644 --- a/example/lib/widgets/asset_widget_builder.dart +++ b/example/lib/widgets/asset_widget_builder.dart @@ -7,10 +7,10 @@ import 'package:wechat_camera_picker/wechat_camera_picker.dart'; class AssetWidgetBuilder extends StatelessWidget { const AssetWidgetBuilder({ - Key? key, + super.key, required this.entity, required this.isDisplayingDetail, - }) : super(key: key); + }); final AssetEntity entity; final bool isDisplayingDetail; diff --git a/example/lib/widgets/method_list_view.dart b/example/lib/widgets/method_list_view.dart index 5ffc7b1..fdc302f 100644 --- a/example/lib/widgets/method_list_view.dart +++ b/example/lib/widgets/method_list_view.dart @@ -8,10 +8,10 @@ import '../models/picker_method.dart'; class MethodListView extends StatefulWidget { const MethodListView({ - Key? key, + super.key, required this.pickMethods, required this.onSelectMethod, - }) : super(key: key); + }); final List pickMethods; final void Function(PickMethod method) onSelectMethod; diff --git a/example/lib/widgets/preview_asset_widget.dart b/example/lib/widgets/preview_asset_widget.dart index 25a3341..ca21f49 100644 --- a/example/lib/widgets/preview_asset_widget.dart +++ b/example/lib/widgets/preview_asset_widget.dart @@ -9,7 +9,7 @@ import 'package:video_player/video_player.dart'; import 'package:wechat_camera_picker/wechat_camera_picker.dart'; class PreviewAssetWidget extends StatefulWidget { - const PreviewAssetWidget(this.asset, {Key? key}) : super(key: key); + const PreviewAssetWidget(this.asset, {super.key}); final AssetEntity asset; diff --git a/example/lib/widgets/selected_assets_view.dart b/example/lib/widgets/selected_assets_view.dart index 274ca62..f16d4c1 100644 --- a/example/lib/widgets/selected_assets_view.dart +++ b/example/lib/widgets/selected_assets_view.dart @@ -11,11 +11,11 @@ import 'preview_asset_widget.dart'; class SelectedAssetView extends StatelessWidget { const SelectedAssetView({ - Key? key, + super.key, required this.asset, required this.isDisplayingDetail, required this.onRemoveAsset, - }) : super(key: key); + }); final AssetEntity asset; final ValueNotifier isDisplayingDetail; diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 72c0893..9611c5c 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -20,6 +20,9 @@ dependencies: package_info_plus: ^4.0.0 video_player: ^2.7.0 +dev_dependencies: + flutter_lints: any + flutter: uses-material-design: true assets: diff --git a/lib/src/states/camera_picker_viewer_state.dart b/lib/src/states/camera_picker_viewer_state.dart index ac9f1ed..f637f65 100644 --- a/lib/src/states/camera_picker_viewer_state.dart +++ b/lib/src/states/camera_picker_viewer_state.dart @@ -379,7 +379,8 @@ class CameraPickerViewerState extends State { } class _WechatLoading extends StatefulWidget { - const _WechatLoading({Key? key, required this.tip}) : super(key: key); + // ignore: unused_element + const _WechatLoading({super.key, required this.tip}); final String tip; diff --git a/lib/src/widgets/builder/tween_animation_builder_2.dart b/lib/src/widgets/builder/tween_animation_builder_2.dart index 7e63ee6..4eb2117 100644 --- a/lib/src/widgets/builder/tween_animation_builder_2.dart +++ b/lib/src/widgets/builder/tween_animation_builder_2.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; class TweenAnimationBuilder2 extends StatelessWidget { const TweenAnimationBuilder2({ - Key? key, + super.key, required this.firstTween, required this.secondTween, required this.builder, @@ -14,7 +14,7 @@ class TweenAnimationBuilder2 extends StatelessWidget { this.secondTweenDuration = kThemeAnimationDuration, this.firstTweenCurve = Curves.linear, this.secondTweenCurve = Curves.linear, - }) : super(key: key); + }); final Tween firstTween; final Tween secondTween; diff --git a/lib/src/widgets/camera_focus_point.dart b/lib/src/widgets/camera_focus_point.dart index 9490dd5..32a8203 100644 --- a/lib/src/widgets/camera_focus_point.dart +++ b/lib/src/widgets/camera_focus_point.dart @@ -8,10 +8,10 @@ import 'builder/tween_animation_builder_2.dart'; class CameraFocusPoint extends StatelessWidget { const CameraFocusPoint({ - Key? key, + super.key, required this.size, required this.color, - }) : super(key: key); + }); final double size; final Color color; diff --git a/lib/src/widgets/camera_picker.dart b/lib/src/widgets/camera_picker.dart index 520ada8..c0da1c8 100644 --- a/lib/src/widgets/camera_picker.dart +++ b/lib/src/widgets/camera_picker.dart @@ -21,11 +21,11 @@ import 'camera_picker_page_route.dart'; /// 该选择器可以通过 [CameraController] 创建 [AssetEntity]。 class CameraPicker extends StatefulWidget { const CameraPicker({ - Key? key, + super.key, this.pickerConfig = const CameraPickerConfig(), this.createPickerState, this.locale, - }) : super(key: key); + }); /// {@macro wechat_camera_picker.CameraPickerConfig} final CameraPickerConfig pickerConfig; diff --git a/lib/src/widgets/camera_picker_page_route.dart b/lib/src/widgets/camera_picker_page_route.dart index 184b420..af82e71 100644 --- a/lib/src/widgets/camera_picker_page_route.dart +++ b/lib/src/widgets/camera_picker_page_route.dart @@ -17,12 +17,9 @@ class CameraPickerPageRoute extends PageRoute { this.maintainState = true, this.opaque = true, this.canTransitionFromPredicate, - bool fullscreenDialog = false, - RouteSettings? settings, - }) : super( - settings: settings, - fullscreenDialog: fullscreenDialog, - ); + super.fullscreenDialog, + super.settings, + }); final WidgetBuilder builder; diff --git a/lib/src/widgets/camera_picker_viewer.dart b/lib/src/widgets/camera_picker_viewer.dart index 09b2066..9a98529 100644 --- a/lib/src/widgets/camera_picker_viewer.dart +++ b/lib/src/widgets/camera_picker_viewer.dart @@ -14,12 +14,13 @@ import '../states/camera_picker_viewer_state.dart'; class CameraPickerViewer extends StatefulWidget { const CameraPickerViewer._({ - Key? key, + // ignore: unused_element + super.key, required this.viewType, required this.previewXFile, required this.pickerConfig, this.createViewerState, - }) : super(key: key); + }); /// The type of the viewer. (Image | Video) /// 预览的类型(图片或视频) diff --git a/lib/src/widgets/camera_progress_button.dart b/lib/src/widgets/camera_progress_button.dart index 23adade..dad8cd0 100644 --- a/lib/src/widgets/camera_progress_button.dart +++ b/lib/src/widgets/camera_progress_button.dart @@ -11,14 +11,14 @@ import '../internals/methods.dart'; class CameraProgressButton extends StatefulWidget { const CameraProgressButton({ - Key? key, + super.key, required this.isAnimating, required this.outerRadius, required this.ringsWidth, this.ringsColor = wechatThemeColor, this.progress = 0.0, this.duration = const Duration(seconds: 15), - }) : super(key: key); + }); final bool isAnimating; final double outerRadius;