From 3046175a5ee185a89bc6be990472510c1fe2d088 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Mon, 25 Dec 2023 11:49:36 +0100 Subject: [PATCH 1/2] docs(neon_framework): Add a few missing docs Signed-off-by: jld3103 --- packages/neon_framework/lib/src/bloc/result.dart | 1 + packages/neon_framework/lib/src/pages/login_qr_code.dart | 2 ++ .../lib/src/settings/widgets/settings_category.dart | 1 + .../neon_framework/lib/src/utils/confirmation_dialog.dart | 1 + packages/neon_framework/lib/src/utils/findable.dart | 1 + packages/neon_framework/lib/src/utils/rename_dialog.dart | 3 +++ .../neon_framework/lib/src/widgets/custom_background.dart | 1 + .../neon_framework/lib/src/widgets/drawer_destination.dart | 5 +---- packages/neon_framework/lib/src/widgets/image.dart | 1 + 9 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/neon_framework/lib/src/bloc/result.dart b/packages/neon_framework/lib/src/bloc/result.dart index 18737be2683..d60d538e9ef 100644 --- a/packages/neon_framework/lib/src/bloc/result.dart +++ b/packages/neon_framework/lib/src/bloc/result.dart @@ -107,6 +107,7 @@ class Result { /// Copies this Result in a loading state. Result asLoading() => copyWith(isLoading: true); + /// Copies this Result and optionally replaces the [data], [error], [isLoading] and [isCached]. Result copyWith({ final T? data, final Object? error, diff --git a/packages/neon_framework/lib/src/pages/login_qr_code.dart b/packages/neon_framework/lib/src/pages/login_qr_code.dart index c8e6498b64c..6721dd28e93 100644 --- a/packages/neon_framework/lib/src/pages/login_qr_code.dart +++ b/packages/neon_framework/lib/src/pages/login_qr_code.dart @@ -64,8 +64,10 @@ class _LoginQRcodePageState extends State { ); } +/// Exception which is thrown when an invalid QR code is encountered. @immutable class InvalidQRcodeException extends NeonException { + /// Creates a new [InvalidQRcodeException]. const InvalidQRcodeException(); @override diff --git a/packages/neon_framework/lib/src/settings/widgets/settings_category.dart b/packages/neon_framework/lib/src/settings/widgets/settings_category.dart index 655cfa06e85..c0e9587195a 100644 --- a/packages/neon_framework/lib/src/settings/widgets/settings_category.dart +++ b/packages/neon_framework/lib/src/settings/widgets/settings_category.dart @@ -36,6 +36,7 @@ class SettingsCategory extends StatelessWidget { } } +@internal class MaterialSettingsCategory extends StatelessWidget { const MaterialSettingsCategory({ required this.children, diff --git a/packages/neon_framework/lib/src/utils/confirmation_dialog.dart b/packages/neon_framework/lib/src/utils/confirmation_dialog.dart index e1335b9975d..e36b8e329a9 100644 --- a/packages/neon_framework/lib/src/utils/confirmation_dialog.dart +++ b/packages/neon_framework/lib/src/utils/confirmation_dialog.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:neon_framework/l10n/localizations.dart'; import 'package:neon_framework/src/theme/colors.dart'; +/// Shows a dialog asking the user to confirm the question posed in the [title]. Future showConfirmationDialog(final BuildContext context, final String title) async => await showDialog( context: context, diff --git a/packages/neon_framework/lib/src/utils/findable.dart b/packages/neon_framework/lib/src/utils/findable.dart index 88e8b2ca585..8779dc7c0c6 100644 --- a/packages/neon_framework/lib/src/utils/findable.dart +++ b/packages/neon_framework/lib/src/utils/findable.dart @@ -6,6 +6,7 @@ abstract interface class Findable { String get id; } +/// An extension to find [Findable]s in an iterable. extension FindExtension on Iterable { /// Returns the first element matching [id] by [Findable.id]. /// diff --git a/packages/neon_framework/lib/src/utils/rename_dialog.dart b/packages/neon_framework/lib/src/utils/rename_dialog.dart index 51cac2a4ce6..9854cde975a 100644 --- a/packages/neon_framework/lib/src/utils/rename_dialog.dart +++ b/packages/neon_framework/lib/src/utils/rename_dialog.dart @@ -2,6 +2,9 @@ import 'package:flutter/material.dart'; import 'package:neon_framework/src/utils/validators.dart'; import 'package:neon_framework/src/widgets/dialog.dart'; +/// Shows a dialog asking the user to rename the thing stated in the [title]. +/// +/// [value] describes the current name of the thing before renaming. Future showRenameDialog({ required final BuildContext context, required final String title, diff --git a/packages/neon_framework/lib/src/widgets/custom_background.dart b/packages/neon_framework/lib/src/widgets/custom_background.dart index 8f095dfd84c..8665b6cc7ee 100644 --- a/packages/neon_framework/lib/src/widgets/custom_background.dart +++ b/packages/neon_framework/lib/src/widgets/custom_background.dart @@ -11,6 +11,7 @@ import 'package:neon_framework/src/widgets/options_collection_builder.dart'; /// The background will be loaded from the server. /// It might be a single color or a full image. class NeonCustomBackground extends StatelessWidget { + /// Creates a new custom background. const NeonCustomBackground({ required this.child, super.key, diff --git a/packages/neon_framework/lib/src/widgets/drawer_destination.dart b/packages/neon_framework/lib/src/widgets/drawer_destination.dart index f7b72457ed3..b1c5f23fcca 100644 --- a/packages/neon_framework/lib/src/widgets/drawer_destination.dart +++ b/packages/neon_framework/lib/src/widgets/drawer_destination.dart @@ -2,9 +2,6 @@ import 'package:flutter/material.dart'; import 'package:meta/meta.dart'; import 'package:rxdart/subjects.dart'; -@internal -typedef DestinationIconBuilder = Widget Function({double? size, Color color}); - @internal class NeonNavigationDestination { const NeonNavigationDestination({ @@ -15,7 +12,7 @@ class NeonNavigationDestination { }); final String label; - final DestinationIconBuilder icon; + final Widget Function({double? size, Color color}) icon; final Widget? selectedIcon; final BehaviorSubject? notificationCount; } diff --git a/packages/neon_framework/lib/src/widgets/image.dart b/packages/neon_framework/lib/src/widgets/image.dart index e62f96edf06..a24040b812d 100644 --- a/packages/neon_framework/lib/src/widgets/image.dart +++ b/packages/neon_framework/lib/src/widgets/image.dart @@ -127,6 +127,7 @@ class NeonCachedImage extends StatefulWidget { ); } + /// The [CacheManager] instance. @visibleForTesting static DefaultCacheManager cacheManager = DefaultCacheManager(); From 130990b8f9a8adc0459b512d158af3ddbd52efd0 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Mon, 25 Dec 2023 11:50:03 +0100 Subject: [PATCH 2/2] chore(neon_framework): Switch to file-level missing docs ignores Signed-off-by: jld3103 --- packages/neon_framework/analysis_options.yaml | 2 -- packages/neon_framework/lib/src/blocs/timer.dart | 2 ++ .../neon_framework/lib/src/settings/widgets/settings_list.dart | 2 ++ packages/neon_framework/lib/src/utils/request_manager.dart | 2 ++ packages/neon_framework/lib/src/widgets/list_view.dart | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/neon_framework/analysis_options.yaml b/packages/neon_framework/analysis_options.yaml index 07cc34c6171..350237667a8 100644 --- a/packages/neon_framework/analysis_options.yaml +++ b/packages/neon_framework/analysis_options.yaml @@ -2,8 +2,6 @@ include: package:neon_lints/flutter.yaml linter: rules: - # should be enabled for release. https://github.com/nextcloud/neon/issues/692 - public_member_api_docs: false # TODO: migrate package to new lint rules prefer_final_parameters: true avoid_final_parameters: false diff --git a/packages/neon_framework/lib/src/blocs/timer.dart b/packages/neon_framework/lib/src/blocs/timer.dart index 34aa7a5ef96..11f81735ad1 100644 --- a/packages/neon_framework/lib/src/blocs/timer.dart +++ b/packages/neon_framework/lib/src/blocs/timer.dart @@ -1,3 +1,5 @@ +// ignore_for_file: public_member_api_docs + import 'dart:async'; import 'dart:ui'; diff --git a/packages/neon_framework/lib/src/settings/widgets/settings_list.dart b/packages/neon_framework/lib/src/settings/widgets/settings_list.dart index bb009260f03..cd9598b7db5 100644 --- a/packages/neon_framework/lib/src/settings/widgets/settings_list.dart +++ b/packages/neon_framework/lib/src/settings/widgets/settings_list.dart @@ -1,3 +1,5 @@ +// ignore_for_file: public_member_api_docs + import 'package:flutter/material.dart'; import 'package:neon_framework/src/utils/adaptive.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; diff --git a/packages/neon_framework/lib/src/utils/request_manager.dart b/packages/neon_framework/lib/src/utils/request_manager.dart index 93e7592de8a..a0a35fcd96e 100644 --- a/packages/neon_framework/lib/src/utils/request_manager.dart +++ b/packages/neon_framework/lib/src/utils/request_manager.dart @@ -1,3 +1,5 @@ +// ignore_for_file: public_member_api_docs + import 'dart:async'; import 'dart:convert'; diff --git a/packages/neon_framework/lib/src/widgets/list_view.dart b/packages/neon_framework/lib/src/widgets/list_view.dart index ebd9e5f0f2a..3a026f00353 100644 --- a/packages/neon_framework/lib/src/widgets/list_view.dart +++ b/packages/neon_framework/lib/src/widgets/list_view.dart @@ -1,3 +1,5 @@ +// ignore_for_file: public_member_api_docs + import 'package:flutter/material.dart'; import 'package:neon_framework/src/widgets/error.dart'; import 'package:neon_framework/src/widgets/linear_progress_indicator.dart';