Service Layer low complexity frontendmobile
1
Dependencies
0
Dependents
0
Entities
1
Integrations

Description

Orchestrates capturing the results card as an image and invoking the native platform share sheet. Ensures the share payload includes a descriptive accessible text summary alongside the image for screen-reader users and messaging apps that strip images.

Feature: Volunteer Benefit Calculator

benefit-share-service

Summaries

The Benefit Share Service transforms every completed benefit calculation into a branded, shareable asset that peer mentors can distribute through any messaging or social platform. By enabling one-tap sharing of a visual results card alongside an accessible plain-text summary, the organisation converts individual volunteer sessions into organic advocacy moments. Each share extends programme visibility to the mentor's personal network at zero additional marketing cost, reinforcing the measurable social impact narrative that attracts funding partners and drives volunteer recruitment. Accessibility compliance ensures no user is excluded from participating in this advocacy loop, protecting the organisation from reputational and legal risk while broadening reach.

The Benefit Share Service is a self-contained, low-complexity deliverable that depends only on the Benefit Results Card component being finalised. The two key technical risks are platform-specific share-sheet behaviour on iOS versus Android and the RepaintBoundary image capture timing relative to widget render completion; both are well-documented Flutter patterns with established mitigation approaches. QA must cover both platforms, test accessibility text accuracy against real calculation outputs, and validate behaviour when the device share sheet is cancelled or unavailable. No backend dependency exists, making this an ideal candidate for late-sprint scheduling once the calculator UI is stable.

Benefit Share Service integrates with Flutter's RepaintBoundary API to rasterise the results card widget identified by a GlobalKey into a Uint8List PNG buffer, then passes the buffer alongside a plain-text summary string to the platform share sheet via the share_plus package. The buildShareText method formats BenefitCalculationResult fields into a human-readable string suitable for messaging apps that strip image attachments, ensuring content integrity across all share targets. The shareResult method coordinates the async image capture and share invocation, requiring care around widget binding readiness before capture. No persistent state is introduced; the component is purely procedural and stateless, keeping it trivially testable with mock GlobalKey and result fixtures.

Responsibilities

  • Capture the results card widget as a PNG image via RepaintBoundary
  • Compose a plain-text summary of the benefit metrics for the share payload
  • Invoke the platform share sheet with image and text

Interfaces

shareResult(GlobalKey cardKey, BenefitCalculationResult result) → Future<void>
captureCardImage(GlobalKey key) → Future<Uint8List>
buildShareText(BenefitCalculationResult result) → String

Relationships

Dependencies (1)

Components this component depends on

Used Integrations (1)

External integrations and APIs this component relies on

API Contract

View full contract →
REST /api/v1/benefit-shares 6 endpoints
GET /api/v1/benefit-shares
GET /api/v1/benefit-shares/:id
POST /api/v1/benefit-shares
PUT /api/v1/benefit-shares/:id
DELETE /api/v1/benefit-shares/:id
POST /api/v1/benefit-shares/preview-text