Config class final
Widgetbook-specific configuration for generated custom-widget stories.
Import this annotation from package:restage/widgetbook.dart (or the
corresponding rfw_catalog_schema / restage_shared entrypoint) with a
target prefix:
import 'package:flutter/widgets.dart';
import 'package:restage/restage.dart';
import 'package:restage/widgetbook.dart' as wb;
/// Displays whether a status is enabled.
@RestageWidget()
@wb.Config(
expansion: wb.StoryExpansion.cartesian,
maxStories: 12,
)
class StatusCard extends StatelessWidget {
const StatusCard({super.key, required this.enabled});
/// Whether the status is enabled.
@wb.Config.values([true, false])
final bool enabled;
@override
Widget build(BuildContext context) => Text(enabled ? 'On' : 'Off');
}
expansion and maxStories configure a widget class. Independent expansion is the default. The generator allows 32 stories per widget by default; maxStories may deliberately lower or raise that limit, but must be greater than zero and no greater than the absolute ceiling of 256.
storyValues and allValues configure an individual bool or enum
constructor property. The Restage generator validates those placements and
the selected values.
- Annotations
-
- @immutable
- @Target.new({TargetKind.classType, TargetKind.field})
Constructors
-
Config({bool? enabled, StoryExpansion? expansion, int? maxStories, List<
Object?> ? storyValues, bool allValues = false}) -
Creates a Widgetbook configuration overlay.
const
- Config.allValues()
-
Selects every finite value of the annotated
boolor enum property.const - Config.enabled(bool enabled)
-
Controls whether the annotated custom widget gets Widgetbook stories.
const
- Config.expansion(StoryExpansion expansion)
-
Configures how finite property axes are expanded into stories.
const
- Config.maxStories(int maxStories)
-
Configures the maximum generated story count for one widget.
const
-
Config.values(List<
Object?> storyValues) -
Selects finite story values for the annotated property.
const
Properties
- allValues → bool
-
Whether every finite value of one property is selected.
final
- enabled → bool?
-
Whether this custom widget participates in Widgetbook story emit.
final
- expansion → StoryExpansion?
-
Story expansion policy, or
nullto use independent expansion.final - hashCode → int
-
The hash code for this object.
no setterinherited
- maxStories → int?
-
Per-widget story-count limit override (package default 32, ceiling 256).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
storyValues
→ List<
Object?> ? -
Authored finite values for one property, in story order.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited