Story<TWidget extends Widget, TArgs extends StoryArgs<TWidget> > class
abstract
- Annotations
Constructors
-
Story({String? name, String? designLink, SetupBuilder<
TWidget, TArgs> setup = defaultSetup, List<Mode> ? modes, required TArgs args, required StoryWidgetBuilder<TWidget, TArgs> builder, List<Scenario< scenarios = const []})TWidget, TArgs> >
Properties
- $generatedName ↔ String
-
latefinal
- args → TArgs
-
final
-
builder
→ StoryWidgetBuilder<
TWidget, TArgs> -
Defines how the
TWidgetis built using the providedTArgs.final -
component
↔ Component<
Widget, StoryArgs< Widget> > -
A late back-reference to the component this story belongs to.
It is initialized in the Component constructor.
latefinal
- designLink → String?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
modes
→ List<
Mode> ? -
These Modes are only applied to Scenarios in this Story using
the Scenario.mergeModes function to combine them with Scenario.modes.
They are not applied to the Story itself.
final
- name → String
-
no setter
- path → String
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scenarios
→ List<
Scenario< TWidget, TArgs> > -
final
-
setup
→ SetupBuilder<
TWidget, TArgs> -
final
Methods
-
allScenarios(
Config config) → List< Scenario< TWidget, TArgs> > - A list of all scenarios for this story, assembled from the local ones defined in scenarios and the ones generated from the ScenarioDefinitions in the Config, according to each definition's ScenarioStrategy.
-
buildWithConfig(
BuildContext context, Config config, {TArgs? args, List< Mode> ? modes}) → Widget -
Builds the story widget wrapped with addons from the provided
config. Optionally,argsandmodescan be provided to override the story's default args and merge modes into the addons. -
mergeModesIntoAddons(
List< Mode> ? modes, List<Addon> ? addons) → List<Addon> -
Merges
modesintoaddons. For example ifaddonsare TextScaleAddon(1), ThemeAddon('dark') andmodesare TextScaleMode(3) the result should be TextScaleAddon(3), ThemeAddon('dark'). -
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
Static Methods
-
defaultSetup(
BuildContext context, Widget widget, StoryArgs args) → Widget - By default, Widgetbook forces a rebuild when args change as otherwise StatefulWidgets might not reflect the latest arg values. However, if a story has internal state that should be preserved across arg changes, this can be achieved by overriding the setup function and returning the widget unchanged.