chore: add always_put_control_body_on_new_line lint (#28352)

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2026-05-12 00:47:24 +07:00
committed by GitHub
parent 7837d40f57
commit 12f7b2a005
122 changed files with 774 additions and 263 deletions
@@ -35,7 +35,9 @@ class CommentBubble extends ConsumerWidget {
Future<void> openAssetViewer() async {
final activityService = ref.read(activityServiceProvider);
final route = await activityService.buildAssetViewerRoute(activity.assetId!, ref);
if (route != null) await context.pushRoute(route);
if (route != null) {
await context.pushRoute(route);
}
}
// avatar (hidden for own messages)
@@ -49,7 +49,9 @@ class _VideoControlsState extends ConsumerState<VideoControls> {
}
void _onHideTimer() {
if (!mounted) return;
if (!mounted) {
return;
}
if (ref.read(_provider).status == VideoPlaybackStatus.playing) {
ref.read(assetViewerProvider.notifier).setControls(false);
}
@@ -91,7 +93,9 @@ class _VideoControlsState extends ConsumerState<VideoControls> {
final isFinished = !isCasting && videoStatus == VideoPlaybackStatus.completed;
ref.listen(assetViewerProvider.select((v) => v.showingControls), (prev, showing) {
if (showing && prev != showing) _hideTimer.reset();
if (showing && prev != showing) {
_hideTimer.reset();
}
});
ref.listen(_provider.select((v) => v.status), (_, __) => _hideTimer.reset());
@@ -190,7 +190,9 @@ class _TimeZoneOffset implements Comparable<_TimeZoneOffset> {
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (identical(this, other)) {
return true;
}
return other is _TimeZoneOffset && other.display == display && other.offsetInMilliseconds == offsetInMilliseconds;
}
+12 -4
View File
@@ -40,7 +40,9 @@ class LoginForm extends HookConsumerWidget {
final log = Logger('LoginForm');
String? _validateUrl(String? url) {
if (url == null || url.isEmpty) return null;
if (url == null || url.isEmpty) {
return null;
}
final parsedUrl = Uri.tryParse(url);
if (parsedUrl == null || !parsedUrl.isAbsolute || !parsedUrl.scheme.startsWith("http") || parsedUrl.host.isEmpty) {
@@ -51,9 +53,15 @@ class LoginForm extends HookConsumerWidget {
}
String? _validateEmail(String? email) {
if (email == null || email == '') return null;
if (email.endsWith(' ')) return 'login_form_err_trailing_whitespace'.tr();
if (email.startsWith(' ')) return 'login_form_err_leading_whitespace'.tr();
if (email == null || email == '') {
return null;
}
if (email.endsWith(' ')) {
return 'login_form_err_trailing_whitespace'.tr();
}
if (email.startsWith(' ')) {
return 'login_form_err_leading_whitespace'.tr();
}
if (email.contains(' ') || !email.contains('@')) {
return 'login_form_err_invalid_email'.tr();
}
@@ -15,7 +15,9 @@ class StarRatingPicker extends HookWidget {
return RadioGroup(
groupValue: selectedRating.value?.rating,
onChanged: (int? newValue) {
if (newValue == null) return;
if (newValue == null) {
return;
}
final newFilter = SearchRatingFilter(rating: newValue);
selectedRating.value = newFilter;
onSelect(newFilter);
@@ -74,7 +74,9 @@ class _AlbumSyncActionButtonState extends ConsumerState<_AlbumSyncActionButton>
} catch (_) {
} finally {
Future.delayed(const Duration(seconds: 1), () {
if (!mounted) return;
if (!mounted) {
return;
}
setState(() {
isAlbumSyncInProgress = false;
});
@@ -80,7 +80,9 @@ class _FreeUpSpaceSettingsState extends ConsumerState<FreeUpSpaceSettings> {
bool _isPresetSelected(int? daysAgo) {
final state = ref.read(cleanupProvider);
if (state.selectedDate == null) return false;
if (state.selectedDate == null) {
return false;
}
final expectedDate = daysAgo != null ? DateTime.now().subtract(Duration(days: daysAgo)) : DateTime(2000);
@@ -29,7 +29,9 @@ class SettingsSwitchListTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
void onSwitchChanged(bool value) {
if (!enabled) return;
if (!enabled) {
return;
}
valueNotifier.value = value;
onChanged?.call(value);