Earnest Gift Vouchers SDK

A comprehensive Flutter SDK for integrating gift vouchers and physical products purchasing functionality into your Flutter applications.

Features

  • Gift Vouchers: Browse and purchase digital gift cards from various brands
  • Physical Products: Shop for physical products with delivery options
  • Cart Management: Add, remove, and manage items in shopping cart
  • Order Management: Track orders and view order history
  • Payment Integration: Multiple payment gateways (Razorpay, Paytm, Freecharge)
  • Search & Filter: Search products and filter by categories
  • Address Management: Manage delivery addresses for physical products
  • Voucher Management: View and manage purchased vouchers

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  earnest_giftvouchers_sdk: <latest_version>

Then run:

flutter pub get

Setup

1. Initialize the SDK

Before using any SDK features, initialize it with your configuration:

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

void main() {
  // Initialize SDK
  BacchatSdkConfig.initialize(
    userToken: 'your_jwt_token_here',
    primaryColor: Colors.blue,
    accentColor: Colors.orange,
    companyId: 'your_company_id',
  );
  
  runApp(MyApp());
}

2. Required Dependencies

The SDK automatically includes these dependencies. Ensure your app doesn't conflict:

dependencies:
  get: ^4.7.2
  dio: ^5.8.0+1
  cached_network_image: ^3.4.1
  razorpay_flutter: ^1.4.0
  paytm_allinonesdk: ^1.2.8
  # ... other dependencies

Usage

Basic Integration

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'My App',
      home: HomePage(), // SDK's main screen
    );
  }
}

Individual Screen Usage

Gift Vouchers Screen

import 'package:earnest_giftvouchers_sdk/earnest_giftvouchers_sdk.dart';

// Navigate to gift vouchers
Navigator.push(
  context,
  MaterialPageRoute(builder: (context) => GiftcardsScreen()),
);

Orders Screen

// View order history
Navigator.push(
  context,
  MaterialPageRoute(builder: (context) => OrderScreen()),
);

Vouchers Screen

// View purchased vouchers
Navigator.push(
  context,
  MaterialPageRoute(builder: (context) => VouchersScreen()),
);

Address Management

// Manage delivery addresses
Navigator.push(
  context,
  MaterialPageRoute(
    builder: (context) => UpdateDeliveryAddressScreen(),
  ),
);

Configuration Options

BacchatSdkConfig.initialize(
  userToken: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...', // JWT token with user info
  primaryColor: Color(0xFF6366F1),                        // Primary theme color
  accentColor: Color(0xFFF59E0B),                         // Accent theme color
  companyId: 'company_123',                               // Your company identifier
);

Complete Example

Complete example can be found here: Click Here

Platform Configuration

Android

Add to android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

iOS

Add to ios/Runner/Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Customization

Theme Colors

BacchatSdkConfig.initialize(
  // ... other params
  primaryColor: Colors.purple,    // Changes buttons, highlights
  accentColor: Colors.amber,      // Changes secondary elements
);

Debug Mode

Enable logging for debugging:

// The SDK uses Dio with LogInterceptor enabled in debug mode

Support

For issues and questions:

License

This SDK is proprietary software. Contact the maintainers for licensing information.