MagicStarterPlanCardScope class
Publishes the catalogue row a plan card was built from, so the
plan_card_highlight slot can render the fields this package never names.
A slot builder is a Widget Function(BuildContext), so a context is the
only channel a slot has. This scope wraps the slot subtree on every plan
card and hands the whole MagicStarterPlan over, MagicStarterPlan.raw
included. That map is the point: the package types the fields every
billing screen needs and leaves the vendor's own product fields (an
ai_line sales pitch, a responder_add_on surcharge, a limits map)
untouched inside it, and a consumer usually has to render MORE than one of
them. Dropping a surcharge line omits a recurring CHARGE from a purchase
decision, which is a different class of harm from omitting a value claim,
so the slot carries everything rather than a field this package picked.
Example
MagicStarter.view.slot('teams.billing', 'plan_card_highlight', (context) {
final plan = MagicStarterPlanCardScope.of(context);
final aiLine = plan.raw['ai_line'] as String?;
final addOn = plan.raw['responder_add_on'] as String?;
return WDiv(
className: 'flex flex-col gap-1',
children: [
if (aiLine != null) WText(aiLine, className: 'text-xs'),
if (addOn != null) WText(addOn, className: 'text-xs'),
],
);
});
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- ProxyWidget
- InheritedWidget
- MagicStarterPlanCardScope
Constructors
- MagicStarterPlanCardScope({Key? key, required MagicStarterPlan plan, required Widget child})
-
Creates the scope around one plan card's slot subtree.
const
Properties
- child → Widget
-
The widget below this widget in the tree.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- plan → MagicStarterPlan
-
The catalogue row the surrounding card was built from.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → InheritedElement -
Inflates this configuration to a concrete instance.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
-
updateShouldNotify(
covariant MagicStarterPlanCardScope oldWidget) → bool -
Whether the framework should notify widgets that inherit from this widget.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → MagicStarterPlan - The plan the nearest enclosing card was built from.