import 'package:flutter/widgets.dart'; /// Carries render-time collaborators (the link-tap hook) down the node tree so /// individual node widgets stay pure `(node) => Widget` builders. class PmRenderScope extends InheritedWidget { /// Invoked when a link mark or an image `href` is tapped. The navigation / /// URL policy is injected from outside — the renderer only exposes the hook. final void Function(String href)? onLinkTap; const PmRenderScope({ required this.onLinkTap, required super.child, super.key, }); static PmRenderScope? maybeOf(BuildContext context) => context.dependOnInheritedWidgetOfExactType(); @override bool updateShouldNotify(PmRenderScope oldWidget) => oldWidget.onLinkTap != onLinkTap; } /// Controls whether inline text below it may wrap. Table cells disable wrapping /// in the scroll/zoom modes so every row stays a single line (bound height), /// matching the web ticker; the default outside tables is to wrap. class PmCellTextFlow extends InheritedWidget { final bool softWrap; const PmCellTextFlow({ required this.softWrap, required super.child, super.key, }); static bool softWrapOf(BuildContext context) => context.dependOnInheritedWidgetOfExactType()?.softWrap ?? true; @override bool updateShouldNotify(PmCellTextFlow oldWidget) => oldWidget.softWrap != softWrap; }