inuba_flutter_sdk 1.4.1 copy "inuba_flutter_sdk: ^1.4.1" to clipboard
inuba_flutter_sdk: ^1.4.1 copied to clipboard

iNuba App SDK for Flutter - Integration library for Flutter mobile applications

example/lib/main.dart

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

/// Entry point of the application
void main() {
  runApp(const MyApp());
}

/// Main application widget that sets up the MaterialApp
class MyApp extends StatelessWidget {
  /// Creates a [MyApp] widget
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'iNuba SDK Example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
        useMaterial3: true,
      ),
      home: const INubaSDKExampleScreen(),
    );
  }
}

/// Example screen that demonstrates the usage of the iNuba SDK widget
class INubaSDKExampleScreen extends StatefulWidget {
  /// Creates an [INubaSDKExampleScreen] widget
  const INubaSDKExampleScreen({super.key});

  @override
  State<INubaSDKExampleScreen> createState() => _INubaSDKExampleScreenState();
}

class _INubaSDKExampleScreenState extends State<INubaSDKExampleScreen> {
  INubaSDKController controller = INubaSDKController();

  @override
  void initState() {
    super.initState();
    INubaSDKController.clearCache();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text('iNuba SDK Example'),
      ),
      body: INubaSDK(
        controller: controller,
        // Required critical parameters
        clientToken:
            'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjbWdxYWcyeWEwMDAwcnJ1eWY0NjRwazM1IiwibmFtZSI6ImFzaXNhX2NsaWVudF9QX2EocTkxIiwidG9rZW5WZXJzaW9uIjowLCJpYXQiOjE3NzAzMDA5OTUsImV4cCI6MTc3MDMwMjc5NSwiaXNzIjoiYXNpc2EtYmFjayJ9.oQvmiNZcJDZKYA8xlqIxNazEvHqqB89k2WbxuYbcpJE',
        userToken: 'd625777a-b12e-448f-b206-ac518675df46',

        // Optional
        whitelabel: Whitelabel.custom("Asisa"),
        environment: Environment.production,
        platform: Platform.ios,
        displayMode: DisplayMode.inlineView,
        language: Language.en,
        unitMeasurement: UnitMeasurement.metric,
        initialDeeplink: DeepLink.showCalendar,

        // Required: Handle file downloads from WebView
        onDownload: (url, filename, downloadAndShare) {
          // Implement your download logic here
          // Example: Use flutter_downloader or flutter_file_downloader packages
        },
        // Optional: Handle SDK close events
        onClose: (CloseReason reason) {
          /// Implement your close logic here
          ///
          /// Example: Navigator.pop(context, reason);
        },
      ),
      bottomNavigationBar: BottomNavigationBar(
        backgroundColor: Theme.of(context).colorScheme.primary,
        selectedItemColor: Colors.white,
        unselectedItemColor: Colors.white,
        onTap: (value) {
          switch (value) {
            case 0:
              controller.injectDeeplink(DeepLink.showHome);
            case 1:
              controller.injectDeeplink(DeepLink.showHeartRate);
            case 2:
              controller.injectDeeplink(DeepLink.showSteps);
          }
        },
        items: [
          BottomNavigationBarItem(
            icon: Icon(Icons.home_rounded),
            label: 'Home',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.heart_broken_rounded),
            label: 'Heart Rate',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.do_not_step_sharp),
            label: 'Steps',
          ),
        ],
      ),
    );
  }
}
4
likes
160
points
400
downloads
screenshot

Publisher

verified publisheraldahirfernando.dev

Weekly Downloads

iNuba App SDK for Flutter - Integration library for Flutter mobile applications

Homepage
Repository

Topics

#inuba #sdk #android #ios #web

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_inappwebview

More

Packages that depend on inuba_flutter_sdk