core/share_helper
library
Functions
-
captureBoardPng(GlobalKey<State<StatefulWidget>> boundaryKey, {double pixelRatio = 2.0, String? overlayText})
→ Future<Uint8List?>
-
Captures
boundaryKey (must be a RepaintBoundary) as a PNG, overlaying
overlayText (if any) on a translucent bar at the bottom of the image —
so the image carries its own level/score/date info even if the recipient
only views/saves the picture, independent of the share caption. Returns
null if the widget hasn't built yet (context is null). Kept separate from
shareBoardImage so it's testable without touching share_plus's platform
channel.
-
shareBoardImage({required GlobalKey<State<StatefulWidget>> boundaryKey, required String text, BuildContext? sharePositionContext})
→ Future<void>
-
Captures the board then opens the share sheet with
text. No-op if the
capture fails.
-
shareJourneyCard({required Uint8List png, required String text, BuildContext? sharePositionContext})
→ Future<void>
-
Opens the share sheet with an already-captured journey card PNG.
-
shareScoreCard({required GlobalKey<State<StatefulWidget>> boundaryKey, required String levelText, BuildContext? sharePositionContext})
→ Future<void>
-
Captures a result widget (built temporarily in a hidden overlay right
before calling this) then opens the share sheet with
levelText — same
pattern as shareBoardImage but with a separate file/caption because
this is a result card, not a board screenshot. Wire this to
VictoryCardTemplate (presentation/widgets/common/victory_card_template.dart)
— wrap it in a RepaintBoundary(key: ...) and pass that key here.
-
shareText(String text, {BuildContext? sharePositionContext})
→ Future<void>
-
One shared share pipeline used by every call site in the app — text-only
(e.g. inviting friends) or with a captured screenshot (e.g. a level
result). Don't create a separate share function/plugin call elsewhere.