pharmago_packages library
PharmaGO Packages - Reusable Flutter components for pharmacy applications.
This library provides generic, reusable widgets and utilities that can be used across different Flutter applications without context-specific dependencies.
Barcode Scanning
The barcode module provides camera-based and external scanner support:
import 'package:pharmago_packages/pharmago_packages.dart';
// Camera-based scanner
BarcodeScannerWidget(
onBarcodeDetected: (barcode) => print('Scanned: $barcode'),
config: BarcodeScannerConfig(
enableFlash: true,
enableZoom: true,
),
)
// External keyboard/scanner listener
BarcodeKeyboardListenerWidget(
onBarcode: (barcode) => print('Scanned: $barcode'),
)
PDF Generation
The PDF module provides custom PDF generation with headers, KPIs, tables, charts, and footers:
import 'package:pharmago_packages/pharmago_packages.dart';
final pdfBuilder = PdfBuilder(
config: PdfConfig.a4Portrait(),
header: PdfHeaderConfig(
title: 'Monthly Report',
subtitle: 'Sales Summary',
),
);
pdfBuilder.addSection(PdfKpiSection(
order: 1,
items: [
PdfKpiItem(
title: 'Total Sales',
value: 'R\$ 50.000,00',
columnSpan: PdfColumnSpan.col3,
),
],
));
final bytes = await pdfBuilder.build();
Classes
- Address
- An address.
- Barcode
- Represents a single recognized barcode and its value.
- BarcodeCameraModeWidget
- A widget that displays the camera mode button (collapsed barcode icon).
- BarcodeCapture
- This class represents a scanned barcode.
- BarcodeKeyboardListenerConfig
- Configuration options for the BarcodeKeyboardListenerWidget.
- BarcodeKeyboardListenerWidget
- A generic widget for capturing barcode input from external keyboard/scanner devices.
- BarcodeKeyboardListenerWidgetState
- BarcodeScannerActionButton
- Configuration for a customizable action button in the barcode scanner.
- BarcodeScannerConfig
- Configuration options for the BarcodeScannerWidget.
- BarcodeScannerController
- Controller for managing the barcode scanner lifecycle and state.
- BarcodeScannerOverlay
- A customizable overlay widget for the barcode scanner.
- BarcodeScannerSettings
- Service for persisting barcode scanner settings locally.
- BarcodeScannerSettingsData
- Data class containing all barcode scanner settings.
- BarcodeScannerWidget
- A generic, reusable barcode scanner widget.
- BarcodeScannerWidgetState
- BarcodeScannerWithSearch
- A barcode scanner widget with an expandable side action area.
- BarcodeScannerWithSearchState
- BarcodeSideActionConfig
- Configuration for a side action button in the barcode scanner.
- BarcodeSideActionWidget
- A widget that displays a side action button for the barcode scanner.
- CalendarEvent
- A calendar event extracted from a QRCode.
- ContactInfo
- A person's or organization's business card. For example a VCARD.
- DriverLicense
- A driver license or ID card.
- An email message from a 'MAILTO:' or similar QRCode type.
- GeoPoint
-
GPS coordinates from a
GEO:or similar QRCode type. - MobileScanner
- This widget displays a live camera preview for the barcode scanner.
- MobileScannerController
- The controller for the MobileScanner widget.
- MobileScannerErrorDetails
- The raw error details for a MobileScannerException.
- MobileScannerPlatform
-
The platform interface for the
mobile_scannerplugin. - MobileScannerState
- This class represents the current state of a MobileScannerController.
- PdfBuilder
- Main builder class for creating custom PDF documents.
- PdfBuildResult
- Result of PDF generation that includes metadata about the generation.
- PdfChartConfig
- Configuration for a chart.
- PdfChartDataPoint
- Data point for charts.
- PdfChartItem
- A single chart item that can be arranged in a grid.
- PdfChartSection
- A section containing multiple charts arranged in a grid.
- PdfChartSeries
- Data series for line charts.
- PdfConfig
- Configuration for the PDF document.
- PdfCustomWidgetItem
- Represents a single custom widget item for the PDF.
- PdfCustomWidgetSection
- A section containing custom widgets arranged in a grid.
- PdfFontFamily
- A complete font family with all four variants.
- PdfFontHelper
- Helper class for loading fonts with Unicode support for PDF generation.
- PdfFontPair
- A pair of fonts containing regular and bold variants.
- Configuration for the PDF footer section.
- PdfFormFieldItem
- Represents a single form field item with label and value.
- PdfFormFieldTextStyle
- Text style configuration for form field labels or values.
- PdfFormSection
- A section containing multiple form fields arranged in a grid.
- PdfGridItem
- A section item that can be arranged in a grid layout.
- PdfGridLayoutHelper
- Helper class to organize grid items into rows.
- PdfHeaderConfig
- Configuration for the PDF header section.
- PdfIconHelper
- Helper class for converting Flutter icons to PDF-compatible image bytes.
- PdfKpiIconPosition
- Position configuration for KPI icons using absolute positioning.
- PdfKpiIconStyle
- Style configuration for icons in PDF KPI items.
- PdfKpiItem
- Represents a single KPI (Key Performance Indicator) item.
- PdfKpiSection
- A section containing multiple KPI items arranged in a grid.
- PdfSection
- Base class for all PDF sections.
- PdfSectionTitleConfig
- Complete configuration for a section title.
- PdfSectionTitleDividerConfig
- Configuration for the section title divider.
- PdfSectionTitleIconConfig
- Configuration for the section title icon.
- PdfTableCell
- Represents a cell in a table row.
- PdfTableConfig
- Configuration for the table section.
- Configuration for a table footer cell.
- PdfTableHeaderConfig
- Configuration for a table header column.
- PdfTableRow
- Represents a row in a table.
- PdfTableSection
- A section containing a data table with automatic multi-page support.
- PdfTableTextCell
- A simple text cell in a table.
- PdfTableWidgetCell
- A custom widget cell in a table.
- PersonName
- A person's name, divided into individual components.
- PharmagoPackageTranslations
- Translations for PharmaGO Packages components.
- Phone
- Phone number information from a barcode.
- QrDetection
- A single QR/barcode detection, already mapped from the camera image space to the coordinate space of the QrTrackerScanner widget.
- QrDetectionOverlayStyle
- Visual style for the overlay painted around each detected code.
- QrTrackerScanner
- A full-area camera scanner that auto-detects one or more QR Codes (or other formats), draws a live overlay that follows each code as it moves, and lets you fully customize both the overlay style and the per-detection widget.
- ScanningLineAnimation
- A simple scanning line animation widget.
- SMS
-
An sms message from a
SMS:or similar QRCode type. - UrlBookmark
-
A URL and title from a
MEBKM:or similar QRCode type. - WiFi
- Wireless network information from BarcodeType.wifi barcodes.
Enums
- AddressType
- Address type constants.
- BarcodeFormat
- This enum defines the different barcode formats.
- BarcodeScannerMode
- Enum representing the current mode of the scanner.
- BarcodeScannerState
- Represents the current state of the barcode scanner.
- BarcodeType
- Barcode value type constants.
- CameraFacing
- The facing of a camera.
- DetectionSpeed
- The detection speed of the scanner.
- DevicePerformanceMode
- Device performance classification based on RAM.
- EmailType
- Email format type constants.
- EncryptionType
- Wifi encryption type constants.
- KpiTrend
- Trend indicator for KPI items.
- MobileScannerAuthorizationState
- The authorization state of the scanner.
- MobileScannerErrorCode
- This enum defines the different error codes for the mobile scanner.
- PdfChartType
- Type of chart to render.
- PdfColumnSpan
- Represents a Bootstrap-like column span system (col1 to col12).
- PdfFormFieldOrientation
- Orientation for form field label/value layout.
- PhoneType
- Phone number format type constants.
- TorchState
- The state of the flashlight.
Extensions
- ColorToPdfColor on Color
- Extension to convert Flutter Color to PdfColor.
- PdfBuilderExtensions on PdfBuilder
- Extension methods for easier PDF creation.
-
PdfColumnSpanExtension
on List<
PdfColumnSpan> - Extension to help with layout calculations.
Typedefs
- MobileScannerErrorBuilder = Widget Function(BuildContext, MobileScannerException, Widget?)
- The function signature for the error builder.
- QrDetectionCountBuilder = Widget Function(BuildContext context, int count)
- Builds a custom widget that reports how many codes are currently detected.
- QrDetectionLabelBuilder = Widget Function(BuildContext context, QrDetection detection, int index, int total)
- Builds a custom widget for a single detected code.
- VoidCallback = void Function()
Exceptions / Errors
- MobileScannerBarcodeException
- This class represents an exception thrown by the MobileScannerController when a barcode scanning error occurs when processing an input frame.
- MobileScannerException
- This class represents an exception thrown by the MobileScannerController.
- PdfPageLimitExceededException
- Exception thrown when the PDF exceeds the maximum allowed pages.