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
linter:
rules:
use_setters_to_change_properties: false
analyzer:
exclude:
- "**/generated/**"

View file

@ -6,7 +6,7 @@ class CaffeineService {
const CaffeineService();
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 {

View file

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

View file

@ -1,4 +1,6 @@
class PlatformConfig {
const PlatformConfig._();
static double get cameraPreviewAspectRatio {
final rational = const String.fromEnvironment('cameraPreviewAspectRatio').split('/');
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);
final renderBox = _key.currentContext!.findRenderObject() as RenderBox;
final renderBox = _key.currentContext!.findRenderObject()! as RenderBox;
_closedOffset = renderBox.localToGlobal(Offset.zero);
_offsetAnimation = SizeTween(
begin: Size(
@ -129,7 +129,7 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
_elevationAnimation = Tween<double>(
begin: 0,
end: Theme.of(context).dialogTheme.elevation!,
end: Theme.of(context).dialogTheme.elevation,
).animate(_defaultCurvedAnimation);
}

View file

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

View file

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

View file

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