docs(component_copy_with): add some documentation

This commit is contained in:
2023-04-13 23:29:27 +02:00
parent 7606d26aac
commit 5fe8d84cf6
8 changed files with 104 additions and 47 deletions
@@ -17,9 +17,29 @@
import 'package:meta/meta_meta.dart';
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
/// Annotation used to indicate that the `copyWith` extension
/// should be generated for the compononent.
/// {@template component_copy_with_extension}
/// This annotation class is used to annotate the implementation of components
/// directly in the application. It generates the implementation of the proxy
/// and the mixin to ensure that the component meets the specifications
/// defined in the UI Kit.
///
/// Basically it indicate that the `copyWith` extension
/// should be generated for the component.
///
/// ```dart
/// part 'loader.g.dart';
///
/// @ComponentCopyWithExtension()
/// class Loader extends LoaderComponent with $LoaderCWMixin {
///
/// const Loader({
/// ...
/// });
/// }
/// ```
/// {@endtemplate}
@Target({TargetKind.classType})
class ComponentCopyWithExtension extends ComponentAnnotation {
/// {@macro component_copy_with_extension}
const ComponentCopyWithExtension({super.skipFields});
}
@@ -14,12 +14,32 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:meta/meta_meta.dart';
import 'package:wyatt_component_copy_with_extension/src/domain/component_annotation.dart';
/// {@template component_proxy_extension}
/// This annotation class is used to annotate a new component of an UI kit.
/// It generates the abstract proxy of the component and allows access to
/// all its properties in different packages and throughout the application.
///
/// ```dart
/// part 'loader_component.g.dart';
///
/// @ComponentProxyExtension()
/// abstract class LoaderComponent extends Component
/// with CopyWithMixin<$LoaderComponentCWProxy> {
///
/// const LoaderComponent({
/// ...
/// });
/// }
/// ```
///
/// The [skipFields] option allows you to directly and specifically change
/// a field. This makes it easier to use.
///
/// {@endtemplate}
@Target({TargetKind.classType})
class ComponentProxyExtension {
const ComponentProxyExtension({
this.skipFields = true,
});
final bool? skipFields;
class ComponentProxyExtension extends ComponentAnnotation {
/// {@macro component_proxy_extension}
const ComponentProxyExtension({super.skipFields});
}
@@ -14,7 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// {@template component_annotation}
/// Abstract class that is used as a base for all annotations
/// {@endtemplate}
abstract class ComponentAnnotation {
/// {@macro component_annotation}
const ComponentAnnotation({this.skipFields = true});
/// Prevent the library from generating `copyWith` functions for individual