ShadThemeScope class
Applies a ShadThemeData to a subtree, including the ambient text and icon styling that comes with it.
ShadTheme alone only publishes the Shad theme: ShadTheme.of picks it up,
but a plain Text keeps whatever DefaultTextStyle it inherited from
further up, so a light-on-dark panel inside a light app renders dark text on
a dark surface. ShadApp avoids this by also installing a Material Theme;
this widget does the same thing for any subtree.
Reach for it when part of the UI is deliberately themed differently from the app — a dark settings panel, a themed preview pane, an embedded editor:
ShadThemeScope(
data: ShadThemeData(
brightness: Brightness.dark,
colorScheme: const ShadNeutralColorScheme.dark(),
),
child: const SettingsPanel(),
)
Overlays opened from inside the scope — popovers, tooltips, selects — stay
within it, because they are built through OverlayPortal from this position
in the tree. Routes do not: showShadDialog re-publishes the ambient theme
itself for that reason.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ShadThemeScope
- Available extensions
Constructors
- ShadThemeScope({Key? key, required ShadThemeData data, required Widget child, bool applyMaterialTheme = true})
-
Applies a ShadThemeData to a subtree, including the ambient text and icon
styling that comes with it.
const
Properties
- applyMaterialTheme → bool
-
Whether to install the derived Material Theme as well.
final
- child → Widget
-
final
- data → ShadThemeData
-
The theme to apply to child.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
animate(
{Key? key, List< Effect> ? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) → Animate -
Available on Widget, provided by the AnimateWidgetExtensions extension
Wraps the target Widget in an Animate instance, and returns the instance for chaining calls. Ex.myWidget.animate()is equivalent toAnimate(child: myWidget). -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
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
-
positionedWith(
ShadPosition position) → Widget -
Available on Widget, provided by the PositionedExt extension
-
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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited