ezylite 1.0.1 copy "ezylite: ^1.0.1" to clipboard
ezylite: ^1.0.1 copied to clipboard

Embeddable Flutter POS module for retail checkout — barcode scanning, cart, and payments in host apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:ezylite/ezylite.dart';

void main() => runApp(const HostApp());

/// Minimal host app demonstrating how to embed ezyLite from another project.
class HostApp extends StatelessWidget {
  const HostApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ezyLite Host',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const HostHomePage(),
    );
  }
}

class HostHomePage extends StatelessWidget {
  const HostHomePage({super.key});

  Future<void> _openEzyLite(BuildContext context) async {
    final result = await EzyLitePlugin.open(
      context,
      config: EzyLiteConfig.malaysia(
        baseUrl: 'https://api-staging-ops01.retailetics.com',
        activationKey: '9894083066',
        partnerId: 'partner-demo-001',
      ),
    );

    if (!context.mounted || result == null) return;

    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text('ezyLite closed: ${result.status.name}'),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Host App'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(24),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Icon(Icons.storefront, size: 72),
              const SizedBox(height: 24),
              const Text(
                'This is your main application.\nTap below to open ezyLite POS.',
                textAlign: TextAlign.center,
                style: TextStyle(fontSize: 16),
              ),
              const SizedBox(height: 32),
              SizedBox(
                width: double.infinity,
                height: 52,
                child: ElevatedButton.icon(
                  onPressed: () => _openEzyLite(context),
                  icon: const Icon(Icons.point_of_sale),
                  label: const Text(
                    'OPEN EZYLITE POS',
                    style: TextStyle(fontWeight: FontWeight.bold),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}