Atomic Design micro-UI architecture
90
90%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
StatelessWidget for atoms — components that receive ALL data via constructor parameters and render it without any local state, controllers, or Riverpod access.HookConsumerWidget, ConsumerWidget, StatefulWidget, or HookWidget for atoms. If the component needs no controllers, no ref, and no mutable state, it MUST be a StatelessWidget.final and use const constructors when possible.HookConsumerWidget from hooks_riverpod for molecules — interactive components that require local controllers (e.g., useTextEditingController, useFocusNode, useAnimationController) OR need to read/watch Riverpod providers.HookConsumerWidget. Business logic MUST stay in Riverpod providers or BLoCs.HookConsumerWidget MUST ONLY handle:
Validator class or mixin (see Validator Rule below)ref.read(provider.notifier).submit(value))setState() in any micro-UI component. Use hooks for local state (useState, useTextEditingController) and Riverpod for shared state.Validator class or mixin per molecule. The validator MUST NOT live inline inside the build() method.String? validate(String? value) method (or equivalent typed signature) for each field.validate method to TextFormField.validator (or equivalent) so error states render automatically via Flutter's Form widget.GlobalKey<FormState> to trigger formKey.currentState!.validate() before submitting.Form + Validator pattern.ref, no mutable state. Examples: labels, icons, badges, static cards, display-only list items.useTextEditingController, useFocusNode), or must access Riverpod state (ref.watch). Examples: search bars, form fields, toggle switches with state, filter chips with selection.HookConsumerWidget when StatelessWidget suffices. Start with atom; escalate to molecule ONLY when required.HookConsumerWidget molecule.ProviderScope with overrides: to mock all Riverpod dependencies.mocktail for mocking providers and dependencies — NEVER mockito.StatelessWidget) tests are optional but MUST be written if the atom has conditional rendering logic (e.g., null checks, theme variations).lib/shared/widgets/atoms/ or lib/features/{feature}/presentation/widgets/atoms/.lib/shared/widgets/molecules/ or lib/features/{feature}/presentation/widgets/molecules/.{molecule_name}_validator.dart in the same directory.test/shared/widgets/molecules/ or test/features/{feature}/presentation/widgets/molecules/.