other lints

This commit is contained in:
Vadim 2023-05-11 15:04:54 +02:00
parent 87fceee150
commit 2b14318403
8 changed files with 17 additions and 10 deletions

View file

@ -1,5 +1,10 @@
include: package:lint/strict.yaml include: package:lint/strict.yaml
linter:
rules:
use_setters_to_change_properties: false
analyzer: analyzer:
exclude: exclude:
- "**/generated/**" - "**/generated/**"

View file

@ -6,7 +6,7 @@ class CaffeineService {
const CaffeineService(); const CaffeineService();
Future<bool> isKeepScreenOn() async { Future<bool> isKeepScreenOn() async {
return await _methodChannel.invokeMethod<bool>("isKeepScreenOn").then((value) => value!); return _methodChannel.invokeMethod<bool>("isKeepScreenOn").then((value) => value!);
} }
Future<void> keepScreenOn(bool keep) async { Future<void> keepScreenOn(bool keep) async {

View file

@ -1,7 +1,7 @@
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
class PermissionsService { class PermissionsService {
Future<PermissionStatus> checkCameraPermission() async => await Permission.camera.status; Future<PermissionStatus> checkCameraPermission() async => Permission.camera.status;
Future<PermissionStatus> requestCameraPermission() async => Permission.camera.request(); Future<PermissionStatus> requestCameraPermission() async => Permission.camera.request();
} }

View file

@ -1,4 +1,6 @@
class PlatformConfig { class PlatformConfig {
const PlatformConfig._();
static double get cameraPreviewAspectRatio { static double get cameraPreviewAspectRatio {
final rational = const String.fromEnvironment('cameraPreviewAspectRatio').split('/'); final rational = const String.fromEnvironment('cameraPreviewAspectRatio').split('/');
return int.parse(rational[0]) / int.parse(rational[1]); return int.parse(rational[0]) / int.parse(rational[1]);

View file

@ -104,7 +104,7 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
); );
_sizeAnimation = _sizeTween.animate(_defaultCurvedAnimation); _sizeAnimation = _sizeTween.animate(_defaultCurvedAnimation);
final renderBox = _key.currentContext!.findRenderObject() as RenderBox; final renderBox = _key.currentContext!.findRenderObject()! as RenderBox;
_closedOffset = renderBox.localToGlobal(Offset.zero); _closedOffset = renderBox.localToGlobal(Offset.zero);
_offsetAnimation = SizeTween( _offsetAnimation = SizeTween(
begin: Size( begin: Size(
@ -129,7 +129,7 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
_elevationAnimation = Tween<double>( _elevationAnimation = Tween<double>(
begin: 0, begin: 0,
end: Theme.of(context).dialogTheme.elevation!, end: Theme.of(context).dialogTheme.elevation,
).animate(_defaultCurvedAnimation); ).animate(_defaultCurvedAnimation);
} }

View file

@ -14,7 +14,7 @@ class DialogPicker<T> extends StatefulWidget {
final DialogPickerItemTitleBuilder<T> itemTitleBuilder; final DialogPickerItemTitleBuilder<T> itemTitleBuilder;
final DialogPickerItemTrailingBuilder<T>? itemTrailingBuilder; final DialogPickerItemTrailingBuilder<T>? itemTrailingBuilder;
final VoidCallback onCancel; final VoidCallback onCancel;
final ValueChanged onSelect; final ValueChanged<T> onSelect;
const DialogPicker({ const DialogPicker({
required this.icon, required this.icon,
@ -60,7 +60,7 @@ class _DialogPickerState<T> extends State<DialogPicker<T>> {
padding: Dimens.dialogIconTitlePadding, padding: Dimens.dialogIconTitlePadding,
child: Text( child: Text(
widget.title, widget.title,
style: Theme.of(context).textTheme.headlineSmall!, style: Theme.of(context).textTheme.headlineSmall,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
@ -74,7 +74,7 @@ class _DialogPickerState<T> extends State<DialogPicker<T>> {
), ),
child: Text( child: Text(
widget.subtitle!, widget.subtitle!,
style: Theme.of(context).textTheme.bodyMedium!, style: Theme.of(context).textTheme.bodyMedium,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),

View file

@ -61,7 +61,7 @@ class _DialogFilterState<T extends PhotographyValue> extends State<DialogFilter<
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
title: Text( title: Text(
widget.titleAdapter(context, widget.values[index]), widget.titleAdapter(context, widget.values[index]),
style: Theme.of(context).textTheme.bodyLarge!, style: Theme.of(context).textTheme.bodyLarge,
), ),
onChanged: (value) { onChanged: (value) {
if (value != null) { if (value != null) {
@ -96,7 +96,7 @@ class _DialogFilterState<T extends PhotographyValue> extends State<DialogFilter<
TextButton( TextButton(
onPressed: _hasAnySelected onPressed: _hasAnySelected
? () { ? () {
List<T> selectedValues = []; final List<T> selectedValues = [];
for (int i = 0; i < widget.values.length; i++) { for (int i = 0; i < widget.values.length; i++) {
if (checkboxValues[i]) { if (checkboxValues[i]) {
selectedValues.add(widget.values[i]); selectedValues.add(widget.values[i]);

View file

@ -9,7 +9,7 @@ extension SignedString on num {
} }
extension SignedStringDouble on double { extension SignedStringDouble on double {
String toStringSignedAsFixed(fractionDigits) { String toStringSignedAsFixed(int fractionDigits) {
if (this > 0) { if (this > 0) {
return "+${toStringAsFixed(fractionDigits)}"; return "+${toStringAsFixed(fractionDigits)}";
} else { } else {